Skip to content

Commit ec37f2f

Browse files
committed
fix: use lerna project to collect packages
1 parent 5cddff1 commit ec37f2f

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

bin/update-template-deps.js

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,13 @@
1313
const path = require('path');
1414
const fs = require('fs');
1515

16-
const Command = require('@lerna/command');
17-
18-
/**
19-
* A dummy command to get filtered packages
20-
*/
21-
class NopCommand extends Command {
22-
get requiresGit() {
23-
return false;
24-
}
25-
26-
initialize() {
27-
// No-op
28-
}
29-
30-
execute() {
31-
// No-op
32-
}
33-
}
16+
const Project = require('@lerna/project');
3417

3518
async function updateTemplateDeps() {
36-
const cmd = new NopCommand({_: [], loglevel: 'silent'});
37-
38-
await cmd; // Execute the command
19+
const project = new Project(process.cwd());
20+
const packages = await project.getPackages();
3921

40-
const pkgs = cmd.filteredPackages.filter(pkg => !pkg.private).map(pkg => ({
22+
const pkgs = packages.filter(pkg => !pkg.private).map(pkg => ({
4123
name: pkg.name,
4224
version: pkg.version,
4325
}));
@@ -47,7 +29,7 @@ async function updateTemplateDeps() {
4729
lbModules[p.name] = '^' + p.version;
4830
}
4931

50-
const rootPath = cmd.project.rootPath;
32+
const rootPath = project.rootPath;
5133

5234
// Load dependencies from `packages/build/package.json`
5335
const buildDeps = require(path.join(rootPath, 'packages/build/package.json'))

0 commit comments

Comments
 (0)