Skip to content

Commit ddc74c4

Browse files
authored
Improves npm start by using inotifywait (#5621)
* Move bump and pre/postversion to /scripts * Use inotifywait to watch and skip initial build * Ignore build error * Clean up /dist.tmp * Rerun npm run build:pre * No dupe tsconfig * Add entry * Trigger cla * Remove root
1 parent 04ad796 commit ddc74c4

File tree

75 files changed

+787
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+787
-443
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
325325
- Fixed published package types containing internal package references, in PR [#5610](https://github.com/microsoft/BotFramework-WebChat/pull/5610), by [@OEvgeny](https://github.com/OEvgeny)
326326
- Fixed citation links are not properly matched against markdown links, in PR [#5614](https://github.com/microsoft/BotFramework-WebChat/pull/5614), by [@OEvgeny](https://github.com/OEvgeny)
327327
- Fixed `botframework-webchat/decorator` import in legacy CommonJS environments, in [#5616](https://github.com/microsoft/BotFramework-WebChat/pull/5616), by [@OEvgeny](https://github.com/OEvgeny)
328+
- Fixed `npm start` for efficiency and reliability, in PR [#5621](https://github.com/microsoft/BotFramework-WebChat/pull/5621), by [@compulim](https://github.com/compulim)
328329

329330
### Removed
330331

package-lock.json

Lines changed: 45 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@
256256
"minimatch": "^10.0.3",
257257
"node-dev": "^8.0.0",
258258
"prettier": "^3.6.2",
259+
"read-package-up": "^11.0.0",
260+
"read-pkg": "^9.0.1",
259261
"selenium-webdriver": "^4.34.0",
260262
"serve": "^14.2.4",
261263
"serve-handler": "^6.1.6",

packages/api-middleware/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*.tgz
22
/dist/
3-
/dist.tmp/
43
/node_modules/
54
/tsup.config.bundled_*.mjs

packages/api-middleware/package.json

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,30 @@
5555
"./src/**/*",
5656
"*.js"
5757
],
58-
"localDependencies": {
59-
"@msinternal/botframework-webchat-base": "development",
60-
"@msinternal/botframework-webchat-react-hooks": "development",
61-
"@msinternal/botframework-webchat-react-valibot": "development"
62-
},
6358
"homepage": "https://github.com/microsoft/BotFramework-WebChat/tree/main/packages/api-middleware#readme",
6459
"scripts": {
65-
"build": "tsup --config ./tsup.config.ts",
66-
"bump": "npm run bump:prod && npm run bump:dev && (npm audit fix || exit 0)",
67-
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
68-
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install --save-exact $PACKAGES_TO_BUMP || true",
60+
"build": "npm run --if-present build:pre && npm run build:run && npm run --if-present build:post",
61+
"build:pre": "npm run build:pre:local-dependencies && npm run build:pre:watch",
62+
"build:pre:local-dependencies": "../../scripts/npm/build-local-dependencies.sh",
63+
"build:pre:watch": "../../scripts/npm/build-watch.sh",
64+
"build:run": "tsup",
65+
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:peer && (npm audit fix || exit 0)",
66+
"bump:dev": "../../scripts/npm/bump-dev.sh",
67+
"bump:peer": "../../scripts/npm/bump-peer.sh",
68+
"bump:prod": "../../scripts/npm/bump-prod.sh",
6969
"eslint": "npm run precommit",
70-
"postversion": "cat package.json | jq '.version as $V | (.localDependencies // {} | with_entries(select(.value == \"production\") | { key: .key, value: $V })) as $L1 | (.localDependencies // {} | with_entries(select(.value == \"development\") | { key: .key, value: $V })) as $L2 | ((.dependencies // {}) + $L1 | to_entries | sort_by(.key) | from_entries) as $D1 | ((.devDependencies // {}) + $L2 | to_entries | sort_by(.key) | from_entries) as $D2 | . + { dependencies: $D1, devDependencies: $D2 }' > package-temp.json && mv package-temp.json package.json",
70+
"postversion": "node ../../scripts/npm/postversion.sh",
7171
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
7272
"precommit:eslint": "../../node_modules/.bin/eslint --report-unused-disable-directives --max-warnings 0",
7373
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
74-
"preversion": "cat package.json | jq '(.localDependencies // {} | to_entries | map([if .value == \"production\" then \"dependencies\" else \"devDependencies\" end, .key])) as $P | delpaths($P)' > package-temp.json && mv package-temp.json package.json",
75-
"start": "npm run build -- --watch"
74+
"preversion": "node ../../scripts/npm/preversion.sh",
75+
"start": "../../scripts/npm/notify-build.sh \"src\" \"../base/package.json\" \"../react-hooks/package.json\" \"../react-valibot/package.json\""
76+
},
77+
"pinDependencies": {},
78+
"localDependencies": {
79+
"@msinternal/botframework-webchat-base": "development",
80+
"@msinternal/botframework-webchat-react-hooks": "development",
81+
"@msinternal/botframework-webchat-react-valibot": "development"
7682
},
7783
"devDependencies": {
7884
"@jridgewell/sourcemap-codec": "^1.5.0",

packages/api-middleware/tsup.config.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@ import { defineConfig } from 'tsup';
22

33
import { applyConfig } from '../../tsup.base.config';
44

5-
// TODO: [P1] Compute this automatically.
6-
const DEPENDENT_PATHS = ['api/src/index.ts'];
7-
85
const commonConfig = applyConfig(config => ({
96
...config,
107
entry: {
118
'botframework-webchat-api-middleware': './src/index.ts',
129
'botframework-webchat-api-middleware.legacy': './src/legacy.ts'
13-
},
14-
onSuccess: `touch ${DEPENDENT_PATHS.map(path => `../${path}`).join(' ')}`
10+
}
1511
}));
1612

1713
export default defineConfig([
1814
{
1915
...commonConfig,
20-
format: 'esm'
16+
format: 'esm',
17+
onSuccess: 'touch ./package.json'
2118
},
2219
{
2320
...commonConfig,

packages/api/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*.tgz
22
/dist/
3-
/dist.tmp/
43
/node_modules/
54
/tsup.config.bundled_*.mjs
65

packages/api/package.json

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@
7575
],
7676
"homepage": "https://github.com/microsoft/BotFramework-WebChat/tree/main/packages/component#readme",
7777
"scripts": {
78-
"build": "npm run build:globalize && npm run build:tsup && npm run build:dtsroll && npm run build:validate",
79-
"build:globalize": "node scripts/createPrecompiledGlobalize.mjs",
80-
"build:tsup": "tsup",
81-
"build:dtsroll": "dtsroll ./dist/*.d.*",
82-
"build:validate": "npm run build:validate:dts",
83-
"build:validate:dts": "if grep -q -P '@msinternal\\/' dist/*.d.* 2>/dev/null; then echo \"Error: dist/*.d.* is not compiled by dtsroll\" >&2; exit 1; fi",
78+
"build": "npm run --if-present build:pre && npm run build:run && npm run --if-present build:post",
79+
"build:post": "npm run build:post:dtsroll && npm run build:post:validate:dts",
80+
"build:post:dtsroll": "dtsroll ./dist/*.d.*",
81+
"build:post:validate:dts": "if grep -q -P '@msinternal\\/' dist/*.d.* 2>/dev/null; then echo \"Error: dist/*.d.* is not compiled by dtsroll\" >&2; exit 1; fi",
82+
"build:pre": "npm run build:pre:local-dependencies && npm run build:pre:watch && npm run build:pre:globalize",
83+
"build:pre:globalize": "node scripts/createPrecompiledGlobalize.mjs",
84+
"build:pre:local-dependencies": "../../scripts/npm/build-local-dependencies.sh",
85+
"build:pre:watch": "../../scripts/npm/build-watch.sh",
86+
"build:run": "tsup",
8487
"bump": "npm run bump:prod && npm run bump:dev && (npm audit fix || exit 0)",
8588
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
8689
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install --save-exact $PACKAGES_TO_BUMP || true",
@@ -90,17 +93,7 @@
9093
"precommit:eslint": "../../node_modules/.bin/eslint --report-unused-disable-directives --max-warnings 0",
9194
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
9295
"preversion": "cat package.json | jq '(.localDependencies // {} | to_entries | map([if .value == \"production\" then \"dependencies\" else \"devDependencies\" end, .key])) as $P | delpaths($P)' > package-temp.json && mv package-temp.json package.json",
93-
"start": "npm run build:tsup -- --watch"
94-
},
95-
"localDependencies": {
96-
"@msinternal/botframework-webchat-api-middleware": "development",
97-
"@msinternal/botframework-webchat-base": "development",
98-
"@msinternal/botframework-webchat-cldr-data": "development",
99-
"@msinternal/botframework-webchat-react-hooks": "development",
100-
"@msinternal/botframework-webchat-react-valibot": "development",
101-
"@msinternal/botframework-webchat-redux-store": "development",
102-
"@msinternal/botframework-webchat-tsconfig": "development",
103-
"botframework-webchat-core": "production"
96+
"start": "../../scripts/npm/notify-build.sh \"src\" \"../api-middleware/package.json\" \"../base/package.json\" \"../support/cldr-data/package.json\" \"../react-hooks/package.json\" \"../react-valibot/package.json\" \"../redux-store/package.json\" \"../tsconfig/package.json\" \"../core/package.json\""
10497
},
10598
"pinDependencies": {
10699
"@types/react": [
@@ -116,6 +109,16 @@
116109
"@typescript-eslint/parser@8.38.0 does not support typescript@5.9.2 yet"
117110
]
118111
},
112+
"localDependencies": {
113+
"@msinternal/botframework-webchat-api-middleware": "development",
114+
"@msinternal/botframework-webchat-base": "development",
115+
"@msinternal/botframework-webchat-cldr-data": "development",
116+
"@msinternal/botframework-webchat-react-hooks": "development",
117+
"@msinternal/botframework-webchat-react-valibot": "development",
118+
"@msinternal/botframework-webchat-redux-store": "development",
119+
"@msinternal/botframework-webchat-tsconfig": "development",
120+
"botframework-webchat-core": "production"
121+
},
119122
"devDependencies": {
120123
"@babel/core": "^7.28.0",
121124
"@babel/preset-env": "^7.28.0",

packages/api/tsup.config.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import { defineConfig } from 'tsup';
22

33
import { applyConfig } from '../../tsup.base.config';
44

5-
// TODO: [P1] Compute this automatically.
6-
const DEPENDENT_PATHS = ['component/src/index.ts'];
7-
85
const commonConfig = applyConfig(config => ({
96
...config,
107
entry: {
@@ -13,8 +10,7 @@ const commonConfig = applyConfig(config => ({
1310
'botframework-webchat-api.hook': './src/boot/hook.ts',
1411
'botframework-webchat-api.internal': './src/boot/internal.ts',
1512
'botframework-webchat-api.middleware': './src/boot/middleware.ts'
16-
},
17-
onSuccess: `touch ${DEPENDENT_PATHS.map(path => `../${path}`).join(' ')}`
13+
}
1814
}));
1915

2016
export default defineConfig([
@@ -25,7 +21,8 @@ export default defineConfig([
2521
'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"'
2622
},
2723
format: 'esm',
28-
noExternal: [...(commonConfig.noExternal ?? []), 'globalize']
24+
noExternal: [...(commonConfig.noExternal ?? []), 'globalize'],
25+
onSuccess: 'touch ./package.json'
2926
},
3027
{
3128
...commonConfig,

packages/base/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*.tgz
22
/dist/
3-
/dist.tmp/
43
/node_modules/
54
/tsup.config.bundled_*.mjs

0 commit comments

Comments
 (0)