Skip to content

Commit

Permalink
fix: workaround npm's lack of topological oder
Browse files Browse the repository at this point in the history
Basically, npm would run `prepare` on each packages in alphabetical order but components need design to be built first.

This works around that limitation by firing the scripts run script manually through `npm run [script] -w` which respects the order under `workspaces`

npm/rfcs#548
  • Loading branch information
darryltec committed Mar 20, 2023
1 parent 52513c5 commit 7eda422
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
6 changes: 5 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"packages/design",
"packages/hooks",
"packages/components",
"packages/*"
"packages/docx",
"packages/eslint-config",
"packages/generators",
"packages/stylelint-config"
],
"scripts": {
"prestart": "npm run buildHooksIndex",
Expand All @@ -35,7 +38,8 @@
"lerna:clean": "lerna run clean && lerna clean --y && npm run clean:packages && npm run clean",
"clean:packages": "rm -rf node_modules **/dist",
"storybook": "storybook dev -p 6005",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"postinstall": "npm run bootstrap --workspaces --if-present"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "rollup --config",
"clean": "echo 'pretend to clean. bring this back tho'",
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
"prepublishOnly": "ts-node --project ../../tsconfig.bin.json scripts/entryPoints.ts",
"prepare": "npm run clean; npm run build",
"bootstrap": "npm run clean; npm run build",
"postpublish": "ts-node --project ../../tsconfig.bin.json scripts/entryPoints.ts clean"
},
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"build:removeTempFiles": "rm -f src/foundation.js && mv foundation.d.ts.temp foundation.d.ts && mv foundation.js.temp foundation.js",
"build:iconCssStyle": "node buildIconStyles.js && npm run build:iconCssStyleTypes",
"build:iconCssStyleTypes": "tsc --declaration --emitDeclarationOnly --allowJs src/icons/iconStyles.ts --outDir ./src/icons",
"clean": "echo 'pretend to clean. bring this back tho'",
"prepare": "npm run clean && npm run build"
"clean": "rm -rf dist/* icons/* colors.js foundation.* iconStyles.* tsconfig.tsbuildinfo",
"bootstrap": "npm run clean && npm run build"
},
"dependencies": {
"classnames": "^2.3.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/formatters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc --project . --skipLibCheck",
"clean": "echo 'pretend to clean. bring this back tho'",
"prepare": "npm run clean; npm run build"
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
"bootstrap": "npm run clean; npm run build"
},
"files": [
"dist/*"
Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"types": "./dist/index.d.js",
"scripts": {
"build": "tsc --project . --skipLibCheck",
"clean": "echo 'pretend to clean. bring this back tho'",
"prepare": "npm run clean; npm run build"
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
"bootstrap": "npm run clean; npm run build"
},
"files": [
"dist/*"
Expand Down

0 comments on commit 7eda422

Please sign in to comment.