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 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 2c56ad6 commit 2ecbbda
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 48 deletions.
52 changes: 11 additions & 41 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"lerna:clean": "lerna run clean && lerna clean --y && npm run clean:packages && npm run clean",
"clean:packages": "rm -rf node_modules **/dist",
"storybook": "start-storybook -p 6005",
"build-storybook": "build-storybook"
"build-storybook": "build-storybook",
"postinstall": "npm run bootstrap --workspaces --if-present"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "rollup --config",
"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
6 changes: 3 additions & 3 deletions packages/design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"build:cssTypes": "tcm src/icons",
"build:colors": "node buildColors.js",
"build:foundation": "node buildFoundation.js && node jobberStyle.js && npm run build:foundationTypes && npm run build:addTypeLinterExceptions && npm run build:addFoundationLinterExceptions && npm run build:removeTempFiles",
"build:foundationTypes": "tsc --declaration --emitDeclarationOnly --allowJs foundation.js --outDir .",
"build:foundationTypes": "tsc --declaration --emitDeclarationOnly --allowJs foundation.js --outDir . --skipLibCheck",
"build:addTypeLinterExceptions": "(printf '/* tslint:disable */\n/* eslint-disable */\n/* This file is automatically generated and should not be edited. */\n'; cat foundation.d.ts) > foundation.d.ts.temp",
"build:addFoundationLinterExceptions": "(printf '/* tslint:disable */\n/* eslint-disable */\n/* This file is automatically generated and should not be edited. */\n'; cat foundation.js) > foundation.js.temp",
"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",
"build:iconCssStyleTypes": "tsc --declaration --emitDeclarationOnly --allowJs src/icons/iconStyles.ts --outDir ./src/icons --skipLibCheck",
"clean": "rm -rf dist/* icons/* colors.js foundation.* iconStyles.* tsconfig.tsbuildinfo",
"prepare": "npm run clean && npm run build"
"bootstrap": "npm run clean && npm run build"
},
"dependencies": {
"classnames": "^2.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/formatters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "tsc --project . --skipLibCheck",
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
"prepare": "npm run clean; npm run build"
"bootstrap": "npm run clean; npm run build"
},
"files": [
"dist/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "tsc --project . --skipLibCheck",
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
"prepare": "npm run clean; npm run build"
"bootstrap": "npm run clean; npm run build"
},
"files": [
"dist/*"
Expand Down

0 comments on commit 2ecbbda

Please sign in to comment.