Skip to content

Commit

Permalink
fix(monorepo): creating packages post-Lerna@7
Browse files Browse the repository at this point in the history
Updates internal monorepo package creator to use `npm install` instead of `lerna bootstrap`.

This fix prevents the following error:
```
node ./bin/create-package.js packages/model
...
ERR! bootstrap The "bootstrap" command was removed by default in v7, and is no longer maintained.
ERR! bootstrap Learn more about this change at https://lerna.js.org/docs/legacy-package-management
 Command aborts (code 1 signal null): npx "lerna" "bootstrap" "--scope" "@loopback/model".
Error: Process 1192 exits with code 1 signal null
    at ChildProcess.<anonymous> (/home/user/Documents/git-repos/loopbackio/loopback-next/bin/create-package.js:61:11)
    at ChildProcess.emit (node:events:519:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)
```

Signed-off-by: Rifa Achrinza <[email protected]>
  • Loading branch information
achrinza committed Aug 4, 2024
1 parent 581bf5a commit 5e4fcba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/create-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
* 4. Run `lb4 copyright` to update `LICENSE` and copyright headers for `*.ts`
* and `*.js`.
*
* 5. Run `lerna bootstrap --scope <full-package-name>` to link its local
* 5. Run `npm install --scope <full-package-name>` to link its local
* dependencies.
*
* 6. Run `update-ts-project-refs` to update TypeScript project references
* (via NPM `postinstall` hook)
*
* 7. Remind to update `CODEOWNERS` and `docs/site/MONOREPO.md`
*/
Expand All @@ -44,7 +45,7 @@
const path = require('node:path');
const fse = require('fs-extra');
const build = require('../packages/build');
const {runMain, updateTsProjectRefs} = require('./script-util');
const {runMain} = require('./script-util');

const cwd = process.cwd();

Expand Down Expand Up @@ -115,7 +116,6 @@ async function createPackage(name) {
await fixupProject(project);
await updateCopyrightAndLicense(project, options);
await bootstrapProject(project);
await updateTsProjectRefs({dryRun: false});

promptActions(project);
}
Expand Down Expand Up @@ -152,8 +152,8 @@ async function bootstrapProject({repoRoot, name}) {
process.chdir(repoRoot);
// Run `npx lerna bootstrap --scope @loopback/<name>`
const shell = build.runShell(
'npx',
['lerna', 'bootstrap', '--scope', `@loopback/${name}`],
'npm',
['install', '--workspace', `@loopback/${name}`],
{
cwd: repoRoot,
},
Expand Down

0 comments on commit 5e4fcba

Please sign in to comment.