refactor: migrate from yarn to pnpm - #7
Open
ukeSJTU wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration of package manager: yarn to pnpm
This PR migrates the project from yarn to pnpm as the package manager. pnpm provides faster installation speed, better workspace management, and simplified setup. Developers only need to run
pnpm installonce at the project root instead of installing dependencies in two separate folders as yarn required.This PR should resolve #6
Changes
yarn.lockfiles (3,865 total lines) with singlepnpm-lock.yamlat project rootConfiguration (
.npmrc)Key settings for VS Code extension compatibility:
hoist=true+node-linker=hoisted: Ensures esbuild externals (playwright-core, vscode) are accessible at the expected locationsstrict-peer-dependencies=false: Allows React 19 peer dependency warnings (these are informational; React 19 is compatible with the packages we use)auto-install-peers=true: Automatically installs peer dependencies for convenienceThese settings are necessary for the VS Code extension to build and run correctly with esbuild's external dependencies.
Performance Improvements
Benchmark Results:
Install Speed Breakdown:
Disk Space Distribution:
Note on disk space: The slight increase (+7%) is expected when using
node-linker=hoistedmode, which is required for VS Code extension compatibility. pnpm workspace consolidates shared dependencies at the root level instead of duplicating them across packages. The 33% speed improvement and simplified workflow far outweigh this minimal disk space cost.Additional Benefits
Beyond the performance improvements, pnpm provides:
Simplified Installation
pnpm installcommand at root (no need forcd webview-ui && yarn)Better Dependency Management
Modern Tooling
Improved Maintenance
pnpm --filterfor targeted operationsMigration Guide for Developers
BREAKING CHANGE: This PR fully removes yarn and migrates to pnpm.
Setup Steps:
Install pnpm globally:
Clean up old artifacts (if upgrading from yarn):
Install dependencies:
Verify installation:
Common Commands:
yarn install:allpnpm installcd webview-ui && yarn buildpnpm build:webviewcd webview-ui && yarn startpnpm start:webviewyarn packagepnpm packageyarn check-typespnpm check-typesyarn lintpnpm lintTesting Checklist
pnpm installcompletes without errorspnpm packagebuilds extension successfullypnpm start:webviewruns development serverpnpm check-typespassespnpm lintpassesFiles Modified
Configuration Files (new):
pnpm-workspace.yaml- Workspace configuration.npmrc- pnpm settings for VS Code extension compatibilityConfiguration Files (updated):
package.json- All scripts updated to use pnpmsetup.sh- Updated to use pnpm commandssetup.ps1- Updated to use pnpm commandsREADME.md- Updated installation instructionsLock Files:
yarn.lock,webview-ui/yarn.lockpnpm-lock.yaml(single unified lock file)Rollback Plan
If critical issues are discovered, rollback is possible by:
However, we recommend moving forward with pnpm as the benefits significantly outweigh the minimal migration cost.
Attachments
To avoid polluting the codebase, I'll attach the benchmark script as below: