auto
auto copied to clipboard
[PR available] Lerna `useWorkspaces` has been removed, bump get-monorepo-packages dependency and release
Describe the bug
When using "@lerna-lite/cli": "^3.11.0", with "auto": "^11.3.0", execution fails due to the presence of useWorkspaces in the lerna.json.
Example
lerna ERR! ECONFIGWORKSPACES The "useWorkspaces" option has been removed. By default lerna will resolve your packages using your package manager's workspaces configuration. Alternatively, you can manually provide a list of package globs to be used instead via the "packages" option in lerna.json.
at ChildProcess.<anonymous> (/home/runner/work/graphs/graphs/node_modules/@auto-it/core/src/utils/exec-promise.ts:76:23)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:[4](https://github.com/AMN-DATA/graphs/actions/runs/5255804434/jobs/9496215088#step:15:4)89:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)Error
at Object.execPromise [as default] (/home/runner/work/graphs/graphs/node_modules/@auto-it/core/src/utils/exec-promise.ts:17:20)
at Object.getLernaPackages (/home/runner/work/graphs/graphs/node_modules/@auto-it/core/src/utils/get-lerna-packages.ts:1[5](https://github.com/AMN-DATA/graphs/actions/runs/5255804434/jobs/9496215088#step:15:5):37)
at NPMPlugin.getLernaPackages (/home/runner/work/graphs/graphs/node_modules/@auto-it/npm/src/index.ts:[6](https://github.com/AMN-DATA/graphs/actions/runs/5255804434/jobs/9496215088#step:15:6)18:12)
at NPMPlugin.<anonymous> (/home/runner/work/graphs/graphs/node_modules/typescript-memoize/src/memoize-decorator.ts:123:36)
at /home/runner/work/graphs/graphs/node_modules/@auto-it/npm/src/index.ts:830:46
at eval (eval at create (/home/runner/work/graphs/graphs/node_modules/tapable/lib/HookCodeFactory.js:[7](https://github.com/AMN-DATA/graphs/actions/runs/5255804434/jobs/9496215088#step:15:7)5:10), <anonymous>:32:17)
at new Promise (<anonymous>)
at Hook.eval [as promise] (eval at create (/home/runner/work/graphs/graphs/node_modules/tapable/lib/HookCodeFactory.js:75:10), <anonymous>:6:[8](https://github.com/AMN-DATA/graphs/actions/runs/5255804434/jobs/9496215088#step:15:9))
at Hook.PROMISE_DELEGATE [as _promise] (/home/runner/work/graphs/graphs/node_modules/tapable/lib/Hook.js:22:14)
at /home/runner/work/graphs/graphs/node_modules/@auto-it/core/src/changelog.ts:3[9](https://github.com/AMN-DATA/graphs/actions/runs/5255804434/jobs/9496215088#step:15:10)7:63
Error: Process completed with exit code 1.
But, if you remove useWorkspaces to appease lerna, then we are presented with https://github.com/azz/get-monorepo-packages/issues/11 bug that hasn't been updated to deal with it.
TypeError: Cannot read properties of undefined (reading 'reduce')
at findPackages (/home/runner/work/logger/logger/node_modules/get-monorepo-packages/index.js:17:6)
at Object.getPackages [as default] (/home/runner/work/logger/logger/node_modules/get-monorepo-packages/index.js:37:14)
at getMonorepoPackage (/home/runner/work/logger/logger/node_modules/@auto-it/npm/src/index.ts:157:31)
at getPreviousVersion (/home/runner/work/logger/logger/node_modules/@auto-it/npm/src/index.ts:308:31)
at /home/runner/work/logger/logger/node_modules/@auto-it/npm/src/index.ts:784:7
at eval (eval at create (/home/runner/work/logger/logger/node_modules/tapable/lib/HookCodeFactory.js:75:10), <anonymous>:34:17)
at new Promise (<anonymous>)
at Hook.eval [as promise] (eval at create (/home/runner/work/logger/logger/node_modules/tapable/lib/HookCodeFactory.js:75:10), <anonymous>:6:8)
at Hook.PROMISE_DELEGATE [as _promise] (/home/runner/work/logger/logger/node_modules/tapable/lib/Hook.js:22:14)
at Auto.getCurrentVersion (/home/runner/work/logger/logger/node_modules/@auto-it/core/src/auto.ts:1702:61)
To Reproduce
- Use the latest lerna/auto
- Remove
useWorkspacesfrom thelerna.json - Run
yarn auto shipitExpected behavior
Related package bug: https://github.com/azz/get-monorepo-packages/issues/11
I PR'd the fix to https://github.com/azz/get-monorepo-packages/pull/12
PR was accepted, we just need a bump get-monorepo-packages and a patch release for auto and libraries.
As an alternative you can switch to Lerna-Lite (which I maintain), it still has the useWorkspaces flag and Lerna-Lite is closer to the original Lerna v4 (before Nx) while still adding new features like workspace: protocol (yarn/pnpm) and recently the catalog: protocol (pnpm only). The commands are the same in both Lerna/Lerna-Lite but all commands are optional making the project more modular and much smaller since you only install what you use.
This is just a suggestion Cheers
EDIT
Actually I see that you do reference Lerna-Lite while also referencing Lerna, it's a bit confusing since yes Lerna got rid of the useWorkspaces flag (it auto-detect workspace which has pros and cons, mostly cons from my point of view) but Lerna-Lite still has that flag and is totally unchanged. For example, the error shown above surely comes from Lerna, not from Lerna-Lite:
lerna ERR! ECONFIGWORKSPACES The "useWorkspaces" option has been removed. By default lerna will resolve your packages using your package manager's workspaces configuration. Alternatively, you can manually provide a list of package globs to be used instead via the "packages" option in lerna.json.
@ghiscoding I don't have lerna directly in my stack, only lerna-lite, so perhaps auto or a dep is including it. Regardless, any new install will work since my PR was accepted on the dependency and released as a patch. #2490 PR is available to merge and make sure that the dep is bumped to a working one.
:rocket: Issue was released in v11.3.5 :rocket: