Skip to content

yarn2npm#908

Draft
haslinghuis wants to merge 8 commits intobetaflight:masterfrom
haslinghuis:yarn2npm
Draft

yarn2npm#908
haslinghuis wants to merge 8 commits intobetaflight:masterfrom
haslinghuis:yarn2npm

Conversation

@haslinghuis
Copy link
Copy Markdown
Member

@haslinghuis haslinghuis commented May 3, 2026

Yarn to NPM Migration Plan

Current State

Item Value
Lockfile yarn.lock (4258 lines)
Node 24.x (.nvmrc)
Lockfile format Yarn v1
.yarnrc files None
package-lock.json None

Key Challenges

1. GitHub URL dependency

"Leaflet.MultiOptionsPolyline": "hgoebl/Leaflet.MultiOptionsPolyline" — yarn v1 shorthand. npm requires git+https://github.com/hgoebl/Leaflet.MultiOptionsPolyline.git.

2. resolutions field

Yarn-specific — replaced with npm overrides.

3. vite-plugin-pwa peer dep conflict

vite-plugin-pwa@0.19.x only supports vite 3-5. Bumped to ^0.21.2 which supports vite 6.

4. Git lockfile SSH URLs

npm writes git+ssh://git@github.com/... for git dependencies in the lockfile regardless of git config. Requires sed rewrite in CI.

5. CI/CD (build.yml)

Converted from yarn to npm ci + setup-node npm caching.

6. Documentation (README.md)

All yarn refs → npm, including added npm install step before npm start.

Migration Steps

# Status Change
1 Done Convert GitHub URL: git+https://github.com/hgoebl/Leaflet.MultiOptionsPolyline.git
2 Done Remove yarn from devDependencies
3 Done Replace resolutions with global overrides: "lodash.template": "^4.5.0"
4 Done Bump vite-plugin-pwa from ^0.19.7^0.21.2 (vite 6 support)
5 Done Generated package-lock.json (lockfileVersion 3)
6 Done Deleted yarn.lock
7 Done .github/workflows/build.yml: npm ci, npm cache via setup-node, sed for SSH→HTTPS
8 Done .gitignore: removed yarn log patterns
9 Done README.md: npm commands + added npm install step

Files Modified

File Change
package.json GitHub URL, overrides, vite-plugin-pwa bump, yarn devDep removed
yarn.lock Deleted
package-lock.json Generated (253KB) — all URLs git+https://
.github/workflows/build.yml npm ci, npm cache, sed step, setup-node cache
.gitignore Removed yarn log patterns
README.md npm commands + npm install before npm start

Verification

  • npm install succeeds
  • npm run build succeeds
  • No SSH URLs in package-lock.json
  • CI updated with sed rewrite step before npm ci

Summary by CodeRabbit

  • Chores

    • Switched project build and install workflow from Yarn to npm, including CI caching changes to use npm's cache.
    • Updated dependency sourcing and package management config (including lockfile/override adjustments).
    • Removed Yarn-specific log patterns from ignore rules.
  • Documentation

    • Updated development and local run instructions to use npm commands.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Warning

Rate limit exceeded

@haslinghuis has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 33 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 32563bfc-ba71-45d8-bcbb-df3889119d34

📥 Commits

Reviewing files that changed from the base of the PR and between beb1dbd and 3441bb6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • .github/workflows/build.yml
  • package.json

Walkthrough

The PR migrates the project from Yarn to npm: CI and build steps now use npm ci and npm run build; package.json and .gitignore were adjusted for npm usage; README development instructions were updated to npm commands; a dependency URL and overrides were added in package.json.

Changes

Yarn → npm migration

Layer / File(s) Summary
Dependency metadata
package.json
Leaflet.MultiOptionsPolyline ref changed to git+https://github.com/hgoebl/Leaflet.MultiOptionsPolyline.git; yarn removed from devDependencies; resolutions replaced with top-level overrides pinning lodash.template to ^4.5.0.
CI Build / Caching
.github/workflows/build.yml
Replaced Yarn steps with npm ci and npm run build; enabled actions/setup-node npm cache using cache: npm and cache-dependency-path: package-lock.json; removed separate Yarn/node_modules cache and global yarn install.
Git ignore
.gitignore
Removed Yarn-specific ignores yarn-debug.log* and yarn-error.log* (retains npm-debug.log*).
Docs / Local dev
README.md
"Developing" section updated to add npm subsection and replace yarn start/yarn build/yarn preview with npm start/npm run build/npm run preview.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'yarn2npm' is a concise abbreviation that directly reflects the core objective of migrating from Yarn to npm, which is accurately represented in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request provides a comprehensive, well-structured description with migration plan, challenges, step-by-step changes, file modifications, and verification checklist. The description is specific, detailed, and clearly explains the Yarn to npm migration.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 15 minutes and 33 seconds.

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

