fix(core): avoid reading empty .config.json, upgrade cosmiconfig@v9.0.0#4062
fix(core): avoid reading empty .config.json, upgrade cosmiconfig@v9.0.0#4062JamesHenry merged 1 commit intolerna:mainfrom petermetz:fix-core-avoid-reading-empty-dot-config-json
Conversation
The newer version of cosmicconfig does not suffer from the issue that it defaults to looking for .config.json the way 8.x does. This upgrade implicitly fixes the underlying issue that lerna has for the same reason. Fixes #4061 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
☁️ Nx Cloud ReportCI is running/has finished running commands for commit ce96ad4. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 8 targets
Sent with 💌 from NxCloud. |
|
@petermetz Thanks for this! I can't reproduce an issue, it seems to be specific to your environment. What does |
|
I made sure everything was all good on latest main here: #4071 So I am good to merge this in the meantime, thanks again! |
|
@JamesHenry Thank you very much for the review!
Nothing - I set these parameters on a per-repo basis only. Now, with that said, if I run them without the |
The credit should go to @ghiscoding - I'm just back-porting his fix to the same bug in lerna-lite to lerna here.
Description
The newer version of cosmicconfig does not suffer from the issue that
it defaults to looking for .config.json the way 8.x does.
This upgrade implicitly fixes the underlying issue that lerna has for the
same reason.
Motivation and Context
Fixes #4061
lerna-lite used to have the same bug, you can read the full context here:
.configcosmiconfig/cosmiconfig#313How Has This Been Tested?
npm test && npm run integrationThe tests all passed, but for the integratin tests 2 of them failed with the logs pasted below. They were failing the same way on
mainprior to my changes so I'm assuming this to be a false positive but you tell me.Summary of all failing tests FAIL __tests__/lerna-publish-validation.spec.ts ● lerna publish exits with EBEHIND when behind upstream remote Command failed with exit code 128: git commit -m upstream change Author identity unknown *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <peter@C11-73JFIMZA8J6.dir.svc.accenture.com>) not allowed 26 | await fs.outputFile(path.join(cloneDir, "README.md"), "upstream change"); 27 | await gitAdd(cloneDir, "-A"); > 28 | await gitCommit(cloneDir, "upstream change"); | ^ 29 | await execa("git", ["push", "origin", "main"], { cwd: cloneDir }); 30 | 31 | // throws during interactive publish (local) at makeError (../node_modules/execa/lib/error.js:59:11) at handlePromise (../node_modules/execa/index.js:114:26) at Object.<anonymous> (__tests__/lerna-publish-validation.spec.ts:28:3) FAIL __tests__/lerna-bootstrap-yarn.spec.ts ● lerna bootstrap --npm-client yarn Command failed with exit code 1: node /home/peter/a/lerna/packages/lerna/dist/cli.js bootstrap --npm-client yarn lerna notice cli v8.1.8 lerna info ci enabled lerna info Bootstrapping 4 packages lerna info lifecycle package-4@1.0.0~preinstall: package-4@1.0.0 lerna info Installing external dependencies lerna ERR! yarn install --mutex network:42424 --non-interactive exited 1 in '@integration/package-2' lerna ERR! yarn install --mutex network:42424 --non-interactive stdout: Unknown Syntax Error: Unsupported option name ("--mutex"). $ yarn install [--json] [--immutable] [--immutable-cache] [--refresh-lockfile] [--check-cache] [--check-resolutions] [--inline-builds] [--mode #0] lerna ERR! yarn install --mutex network:42424 --non-interactive exited 1 in '@integration/package-2' lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately. > package-4@1.0.0 preinstall /tmp/dd16a3ecb8e9a0c03b35291c2f37dd47/package-4 > exit 0 9 | const lerna = cliRunner(cwd); 10 | > 11 | const { stderr } = await lerna("bootstrap", "--npm-client", "yarn"); | ^ 12 | expect(stderr).toMatchInlineSnapshot(` 13 | lerna notice cli __TEST_VERSION__ 14 | lerna info ci enabled at makeError (../node_modules/execa/lib/error.js:59:11) at handlePromise (../node_modules/execa/index.js:114:26) at Object.<anonymous> (__tests__/lerna-bootstrap-yarn.spec.ts:11:22) Test Suites: 2 failed, 31 passed, 33 total Tests: 2 failed, 83 passed, 85 total Snapshots: 93 passed, 93 total Time: 68.037 s, estimated 83 s Ran all test suites. —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— NX Ran target integration for project integration and 6 task(s) they depend on (1m) With additional flags: --maxWorkers=2 ✖ 1/7 failed ✔ 6/7 succeeded [4 read from cache] View structured, searchable error logs at https://nx.app/runs/8xAbKEIHdjTypes of changes
Checklist: