Skip to content

fix: remove pnpm-specific options before calling npm publish#10077

Merged
zkochan merged 3 commits into
pnpm:mainfrom
ryo-manba:fix/remove-pnpm-options-from-npm-publish
Oct 12, 2025
Merged

fix: remove pnpm-specific options before calling npm publish#10077
zkochan merged 3 commits into
pnpm:mainfrom
ryo-manba:fix/remove-pnpm-options-from-npm-publish

Conversation

@ryo-manba

Copy link
Copy Markdown
Member

Fixes #9646

Fixed warnings when running pnpm publish with pnpm-specific options like --no-git-checks.

@ryo-manba
ryo-manba marked this pull request as ready for review October 12, 2025 07:06
@ryo-manba
ryo-manba requested a review from zkochan as a code owner October 12, 2025 07:06
@ryo-manba ryo-manba changed the title fix(publish): remove pnpm-specific options before calling npm publish fix: remove pnpm-specific options before calling npm publish Oct 12, 2025
@zkochan
zkochan requested a review from Copilot October 12, 2025 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes warnings that occur when running pnpm publish with pnpm-specific CLI options by filtering out options that npm doesn't recognize before passing them to the underlying npm publish command.

  • Replaces inline --publish-branch removal logic with a comprehensive function that handles multiple pnpm-specific options
  • Adds support for filtering additional options like --no-git-checks, --npm-path, and embed-readme related flags
  • Includes comprehensive test coverage for the new filtering functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
releasing/plugin-commands-publishing/src/publish.ts Implements removePnpmSpecificOptions function and replaces inline option filtering
releasing/plugin-commands-publishing/test/removePnpmSpecificOptions.test.ts Adds comprehensive test suite for the new option filtering function
.changeset/fix-git-checks-warning.md Documents the fix for issue #9646

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

// Skip the option itself
i++
// Skip its value if the next arg exists and doesn't look like an option
if (i < args.length && args[i][0] !== '-') {

Copilot AI Oct 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check args[i][0] !== '-' will throw an error if args[i] is an empty string. Add a length check: args[i].length > 0 && args[i][0] !== '-'.

Suggested change
if (i < args.length && args[i][0] !== '-') {
if (i < args.length && args[i].length > 0 && args[i][0] !== '-') {

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +125
const pnpmOnlyOptions = new Set([
'--publish-branch',
'--no-git-checks',
'--npm-path',
'--embed-readme',
'--no-embed-readme',
])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of these are booleans that don't have a value. As a result, something like this will break:

pnpm publish --no-git-checks ./tarball-name.tgz

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread .changeset/fix-git-checks-warning.md
@zkochan
zkochan merged commit 3abd394 into pnpm:main Oct 12, 2025
10 checks passed
@ryo-manba
ryo-manba deleted the fix/remove-pnpm-options-from-npm-publish branch October 13, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown cli config "--git-checks". This will stop working in the next major version of npm.

3 participants