Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- 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)
- 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)
- 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)
- Fixed `npm start` for efficiency and reliability, in PR [#5621](https://github.com/microsoft/BotFramework-WebChat/pull/5621), by [@compulim](https://github.com/compulim)
- Fixed `npm start` for efficiency and reliability, in PR [#5621](https://github.com/microsoft/BotFramework-WebChat/pull/5621) and [#5629](https://github.com/microsoft/BotFramework-WebChat/pull/5629), by [@compulim](https://github.com/compulim)

### Removed

Expand Down
20 changes: 17 additions & 3 deletions scripts/buildWatch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,32 @@ const {

const root = resolve(rootPackageJSONPath, '../');

const watchPaths = new Set(['./src/']);
const dependingLocalPackages = new Set(Object.keys(currentPackageJSON.localDependencies || {}));
/** @type Map<string, string> */
const localPackageJSONPath = new Map();

for (const [packageName] of Object.entries(currentPackageJSON.localDependencies || {})) {
for (const packageName of Array.from(dependingLocalPackages)) {
for (const workspace of workspaces) {
const packageJSON = await readPackage({ cwd: resolve(root, workspace) });

if (packageJSON.name === packageName) {
watchPaths.add(resolve(root, workspace, 'package.json'));
for (const transientLocalPackageName of Object.keys(packageJSON.localDependencies)) {
dependingLocalPackages.delete(transientLocalPackageName);
}

localPackageJSONPath.set(packageName, resolve(root, workspace, 'package.json'));
}
}
}

const watchPaths = new Set(['./src/']);

// Only includes packages that are absolutely needed to watch.
// For example, "api -> api-graph -> core" and "api -> core". Then we only need to watch "api-graph" but not "core".
for (const packageName of dependingLocalPackages) {
localPackageJSONPath.has(packageName) && watchPaths.add(localPackageJSONPath.get(packageName));
}

// "nodemon" will pick up every file change, trigger build too many times.
// console.log(
// `node --watch ${watchPaths.map(path => `--watch-path "${path}"`).join(' ')} --watch-preserve-output $(which npm) run build:run`
Expand Down
Loading