Skip to content

fix: strip -y flag from npm init before PM conversion#7693

Open
AmanVarshney01 wants to merge 2 commits intomainfrom
fix/remove-init-y-flag
Open

fix: strip -y flag from npm init before PM conversion#7693
AmanVarshney01 wants to merge 2 commits intomainfrom
fix/remove-init-y-flag

Conversation

@AmanVarshney01
Copy link
Copy Markdown
Member

@AmanVarshney01 AmanVarshney01 commented Mar 23, 2026

Summary

  • npm-to-yarn converts npm init -y to pnpm init -y and bun init -y, but neither pnpm nor bun support the -y flag for init (they're always non-interactive)
  • Strips -y from npm init -y before passing to convert() in all three source.config.ts files (docs, blog, eclipse)
  • This ensures all package managers get a clean init command

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency in package manager command conversions by normalizing npm init -y to npm init across npm, pnpm, yarn, and bun, ensuring more predictable behavior when converting between different package managers.

npm-to-yarn converts `npm init -y` to `pnpm init -y` and `bun init -y`,
but neither pnpm nor bun support the -y flag for init (they're always
non-interactive). Strip -y before conversion so all package managers
get a clean `init` command.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Mar 25, 2026 1:11pm
docs Ready Ready Preview, Comment Mar 25, 2026 1:11pm
eclipse Ready Ready Preview, Comment Mar 25, 2026 1:11pm
site Ready Ready Preview, Comment Mar 25, 2026 1:11pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Walkthrough

Three application configuration files are updated to normalize the npm init -y command to npm init before processing through their respective package manager conversion pipelines, affecting how npm initialization commands are transformed across multiple package managers.

Changes

Cohort / File(s) Summary
npm init command normalization
apps/blog/source.config.ts, apps/docs/source.config.ts, apps/eclipse/source.config.ts
Each file normalizes the npm initialization command by replacing npm init -y with npm init prior to package manager conversion. Blog and Eclipse preprocess in package manager config; Docs preprocesses in convertLine utility before npm-to-yarn invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: strip -y flag from npm init before PM conversion' clearly and specifically summarizes the main change: removing the -y flag from npm init commands before package manager conversion.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/eclipse/source.config.ts (1)

49-61: Optional: Extract shared utility across apps.

All three configs (docs, blog, eclipse) now contain nearly identical packageManagers logic with the -y normalization. If you find yourself updating this pattern again, consider extracting a shared utility (e.g., in a common package or shared config file) that all three apps import. This would make future fixes a single-point change.

Not blocking—just something to consider for long-term maintainability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/eclipse/source.config.ts` around lines 49 - 61, The three configs
duplicate the packageManagers logic (the array using convert and the npm init -y
normalization); extract this into a shared utility (e.g., export a function like
getNormalizedPackageManagers or normalizePackageManagers that returns the array)
and replace the inline packageManagers in each config (docs, blog, eclipse) with
a call/import of that utility; ensure the utility preserves the bun special-case
transformation (the replace(/^bun x /, 'bunx --bun ')) and keeps references to
convert so behaviour remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/blog/source.config.ts`:
- Around line 70-75: The current command normalizer uses cmd.replace(/^npm init
-y$/, "npm init") inside the command lambdas (refer to the command properties
that call convert and the convert(...) call), which only matches single-line
exact strings and will miss multi-line code blocks; update the logic to split
the incoming cmd on '\n', run the replacement on each line (or reuse/implement a
convertLine helper like in docs), then rejoin with '\n' before passing to
convert so multi-line commands such as "npm init -y\nnpm install ..." are
normalized correctly.

In `@apps/eclipse/source.config.ts`:
- Around line 50-55: The command arrow functions currently use an anchored regex
replace (cmd.replace(/^npm init -y$/, 'npm init')) which fails if cmd contains
newlines; update these entries (the anonymous command functions that call
convert and the const converted for 'bun') to use the existing convertLine
helper (or equivalent line-by-line processing) instead of the anchored regex so
each line is normalised before calling convert (apply the change to the 'npm',
'pnpm', 'yarn' and 'bun' command handlers and ensure convertLine is
imported/available).

---

Nitpick comments:
In `@apps/eclipse/source.config.ts`:
- Around line 49-61: The three configs duplicate the packageManagers logic (the
array using convert and the npm init -y normalization); extract this into a
shared utility (e.g., export a function like getNormalizedPackageManagers or
normalizePackageManagers that returns the array) and replace the inline
packageManagers in each config (docs, blog, eclipse) with a call/import of that
utility; ensure the utility preserves the bun special-case transformation (the
replace(/^bun x /, 'bunx --bun ')) and keeps references to convert so behaviour
remains identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5916d395-b3d0-4baf-b6e1-a9f59e805bca

📥 Commits

Reviewing files that changed from the base of the PR and between 52d993a and 70073ca.

📒 Files selected for processing (3)
  • apps/blog/source.config.ts
  • apps/docs/source.config.ts
  • apps/eclipse/source.config.ts

@argos-ci
Copy link
Copy Markdown

argos-ci bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 1 changed Mar 25, 2026, 1:18 PM

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.

1 participant