Repository navigation
build: switch from Yarn 1 to npm - #1196
Conversation
|
| Status | Scan Engine | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details | |
| Licenses | 0 | 0 | 0 | 0 | See details |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
|
🤖 I built a VSIX from this branch locally (clean
The extra |
|
🤖 About the red A
The new projects start with no history, so the first scans may show existing issues as new (see the 16 |
Generate package-lock.json from yarn.lock (npm seeds its resolution from it), so every package keeps the version Yarn had resolved. Delete yarn.lock and apps/vscode/.yarnrc (vsce 4 runs prepublish with yarn when it finds it), set packageManager to npm, and record which dependency install scripts may run (allowScripts). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
979eea8 to
28b34ee
Compare
|
I checked out this branch and did a brief manual tests in Vscode and Positron: I did |
vezwork
left a comment
There was a problem hiding this comment.
Awesome! This final step of migrating from yarn to npm should unblock our package management issues!!
|
Thanks very much @nealrichardson |
|
@juliasilge take a glance please, this migrates the monorepo from yarn to npm! Chill right? |
juliasilge
left a comment
There was a problem hiding this comment.
Yes, I pulled this down and was able to clean out all the old build-y stuff, and then make a new dev build! Super exciting! 🎉
Replaces Yarn 1 with npm workspaces. Supersedes #970, which went stale.
Changes
yarn.lock→package-lock.json. The lockfile was generated by runningnpm installwithyarn.lockstill present, so npm resolved every package to the version Yarn had locked. A script comparing the two lockfiles finds no version differences. The only additions are the platform-specific optional binaries (esbuild, rolldown, turbo, lightningcss, …), which npm records for every platform. That avoids the [BUG] Platform-specific optional dependencies not being included inpackage-lock.jsonwhen reinstalling withnode_modulespresent npm/cli#4828 problem of a lockfile that only works on the platform it was generated on. Nooverridesare needed (there were noresolutionsleft), and the workspace deps ("core": "*"etc.) all link to the local workspaces.package.json:packageManagerisnpm@11.19.0, the npm that ships with Node 24.21. Turbo needs this field to detect the package manager, and with Corepack enabled it makesyarnrefuse to run in the repo.allowScripts: npm 11.19 warns about dependency install scripts that aren't reviewed, and a later npm will block them by default. Approved:esbuild(puts the native binary in place) and@vscode/vsce-sign(copies its platform binary, needed forvsce). Denied:keytar(only forvsce logincredential storage; CI uses tokens),@parcel/watcherandfsevents(both ship prebuilt binaries; the scripts only build from source), andcore-js-pure(a funding banner). The entries are name-only rather than version-pinned, so Dependabot bumps don't drop the approvals.npm run test-vscode -- --label main --grep pattern.apps/vscode/.yarnrc(and its.vscodeignoreline). vsce 4 runsvscode:prepublishwith yarn when it finds that file. Its--ignore-enginesisn't needed: npm doesn't enforceenginesby default.yarn run build dev→npm run build -- devetc. inapps/lspandapps/vscode.yarn install --frozen-lockfile→npm ci, andyarn <script>→npm run <script>.yarn --silent vsce/ovsx …→npx --no vsce/ovsx …, which still uses the repo's pinned versions and fails rather than downloading if they're missing.apps/vscode/.vscode/tasks.json,launch.json): theyarn: dev-vscodeandyarn: build-testtasks are nownpm: ….apps/vscode/CONTRIBUTING.md,claude.md, and the "update snapshots" comments in the tests.Verification
On Node 24.21 / npm 11.19, from a clean
node_modules:npm ci: lockfile unchanged;npm ls --allexits 0.npm run build -- --force: 9/9 tasks.npm run test-packages: 13/13 tasks.npm run lint -- --continue: 17/17 tasks, 0 errors, 17 warnings, the same as onmain.npx --no vsce packageinapps/vscode: runsnpm run vscode:prepublish, and packages 175 files.npm run test-vscode -- --help: the arguments reachvscode-test.test-vscodeandtest-positronweren't run locally (they open GUI windows); CI runs them.Snyk
The two Snyk checks error on 3 of 30 tests. #1195 passed them, so it's this switch, most likely Snyk projects that were imported from
yarn.lock. Someone with access to the Snyk org needs to re-import the repo, or point those projects atpackage-lock.json.Rebasing
package-lock.jsonwas regenerated after rebasing onto #1195 (React 19). Any other change toyarn.lockonmainbefore this merges needs the same treatment: restoremain'syarn.lock, deletepackage-lock.jsonandnode_modules, runnpm install, deleteyarn.lock, and recheck the version comparison. Open PRs that touchyarn.lockwill need to port their changes topackage-lock.jsonafter this merges.Follow-ups
npm auditreports 16 advisories (ajv, braces, diff, katex, serialize-javascript, source-map-js, …). They're the same package versions as onmain, just reported by a different tool than Snyk. They should be handled separately.🤖 Generated with Claude Code