Copy link
Copy Markdown

@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)
.github/workflows/build.yml (1)

28-39: node_modules cache is inefficient with npm ci.

Caching node_modules (Lines 28–33) adds overhead without meaningful benefit. npm ci works efficiently with npm's built-in cache rather than a cached node_modules directory. The actions/setup-node action with the cache: 'npm' option is the recommended approach for GitHub Actions workflows.

Suggested refactor
-      - name: Cache node_modules
-        uses: actions/cache@v4
-        with:
-          path: node_modules/
-          key: node_modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

       - name: Install node.js
         uses: actions/setup-node@v5
         with:
           node-version-file: '.nvmrc'
+          cache: 'npm'
+          cache-dependency-path: 'package-lock.json'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build.yml around lines 28 - 39, Remove the "Cache
node_modules" step and instead enable npm caching via the setup action: modify
the "Install node.js" step (uses: actions/setup-node@v5) to include the cache:
'npm' option so npm's cache is used with the subsequent "run: npm ci" step;
ensure the explicit node-version-file: '.nvmrc' remains and delete the
standalone "Cache node_modules" step and its key/path entries to avoid caching
node_modules directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 42-45: The nested override under "overrides" that sets "lodash": {
"lodash.template": "^4.5.0" } is ineffective because lodash@4.18.1 has no
transitive dependency on "lodash.template"; either remove this nested override
entry entirely from the "overrides" object or change it to a global override
targeting "lodash.template": "^4.5.0" at the top level of "overrides" so the pin
applies across the dependency tree; update the "overrides" block accordingly and
ensure only the intended key ("lodash.template") is present if you need to
enforce that version globally.

In `@README.md`:
- Around line 91-95: The README currently instructs users to run only `npm
start`; update the startup instructions to include a dependency installation
step (e.g., `npm ci` or `npm install`) immediately before the `npm start`
command so fresh clones won't fail; edit the section containing the `npm start`
example to add the chosen install command and a brief note that this is required
for first-time setup.

---

Nitpick comments:
In @.github/workflows/build.yml:
- Around line 28-39: Remove the "Cache node_modules" step and instead enable npm
caching via the setup action: modify the "Install node.js" step (uses:
actions/setup-node@v5) to include the cache: 'npm' option so npm's cache is used
with the subsequent "run: npm ci" step; ensure the explicit node-version-file:
'.nvmrc' remains and delete the standalone "Cache node_modules" step and its
key/path entries to avoid caching node_modules directly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bb92fcd3-8591-4997-a944-6e0ba480bebc

📥 Commits

Reviewing files that changed from the base of the PR and between 67ab12c and 77fa8e6.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/build.yml
  • .gitignore
  • README.md
  • package.json
💤 Files with no reviewable changes (1)
  • .gitignore

Comment thread package.json Outdated
Comment thread README.md Outdated
@haslinghuis
Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Full review triggered.

@haslinghuis
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@haslinghuis
Copy link
Copy Markdown
Member Author

@coderabbitai approve

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 3, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Comments resolved and changes approved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 migrates the project’s developer workflow and CI pipeline from Yarn to npm so the repository can use package-lock.json and npm-native install/build commands across local development and GitHub Actions.

Changes:

  • Replaces Yarn-specific package management settings in package.json with npm-compatible equivalents.
  • Updates the build workflow to install dependencies and build with npm instead of Yarn.
  • Revises developer documentation and cleanup files to remove Yarn-specific references.

Reviewed changes

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

File Description
package.json Switches the GitHub dependency URL to npm-compatible syntax, removes the Yarn dev dependency, and replaces resolutions with overrides.
README.md Updates local setup and build instructions from Yarn commands to npm commands.
.gitignore Removes Yarn-specific log ignore entries as part of the package-manager migration.
.github/workflows/build.yml Replaces Yarn installation/build steps with npm ci and npm run build, and enables npm cache support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build.yml
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 3, 2026
@haslinghuis
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@haslinghuis
Copy link
Copy Markdown
Member Author

@coderabbitai approve

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 3, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Comments resolved and changes approved.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Preview URL: https://pr908.betaflight-blackbox.pages.dev

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 3, 2026

@haslinghuis haslinghuis marked this pull request as draft May 3, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants