Skip to content

Commit dae2fd9

Browse files
authored
ci: migrate to pnpm/setup and vendor the Coder API client (#1148)
Replace pnpm/action-setup, actions/setup-node, and the install step in the shared setup action with a single pnpm/setup step. It installs Node 22 through `pnpm runtime set`, runs a frozen install, and keeps the platform fallback for the store cache. Only the default branch saves the store. publish-extension.yaml keeps actions/setup-node, since its jobs need only Node and a global vsce or ovsx install. Add `pnpm clean` to delete installs, build output, and caches from an explicit list, and have `pnpm package` clean and reinstall first. Webviews build into `dist/webviews/<name>`, so a webview from another branch otherwise ships in the package. Vendor the five files the extension imports from coder/coder instead of downloading the whole 125 MB repository on every cold install. `pnpm sync:coder` fetches them into `vendor/coder` at a pinned release commit, and `coder` links to that folder so imports stay `coder/site/src/...`. The Lint job runs the sync and fails on any diff. With no git dependencies left, CI setup drops the HTTPS rewrite. Closes #1119
1 parent 5c0ba1d commit dae2fd9

17 files changed

Lines changed: 16484 additions & 36 deletions

File tree

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* text=auto eol=lf
22
pnpm-lock.yaml linguist-generated=true
33
flake.lock linguist-generated=true
4+
vendor/coder/site/** linguist-generated=true

‎.github/actions/setup/action.yml‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,10 @@ description: Install pnpm, Node.js, and project dependencies.
44
runs:
55
using: composite
66
steps:
7-
- name: Use HTTPS for GitHub git clones
8-
shell: bash
9-
# Needed for git-based deps (e.g. github:coder/coder) so pnpm can clone without SSH.
10-
run: git config --global url."https://github.com/".insteadOf "git@github.com:"
11-
12-
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
7+
- uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1
138
with:
14-
# Caches the pnpm store, keyed by lockfile hash with a prefix fallback,
15-
# so a dependency bump reuses the rest of the store. setup-node's own
16-
# pnpm cache restores on an exact hash only.
9+
runtime: node@22
10+
require-lockfile: true
11+
# Falls back to the platform's last store, so a bump fetches only the diff.
1712
cache: true
18-
19-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
20-
with:
21-
node-version: "22"
22-
23-
- name: Install dependencies
24-
shell: bash
25-
run: pnpm install --frozen-lockfile
13+
save-cache: ${{ github.ref == 'refs/heads/main' }}

‎.github/workflows/ci.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828

2929
- run: pnpm format:check
3030

31+
- name: Check vendored Coder client
32+
run: pnpm sync:coder && git diff --exit-code vendor/coder
33+
3134
- run: pnpm lint
3235

3336
- run: pnpm build

‎.oxfmtrc.jsonc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
"ignorePatterns": [
88
"flake.lock",
99
"pnpm-lock.yaml",
10-
// Golden snapshots and generated VS Code theme dumps are written verbatim.
10+
// Golden snapshots, VS Code theme dumps, and the vendored Coder client are written verbatim.
1111
"**/__golden__/",
12-
".storybook/themes/generated/"
12+
".storybook/themes/generated/",
13+
"vendor/coder/site/"
1314
],
1415
"overrides": [
1516
{

‎.oxlintrc.jsonc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"**/vite.config*.ts",
1818
".vscode-test/**",
1919
"test/fixtures/scripts/**",
20-
"storybook-static/**"
20+
"storybook-static/**",
21+
"vendor/coder/site/**"
2122
],
2223
"overrides": [
2324
{

‎docs/TOOLING.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ When updating the minimum Node.js version, update these files:
6464
- **tsconfig.json**: `extends` (the `@tsconfig/nodeXX` package), `lib` (match base ESNext version)
6565
- **scripts/esbuild.mjs**: `target`
6666
- **.github/workflows/ci.yaml**: `electron-version` and `vscode-version` matrices
67+
- **.github/actions/setup/action.yml**: `runtime`
6768

6869
## Dependencies
6970

@@ -73,11 +74,9 @@ Some dependencies are not directly used in the source but are required anyway.
7374
builds are off, so Windows on ARM64 uses their JavaScript fallback.
7475
- `ua-parser-js` and `dayjs` are used by the Coder API client.
7576

76-
The coder client is vendored from coder/coder. Pin it to a release tag in
77-
`pnpm-workspace.yaml` (e.g. `coder: github:coder/coder#v2.33.1`), not `#main`.
78-
A tag gives reproducible builds and is not re-fetched on every `pnpm install`,
79-
unlike `#main` which can drift between installs. To update, bump the tag and
80-
run `pnpm install` (or `pnpm update coder`).
77+
The Coder API client is vendored from coder/coder into `vendor/coder/site`. To
78+
update it, set `CODER_COMMIT` in `vendor/coder/sync.mjs` to a release commit
79+
and run `pnpm sync:coder`.
8180

8281
After running `pnpm update`, always run `pnpm dedupe` to consolidate duplicate
8382
package versions across the workspace. Without this, workspace packages can

‎eslint.config.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default defineConfig(
2525
".vscode-test/**",
2626
"test/fixtures/scripts/**",
2727
"storybook-static/**",
28+
"vendor/coder/site/**",
2829
]),
2930

3031
// Parse TypeScript without the type-aware programs; Oxlint owns typed rules.
@@ -42,6 +43,7 @@ export default defineConfig(
4243
createTypeScriptImportResolver({ project: "./tsconfig.json" }),
4344
],
4445
"import-x/internal-regex": "^@/",
46+
"import-x/external-module-folders": ["node_modules", "vendor"],
4547
},
4648
rules: {
4749
"import-x/order": [

‎package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@
2929
"build:production": "cross-env NODE_ENV=production pnpm build",
3030
"build:test": "tsc -p test/integration --outDir out --noCheck",
3131
"build:webviews": "pnpm -r --filter \"./packages/*\" --parallel build",
32+
"clean": "node scripts/clean.mjs",
3233
"format": "node scripts/run-tool.mjs oxfmt --write .",
3334
"format:check": "node scripts/run-tool.mjs oxfmt --check .",
3435
"lint": "concurrently -g -n oxlint,eslint \"pnpm lint:oxlint\" \"pnpm lint:eslint\"",
3536
"lint:eslint": "node scripts/run-tool.mjs eslint --cache --cache-strategy content --cache-location node_modules/.cache/eslint/ .",
3637
"lint:fix": "pnpm lint:oxlint --fix && pnpm lint:eslint --fix",
3738
"lint:oxlint": "node scripts/run-tool.mjs oxlint --type-aware .",
39+
"prepackage": "pnpm clean && pnpm install --frozen-lockfile",
3840
"package": "pnpm build:production && vsce package --no-dependencies",
3941
"package:prerelease": "pnpm build:production && vsce package --pre-release --no-dependencies",
4042
"storybook": "storybook dev -p 6006 --config-dir .storybook",
4143
"storybook:build": "storybook build --config-dir .storybook",
4244
"storybook:ci": "storybook build --test --config-dir .storybook",
45+
"sync:coder": "node vendor/coder/sync.mjs",
4346
"sync:vscode-themes": "node .storybook/themes/sync.mjs",
4447
"test": "cross-env CI=true ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs",
4548
"test:extension": "cross-env ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs --project extension",
@@ -850,7 +853,7 @@
850853
"@vscode/vsce": "^4.0.0",
851854
"babel-plugin-react-compiler": "catalog:",
852855
"bufferutil": "^4.1.0",
853-
"coder": "catalog:",
856+
"coder": "link:vendor/coder",
854857
"concurrently": "^10.0.6",
855858
"cross-env": "^10.1.0",
856859
"dayjs": "^1.11.23",

‎pnpm-lock.yaml‎

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ catalog:
1616
"@vscode-elements/react-elements": ^2.4.0
1717
"@vscode/codicons": 0.0.46-24
1818
babel-plugin-react-compiler: ^1.0.0
19-
coder: github:coder/coder#22f4284f8fa67bc3af6fc38e0079616d39128566 # v2.37.1
2019
date-fns: ^4.4.0
2120
react: ^19.3.1
2221
react-dom: ^19.3.1

0 commit comments

Comments
 (0)