Skip to content

Commit 0c0946b

Browse files
committed
Replace legacy yarn with pnpm
1 parent a177c3c commit 0c0946b

File tree

13 files changed

+6930
-5829
lines changed

13 files changed

+6930
-5829
lines changed

.github/workflows/ci.yaml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v6
1919

20+
- uses: pnpm/action-setup@v4
21+
2022
- uses: actions/setup-node@v6
2123
with:
2224
node-version: "22"
23-
cache: "yarn"
25+
cache: "pnpm"
2426

25-
- run: yarn
27+
- run: pnpm install
2628

27-
- run: yarn prettier --check .
29+
- run: pnpm prettier --check .
2830

29-
- run: yarn lint
31+
- run: pnpm lint
3032

31-
- run: yarn build
33+
- run: pnpm build
3234

3335
test-unit:
3436
name: Unit Test (Electron ${{ matrix.electron-version }})
@@ -42,12 +44,14 @@ jobs:
4244
steps:
4345
- uses: actions/checkout@v6
4446

47+
- uses: pnpm/action-setup@v4
48+
4549
- uses: actions/setup-node@v6
4650
with:
4751
node-version: "22"
48-
cache: "yarn"
52+
cache: "pnpm"
4953

50-
- run: yarn
54+
- run: pnpm install
5155

5256
- name: Run tests with Electron ${{ matrix.electron-version }}
5357
run: ./scripts/test-electron.sh ${{ matrix.electron-version }}
@@ -65,17 +69,19 @@ jobs:
6569
steps:
6670
- uses: actions/checkout@v6
6771

72+
- uses: pnpm/action-setup@v4
73+
6874
- uses: actions/setup-node@v6
6975
with:
7076
node-version: "22"
71-
cache: "yarn"
77+
cache: "pnpm"
7278

73-
- run: yarn
79+
- run: pnpm install
7480

75-
- run: yarn build
81+
- run: pnpm build
7682

7783
- name: Run integration tests on VS Code ${{ matrix.vscode-version }}
78-
run: xvfb-run -a yarn test:integration --label "VS Code ${{ matrix.vscode-version }}"
84+
run: xvfb-run -a pnpm test:integration --label "VS Code ${{ matrix.vscode-version }}"
7985

8086
package:
8187
name: Package
@@ -84,15 +90,15 @@ jobs:
8490
steps:
8591
- uses: actions/checkout@v6
8692

93+
- uses: pnpm/action-setup@v4
94+
8795
- uses: actions/setup-node@v6
8896
with:
8997
node-version: "22"
90-
cache: "yarn"
98+
cache: "pnpm"
9199

92100
- name: Install dependencies
93-
run: |
94-
yarn
95-
npm install -g @vscode/vsce
101+
run: pnpm install
96102

97103
- name: Get version from package.json
98104
id: version
@@ -111,7 +117,7 @@ jobs:
111117
echo "packageName=$PACKAGE_NAME" >> $GITHUB_OUTPUT
112118
113119
- name: Package extension
114-
run: vsce package --out "${{ steps.setup.outputs.packageName }}"
120+
run: pnpm vsce package --no-dependencies --out "${{ steps.setup.outputs.packageName }}"
115121

116122
- name: Upload artifact (PR)
117123
if: github.event_name == 'pull_request'

.github/workflows/pre-release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v6
2020

21+
- uses: pnpm/action-setup@v4
22+
2123
- uses: actions/setup-node@v6
2224
with:
2325
node-version: "22"
26+
cache: "pnpm"
2427

2528
- name: Extract version from tag
2629
id: version
@@ -45,9 +48,7 @@ jobs:
4548
echo "Version validation successful: $TAG_VERSION"
4649
4750
- name: Install dependencies
48-
run: |
49-
yarn
50-
npm install -g @vscode/vsce
51+
run: pnpm install
5152

