Browse Source

Fix resolution of lerna packages in buildutils

Vidar Tonaas Fauske 5 years ago
parent
commit
ed22b44fb5
1 changed files with 7 additions and 4 deletions
  1. 7 4
      buildutils/src/utils.ts

+ 7 - 4
buildutils/src/utils.ts

@@ -15,10 +15,13 @@ export function getLernaPaths(basePath = '.'): string[] {
   basePath = path.resolve(basePath);
   let baseConfig = require(path.join(basePath, 'package.json'));
   let paths: string[] = [];
-  let packages =
-    baseConfig.workspaces.packages ||
-    baseConfig.workspaces ||
-    baseConfig.packages;
+  let packages;
+  if (baseConfig.workspaces) {
+    packages = baseConfig.workspaces.packages || baseConfig.workspaces;
+  } else {
+    let baseConfig = require(path.join(basePath, 'lerna.json'));
+    packages = baseConfig.packages;
+  }
   for (let config of packages) {
     paths = paths.concat(glob.sync(path.join(basePath, config)));
   }