Skip to content

Warn when release-it's built-in npm plugin is left enabled - #145

Merged
rwjblue-glean merged 2 commits into
deps/vitest-4-migrationfrom
fix/npm-false-config
Jun 18, 2026
Merged

Warn when release-it's built-in npm plugin is left enabled#145
rwjblue-glean merged 2 commits into
deps/vitest-4-migrationfrom
fix/npm-false-config

Conversation

@scalvert

Copy link
Copy Markdown
Collaborator

Closes #125
Closes #132

This plugin fully replaces release-it's built-in npm plugin. If the built-in plugin is left enabled, release-it also runs npm version and tries to publish the root package, producing confusing errors.

Changes

Note

Stacked on #126's replacement (the vitest 4 branch) because the new tests are authored against the vitest 4 harness. Base will auto-retarget to master once that merges.

npm test green: lint + 43/43.

🤖 Generated with Claude Code

@scalvert
scalvert requested a review from rwjblue June 17, 2026 23:41
@scalvert scalvert added the enhancement New feature or request label Jun 18, 2026
@scalvert
scalvert force-pushed the deps/vitest-4-migration branch from a314349 to e5eb7ff Compare June 18, 2026 02:11
scalvert and others added 2 commits June 17, 2026 19:11
This plugin fully replaces release-it's built-in `npm` plugin, but if the
built-in plugin is left enabled release-it also runs `npm version` and tries
to publish the root package, producing confusing errors. Detect this in the
constructor and emit a clear warning telling users to set `npm: false`
(`npm: { publish: false }` is not sufficient). Also document the correct
configuration and the TypeScript `Config` type gotcha in the README.

Closes #125
Closes #132

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The warning was emitted from the constructor and the test read it via
`log.warn.mock.calls`. release-it 19's test factory pre-wraps the logger as a
spy so `.mock` exists, but release-it 17/18 do not, so the tests threw
`Cannot read properties of undefined (reading 'calls')` on those versions.

Move the check to the top of `init()` (before the `skipChecks` guard) so it
still fires on every release but after the test harness can install a log
capture. The harness now overrides `log.warn` into a plain `warnings` array
(version-independent), and the three tests drive `init()` with `skipChecks`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@scalvert
scalvert force-pushed the fix/npm-false-config branch from ae76b6d to 558dd19 Compare June 18, 2026 02:12
@rwjblue-glean
rwjblue-glean merged commit baeaa26 into deps/vitest-4-migration Jun 18, 2026
6 checks passed
@rwjblue-glean
rwjblue-glean deleted the fix/npm-false-config branch June 18, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants