Describe the bug
If the prettier key is present in package.json and it specifies a non-existent package, the npx changeset version command cannot create CHANGELOG.md files and fails with an error. The exit code is 0.
> npx changeset version && echo $?
Error: Cannot find module 'some-package'
Require stack:
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/write/dist/changesets-write.cjs.js
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/dist/changesets-cli.cjs.js
- /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/bin.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
at resolve (node:internal/modules/helpers:145:19)
at Object.transform (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js:18425:34)
at run (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8418:53)
at async cacheWrapper (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8294:22)
at async Explorer.search (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8407:24)
at async Promise.all (index 0)
at async writeFormattedMarkdownFile (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:461:76)
at async updateChangelog (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:435:7)
at async Object.applyReleasePlan [as default] (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:351:7) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js',
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/write/dist/changesets-write.cjs.js',
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/dist/changesets-cli.cjs.js',
'/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/bin.js'
]
}
🦋 All files have been updated. Review them and commit at your leisure
0
Expected behavior
Command npx changeset version fails with error, exit code 0
Current behavior
The command npx changeset version does not fail with an error, exit code 0
Reproduction
- Clone repo changesets-prettier-error-repro
- Download dependencies npm ci
- Run command npm run up
Reactions are currently unavailable
Describe the bug
If the prettier key is present in package.json and it specifies a non-existent package, the npx changeset version command cannot create CHANGELOG.md files and fails with an error. The exit code is 0.
> npx changeset version && echo $? Error: Cannot find module 'some-package' Require stack: - /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js - /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/write/dist/changesets-write.cjs.js - /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/dist/changesets-cli.cjs.js - /Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/bin.js at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15) at resolve (node:internal/modules/helpers:145:19) at Object.transform (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js:18425:34) at run (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8418:53) at async cacheWrapper (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8294:22) at async Explorer.search (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/third-party.js:8407:24) at async Promise.all (index 0) at async writeFormattedMarkdownFile (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:461:76) at async updateChangelog (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:435:7) at async Object.applyReleasePlan [as default] (/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/apply-release-plan/dist/changesets-apply-release-plan.cjs.js:351:7) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/prettier/index.js', '/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/write/dist/changesets-write.cjs.js', '/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/dist/changesets-cli.cjs.js', '/Users/seralekhin/Desktop/changesets-prettier-error-repro/node_modules/@changesets/cli/bin.js' ] } 🦋 All files have been updated. Review them and commit at your leisure 0Expected behavior
Command npx changeset version fails with error, exit code 0
Current behavior
The command npx changeset version does not fail with an error, exit code 0
Reproduction