From 651f73ead6211b61dbe22b8d99f8162c4d9ee4ab Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Wed, 22 Aug 2018 09:34:29 -0700 Subject: [PATCH] fix: use lerna project to collect packages --- bin/update-template-deps.js | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/bin/update-template-deps.js b/bin/update-template-deps.js index 6dd5dac3f2eb..c7c9cf907716 100755 --- a/bin/update-template-deps.js +++ b/bin/update-template-deps.js @@ -13,31 +13,13 @@ const path = require('path'); const fs = require('fs'); -const Command = require('@lerna/command'); - -/** - * A dummy command to get filtered packages - */ -class NopCommand extends Command { - get requiresGit() { - return false; - } - - initialize() { - // No-op - } - - execute() { - // No-op - } -} +const Project = require('@lerna/project'); async function updateTemplateDeps() { - const cmd = new NopCommand({_: [], loglevel: 'silent'}); - - await cmd; // Execute the command + const project = new Project(process.cwd()); + const packages = await project.getPackages(); - const pkgs = cmd.filteredPackages.filter(pkg => !pkg.private).map(pkg => ({ + const pkgs = packages.filter(pkg => !pkg.private).map(pkg => ({ name: pkg.name, version: pkg.version, })); @@ -47,7 +29,7 @@ async function updateTemplateDeps() { lbModules[p.name] = '^' + p.version; } - const rootPath = cmd.project.rootPath; + const rootPath = project.rootPath; // Load dependencies from `packages/build/package.json` const buildDeps = require(path.join(rootPath, 'packages/build/package.json'))