Skip to content

fix: workspace flag parsing in nr command#325

Merged
antfu merged 2 commits intoantfu-collective:mainfrom
buyuan-dev:fix/issue-322
Apr 21, 2026
Merged

fix: workspace flag parsing in nr command#325
antfu merged 2 commits intoantfu-collective:mainfrom
buyuan-dev:fix/issue-322

Conversation

@buyuan-dev
Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where the -w or --workspace flag without = did not work in the nr command for npm.

Problem

nr -w packages/foo test  # Failed with --workspace=true
nr -w=packages/foo test  # Worked

Other commands (ni, nlx, nun, nup, nci, nd) worked correctly with -w packages/foo, only nr had this issue.

Root Cause

The workspace flag value was being parsed as boolean true instead of accepting the next argument as the workspace path.

Fix

Updated the argument parsing in the nr command to match the behavior of other commands by merging -w value into -w=value format before passing to the package manager.

Testing

  • Manual testing with npm workspaces
  • Verified all package managers (npm, pnpm, yarn, bun)

Fixes #322

Fixes antfu-collective#322

The -w/--workspace flag without = was being parsed as boolean true
instead of accepting the next argument as the workspace path.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 21, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@antfu/ni@325

commit: 27b225f

@antfu antfu merged commit 6ec10b4 into antfu-collective:main Apr 21, 2026
4 checks passed
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.

-w or --workspace without = does not work in nr command for npm run

2 participants