5253
- name: Setup package path
5354
id: setup
@@ -57,7 +58,7 @@ jobs:
5758
echo "packageName=$PACKAGE_NAME" >> $GITHUB_OUTPUT
5859
5960
- name: Package extension
60-
run: vsce package --pre-release --out "${{ steps.setup.outputs.packageName }}"
61+
run: pnpm vsce package --no-dependencies --pre-release --out "${{ steps.setup.outputs.packageName }}"
6162

6263
- name: Upload artifact
6364
uses: actions/upload-artifact@v6

.github/workflows/release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v6
2121

22+
- uses: pnpm/action-setup@v4
23+
2224
- uses: actions/setup-node@v6
2325
with:
2426
node-version: "22"
27+
cache: "pnpm"
2528

2629
- name: Extract version from tag
2730
id: version
@@ -45,9 +48,7 @@ jobs:
4548
echo "Version validation successful: $TAG_VERSION"
4649
4750
- name: Install dependencies
48-
run: |
49-
yarn
50-
npm install -g @vscode/vsce
51+
run: pnpm install
5152

5253
- name: Setup package path
5354
id: setup
@@ -57,7 +58,7 @@ jobs:
5758
echo "packageName=$PACKAGE_NAME" >> $GITHUB_OUTPUT
5859
5960
- name: Package extension
60-
run: vsce package --out "${{ steps.setup.outputs.packageName }}"
61+
run: pnpm vsce package --no-dependencies --out "${{ steps.setup.outputs.packageName }}"
6162

6263
- name: Upload artifact
6364
uses: actions/upload-artifact@v6

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
/.nyc_output/
66
/coverage/
77
*.vsix
8-
yarn-error.log
8+
pnpm-debug.log
99
.eslintcache

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/coverage/
77
*.vsix
88
flake.lock
9-
yarn-error.log
9+
pnpm-debug.log
10+
pnpm-lock.yaml

.vscodeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ esbuild.mjs
2424
**/.git-blame-ignore-revs
2525

2626
# Package manager files
27-
yarn.lock
27+
pnpm-lock.yaml
28+
pnpm-workspace.yaml
2829

2930
# Nix/flake files
3031
flake.nix

CLAUDE.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ Comments explain what code does or why it exists:
4646

4747
## Build and Test Commands
4848

49-
- Build: `yarn build`
50-
- Watch mode: `yarn watch`
51-
- Package: `yarn package`
52-
- Format: `yarn fmt`
53-
- Format check: `yarn fmt:check`
54-
- Lint: `yarn lint`
55-
- Lint with auto-fix: `yarn lint:fix`
56-
- Run all tests: `yarn test`
57-
- Unit tests: `yarn test:ci`
58-
- Integration tests: `yarn test:integration`
59-
- Run specific unit test: `yarn test:ci ./test/unit/filename.test.ts`
60-
- Run specific integration test: `yarn test:integration ./test/integration/filename.test.ts`
49+
- Build: `pnpm build`
50+
- Watch mode: `pnpm watch`
51+
- Package: `pnpm package`
52+
- Format: `pnpm fmt`
53+
- Format check: `pnpm fmt:check`
54+
- Lint: `pnpm lint`
55+
- Lint with auto-fix: `pnpm lint:fix`
56+
- Run all tests: `pnpm test`
57+
- Unit tests: `pnpm test:ci`
58+
- Integration tests: `pnpm test:integration`
59+
- Run specific unit test: `pnpm test:ci ./test/unit/filename.test.ts`
60+
- Run specific integration test: `pnpm test:integration ./test/integration/filename.test.ts`
6161

6262
## Code Style
6363

