Skip to content

Commit e4e59e2

Browse files
committed
build: vendor the Coder API client with a sync script
The extension imports five files from coder/coder, but the git dependency downloads the whole 125 MB repository on every cold install. Add `pnpm sync:coder` to download the files into `vendor/coder` at a pinned release commit, and link the `coder` dependency to that folder so imports stay `coder/site/src/...`. The Lint job runs the sync and fails on any diff, so hand edits or a bumped commit without a resync can't merge. With no git dependencies left, drop the HTTPS rewrite from CI setup.
1 parent c53fa76 commit e4e59e2

16 files changed

Lines changed: 16457 additions & 26 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: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ 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-
127
- uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1
138
with:
149
runtime: node@22

‎.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: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ Some dependencies are not directly used in the source but are required anyway.
7474
builds are off, so Windows on ARM64 uses their JavaScript fallback.
7575
- `ua-parser-js` and `dayjs` are used by the Coder API client.
7676

77-
The coder client is vendored from coder/coder. Pin it to a release tag in
78-
`pnpm-workspace.yaml` (e.g. `coder: github:coder/coder#v2.33.1`), not `#main`.
79-
A tag gives reproducible builds and is not re-fetched on every `pnpm install`,
80-
unlike `#main` which can drift between installs. To update, bump the tag and
81-
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`.
8280

8381
After running `pnpm update`, always run `pnpm dedupe` to consolidate duplicate
8482
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"storybook": "storybook dev -p 6006 --config-dir .storybook",
4242
"storybook:build": "storybook build --config-dir .storybook",
4343
"storybook:ci": "storybook build --test --config-dir .storybook",
44+
"sync:coder": "node vendor/coder/sync.mjs",
4445
"sync:vscode-themes": "node .storybook/themes/sync.mjs",
4546
"test": "cross-env CI=true ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs",
4647
"test:extension": "cross-env ELECTRON_RUN_AS_NODE=1 electron node_modules/vitest/vitest.mjs --project extension",
@@ -853,7 +854,7 @@
853854
"@vscode/vsce": "^4.0.0",
854855
"babel-plugin-react-compiler": "catalog:",
855856
"bufferutil": "^4.1.0",
856-
"coder": "catalog:",
857+
"coder": "link:vendor/coder",
857858
"concurrently": "^10.0.5",
858859
"cross-env": "^10.1.0",
859860
"dayjs": "^1.11.23",

‎pnpm-lock.yaml‎

Lines changed: 2 additions & 11 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.0
2221
react-dom: ^19.3.0

0 commit comments

Comments
 (0)