diff --git a/src/update-ts-references.js b/src/update-ts-references.js index 661ffcb..9aabaf4 100644 --- a/src/update-ts-references.js +++ b/src/update-ts-references.js @@ -214,6 +214,10 @@ const execute = async ({ const packageJson = require(path.join(cwd, PACKAGE_JSON)); let workspaces = packageJson.workspaces; + if(workspaces && !Array.isArray(workspaces)) { + workspaces = workspaces.packages; + } + if (!workspaces && fs.existsSync(path.join(cwd, 'lerna.json'))) { const lernaJson = require(path.join(cwd, 'lerna.json')); workspaces = lernaJson.packages; @@ -244,10 +248,6 @@ const execute = async ({ ); } - if (!Array.isArray(workspaces)) { - workspaces = workspaces.packages; - } - const packageFilePaths = await getAllPackageJsons(workspaces, cwd); if (verbose) { console.log('packageFilePaths', packageFilePaths);