CONTRIBUTING.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,17 @@ The link format is `vscode://coder.coder-remote/open?${query}`. For example:
8080
code --open-url 'vscode://coder.coder-remote/open?url=dev.coder.com&owner=my-username&workspace=my-ws&agent=my-agent'
8181
```
8282

83-
There are some unit tests as well:
83+
There are unit tests using `vitest` with mocked VS Code APIs:
8484

8585
```bash
86-
yarn test
86+
pnpm test:ci
8787
```
8888

89-
Note that we have an unusual testing setup with `vitest`; this needs to be
90-
changed back to how using the standard testing framework for VS Code extensions
91-
was but for now it means some things are difficult to test as you cannot import
92-
`vscode` in tests or write any UI tests.
89+
There are also integration tests that run inside a real VS Code instance:
90+
91+
```bash
92+
pnpm test:integration
93+
```
9394

9495
## Development
9596

@@ -98,7 +99,7 @@ was but for now it means some things are difficult to test as you cannot import
9899
> this extension from a coder workspace. We currently recommend cloning the
99100
> repo locally
100101
101-
1. Run `yarn watch` in the background.
102+
1. Run `pnpm watch` in the background.
102103
2. OPTIONAL: Compile the `coder` binary and place it in the equivalent of
103104
`os.tmpdir() + "/coder"`. If this is missing, it will download the binary
104105
from the Coder deployment, as it normally would. Reading from `/tmp/coder` is
@@ -123,7 +124,7 @@ Some dependencies are not directly used in the source but are required anyway.
123124
- `bufferutil` and `utf-8-validate` are peer dependencies of `ws`.
124125
- `ua-parser-js` and `dayjs` are used by the Coder API client.
125126

126-
The coder client is vendored from coder/coder. Every now and then, we should be running `yarn upgrade coder --latest`
127+
The coder client is vendored from coder/coder. Every now and then, we should be running `pnpm update coder`
127128
to make sure we're using up to date versions of the client.
128129

129130
## Releasing

flake.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
flake-utils.lib.eachDefaultSystem
88
(system:
99
let pkgs = nixpkgs.legacyPackages.${system};
10-
nodejs = pkgs.nodejs;
11-
yarn' = pkgs.yarn.override { inherit nodejs; };
1210
in {
1311
devShells.default = pkgs.mkShell {
1412
nativeBuildInputs = with pkgs; [
15-
nodejs yarn'
13+
nodejs nodePackages.pnpm
1614
];
1715
};
1816
}

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"fmt": "prettier --write --cache --cache-strategy content .",
2424
"fmt:check": "prettier --check --cache --cache-strategy content .",
2525
"lint": "eslint --cache --cache-strategy content .",
26-
"lint:fix": "yarn lint --fix",
27-
"package": "vsce package",
28-
"package:prerelease": "vsce package --pre-release",
29-
"pretest": "tsc -p test --noEmit && yarn fmt:check && yarn lint",
26+
"lint:fix": "pnpm lint --fix",
27+
"package": "vsce package --no-dependencies",
28+
"package:prerelease": "vsce package --pre-release --no-dependencies",
29+
"pretest": "tsc -p test --noEmit && pnpm fmt:check && pnpm lint",
3030
"test": "ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs",
31-
"test:ci": "CI=true yarn test",
31+
"test:ci": "CI=true pnpm test",
3232
"test:integration": "tsc -p test --outDir out && node esbuild.mjs && vscode-test",
33-
"vscode:prepublish": "yarn build:production",
33+
"vscode:prepublish": "pnpm build:production",
3434
"watch": "node esbuild.mjs --watch"
3535
},
3636
"contributes": {
@@ -422,6 +422,7 @@
422422
"devDependencies": {
423423
"@eslint/js": "^9.39.2",
424424
"@eslint/markdown": "^7.5.1",
425+
"@types/mocha": "^10.0.10",
425426
"@types/node": "^20",
426427
"@types/node-forge": "^1.3.14",
427428
"@types/proper-lockfile": "^4.1.4",
@@ -457,7 +458,7 @@
457458
"extensionPack": [
458459
"ms-vscode-remote.remote-ssh"
459460
],
460-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
461+
"packageManager": "pnpm@10.27.0",
461462
"engines": {
462463
"vscode": "^1.95.0",
463464
"node": ">= 20"

0 commit comments

Comments
 (0)