Skip to content

Commit

Permalink
chore: remirror-cli watch shouldn't override package.json files (#1841)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Sep 9, 2022
1 parent 2810643 commit cf39718
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/remirror__cli/src/commands/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function watch(options: { skipBuild?: boolean }) {
ignorePermissionErrors: true,
});
const executor = new DebounceExecutor(async (dir: string) => {
await buildPackage(packageDirMap[dir]);
await buildPackage(packageDirMap[dir], false);
await runTsc();
});

Expand Down
12 changes: 8 additions & 4 deletions packages/remirror__cli/src/utils/build-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import { writePackageJson } from './write-package-json';
/**
* Bundle a package using esbuild and update `package.json` if necessary.
*/
export async function buildPackage(pkg: Package) {
export async function buildPackage(pkg: Package, writePackageJson = true) {
logger.info(`${colors.blue(pkg.packageJson.name)} building...`);

const entryPoints = await parseEntryPoints(pkg);

await writeMainPackageJson(pkg, entryPoints);
if (writePackageJson) {
await writeMainPackageJson(pkg, entryPoints);
}

const promises: Array<Promise<unknown>> = [];

Expand All @@ -46,8 +48,10 @@ export async function buildPackage(pkg: Package) {
}
}

for (const entryPoint of entryPoints.filter((entryPoint) => !entryPoint.isMain)) {
promises.push(writeSubpathPackageJson(pkg, entryPoint));
if (writePackageJson) {
for (const entryPoint of entryPoints.filter((entryPoint) => !entryPoint.isMain)) {
promises.push(writeSubpathPackageJson(pkg, entryPoint));
}
}

await Promise.all(promises);
Expand Down

1 comment on commit cf39718

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.