Skip to content

Commit bce606d

Browse files
committed
Switch fully to npm
This is to match VS Code. We were already partially using npm for the releases so this is some nice alignment.
1 parent 1b237fa commit bce606d

37 files changed

+11871
-7172
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ body:
6262
id: logs
6363
attributes:
6464
label: Logs
65-
description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `yarn global add code-server`).
65+
description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `npm install -g code-server`).
6666
render: shell
6767

6868
- type: textarea

.github/PULL_REQUEST_TEMPLATE/release_template.md

-17
This file was deleted.

.github/workflows/build.yaml

+59-106
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919
# this ensures that it only executes if all previous jobs succeeded.
2020

2121
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
22-
# will skip running `yarn install` if it successfully fetched from cache
22+
# will skip running `npm install` if it successfully fetched from cache
2323

2424
jobs:
2525
prettier:
@@ -55,14 +55,16 @@ jobs:
5555
uses: actions/setup-node@v4
5656
with:
5757
node-version-file: .node-version
58-
cache: "yarn"
58+
cache: npm
59+
cache-dependency-path: |
60+
package-lock.json
61+
test/package-lock.json
5962
60-
- name: Install doctoc
61-
run: yarn global add [email protected]
63+
- if: steps.changed-files.outputs.any_changed == 'true'
64+
run: SKIP_SUBMODULE_DEPS=1 npm ci
6265

63-
- name: Run doctoc
64-
if: steps.changed-files.outputs.any_changed == 'true'
65-
run: yarn doctoc
66+
- if: steps.changed-files.outputs.any_changed == 'true'
67+
run: npm run doctoc
6668

6769
lint-helm:
6870
name: Lint Helm chart
@@ -87,12 +89,10 @@ jobs:
8789
with:
8890
token: ${{ secrets.GITHUB_TOKEN }}
8991

90-
- name: Install helm kubeval plugin
91-
if: steps.changed-files.outputs.any_changed == 'true'
92+
- if: steps.changed-files.outputs.any_changed == 'true'
9293
run: helm plugin install https://github.com/instrumenta/helm-kubeval
9394

94-
- name: Lint Helm chart
95-
if: steps.changed-files.outputs.any_changed == 'true'
95+
- if: steps.changed-files.outputs.any_changed == 'true'
9696
run: helm kubeval ci/helm-chart
9797

9898
lint-ts:
@@ -120,24 +120,17 @@ jobs:
120120
uses: actions/setup-node@v4
121121
with:
122122
node-version-file: .node-version
123+
cache: npm
124+
cache-dependency-path: |
125+
package-lock.json
126+
test/package-lock.json
123127
124-
- name: Fetch dependencies from cache
125-
if: steps.changed-files.outputs.any_changed == 'true'
126-
id: cache-node-modules
127-
uses: actions/cache@v4
128-
with:
129-
path: "**/node_modules"
130-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
131-
restore-keys: |
132-
yarn-build-
133-
134-
- name: Install dependencies
135-
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-node-modules.outputs.cache-hit != 'true'
136-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
128+
- if: steps.changed-files.outputs.any_changed == 'true'
129+
run: SKIP_SUBMODULE_DEPS=1 npm ci
137130

138131
- name: Lint TypeScript files
139132
if: steps.changed-files.outputs.any_changed == 'true'
140-
run: yarn lint:ts
133+
run: npm run lint:ts
141134

142135
lint-actions:
143136
name: Lint GitHub Actions
@@ -175,24 +168,16 @@ jobs:
175168
uses: actions/setup-node@v4
176169
with:
177170
node-version-file: .node-version
171+
cache: npm
172+
cache-dependency-path: |
173+
package-lock.json
174+
test/package-lock.json
178175
179-
- name: Fetch dependencies from cache
180-
if: steps.changed-files.outputs.any_changed == 'true'
181-
id: cache-node-modules
182-
uses: actions/cache@v4
183-
with:
184-
path: "**/node_modules"
185-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
186-
restore-keys: |
187-
yarn-build-
176+
- if: steps.changed-files.outputs.any_changed == 'true'
177+
run: SKIP_SUBMODULE_DEPS=1 npm ci
188178

189-
- name: Install dependencies
190-
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-node-modules.outputs.cache-hit != 'true'
191-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
192-
193-
- name: Run unit tests
194-
if: steps.changed-files.outputs.any_changed == 'true'
195-
run: yarn test:unit
179+
- if: steps.changed-files.outputs.any_changed == 'true'
180+
run: npm run test:unit
196181

197182
- name: Upload coverage report to Codecov
198183
uses: codecov/codecov-action@v4
@@ -229,24 +214,16 @@ jobs:
229214
uses: actions/setup-node@v4
230215
with:
231216
node-version-file: .node-version
217+
cache: npm
218+
cache-dependency-path: |
219+
package-lock.json
220+
test/package-lock.json
232221
233-
- name: Fetch dependencies from cache
234-
id: cache-node-modules
235-
uses: actions/cache@v4
236-
with:
237-
path: "**/node_modules"
238-
key: yarn-build-code-server-${{ hashFiles('**/yarn.lock') }}
239-
restore-keys: |
240-
yarn-build-code-server-
241-
242-
- name: Install dependencies
243-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
244-
run: yarn --frozen-lockfile
222+
- run: SKIP_SUBMODULE_DEPS=1 npm ci
245223

246-
- name: Build code-server
247-
env:
224+
- env:
248225
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
249-
run: yarn build
226+
run: npm run build
250227

251228
# Get Code's git hash. When this changes it means the content is
252229
# different and we need to rebuild.
@@ -269,17 +246,19 @@ jobs:
269246
env:
270247
VERSION: "0.0.0"
271248
if: steps.cache-vscode.outputs.cache-hit != 'true'
272-
run: yarn build:vscode
249+
run: |
250+
pushd lib/vscode
251+
npm ci
252+
popd
253+
npm run build:vscode
273254
274255
# The release package does not contain any native modules
275256
# and is neutral to architecture/os/libc version.
276-
- name: Create release package
277-
run: yarn release
257+
- run: npm run release
278258
if: success()
279259

280260
# https://github.com/actions/upload-artifact/issues/38
281-
- name: Compress release package
282-
run: tar -czf package.tar.gz release
261+
- run: tar -czf package.tar.gz release
283262

284263
- name: Upload npm package artifact
285264
uses: actions/upload-artifact@v4
@@ -303,38 +282,28 @@ jobs:
303282
uses: actions/setup-node@v4
304283
with:
305284
node-version-file: .node-version
285+
cache: npm
286+
cache-dependency-path: |
287+
package-lock.json
288+
test/package-lock.json
306289
307-
- name: Fetch dependencies from cache
308-
id: cache-node-modules
309-
uses: actions/cache@v4
310-
with:
311-
path: "**/node_modules"
312-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
313-
restore-keys: |
314-
yarn-build-
290+
- run: SKIP_SUBMODULE_DEPS=1 npm ci
315291

316292
- name: Download npm package
317293
uses: actions/download-artifact@v4
318294
with:
319295
name: npm-package
320296

321-
- name: Decompress npm package
322-
run: tar -xzf package.tar.gz
297+
- run: tar -xzf package.tar.gz
323298

324-
- name: Install release package dependencies
325-
run: cd release && npm install --unsafe-perm --omit=dev
326-
327-
- name: Install dependencies
328-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
329-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
299+
- run: cd release && npm install --unsafe-perm --omit=dev
330300

331301
- name: Install Playwright OS dependencies
332302
run: |
333303
./test/node_modules/.bin/playwright install-deps
334304
./test/node_modules/.bin/playwright install
335305
336-
- name: Run end-to-end tests
337-
run: CODE_SERVER_TEST_ENTRY=./release yarn test:e2e
306+
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e
338307

339308
- name: Upload test artifacts
340309
if: always()
@@ -362,30 +331,21 @@ jobs:
362331
uses: actions/setup-node@v4
363332
with:
364333
node-version-file: .node-version
334+
cache: npm
335+
cache-dependency-path: |
336+
package-lock.json
337+
test/package-lock.json
365338
366-
- name: Fetch dependencies from cache
367-
id: cache-node-modules
368-
uses: actions/cache@v4
369-
with:
370-
path: "**/node_modules"
371-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
372-
restore-keys: |
373-
yarn-build-
339+
- run: SKIP_SUBMODULE_DEPS=1 npm ci
374340

375341
- name: Download npm package
376342
uses: actions/download-artifact@v4
377343
with:
378344
name: npm-package
379345

380-
- name: Decompress npm package
381-
run: tar -xzf package.tar.gz
346+
- run: tar -xzf package.tar.gz
382347

383-
- name: Install release package dependencies
384-
run: cd release && npm install --unsafe-perm --omit=dev
385-
386-
- name: Install dependencies
387-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
388-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
348+
- run: cd release && npm install --unsafe-perm --omit=dev
389349

390350
- name: Install Playwright OS dependencies
391351
run: |
@@ -409,22 +369,15 @@ jobs:
409369
mkdir -p ~/.cache/caddy
410370
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
411371
412-
- name: Start Caddy
413-
run: sudo ~/.cache/caddy/caddy start --config ./ci/Caddyfile
372+
- run: sudo ~/.cache/caddy/caddy start --config ./ci/Caddyfile
414373

415-
- name: Run end-to-end tests
416-
run: CODE_SERVER_TEST_ENTRY=./release yarn test:e2e:proxy --global-timeout 840000
374+
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy --global-timeout 840000
417375

418-
- name: Stop Caddy
419-
if: always()
376+
- if: always()
420377
run: sudo ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
421378

422-
- name: Upload test artifacts
423-
if: always()
379+
- if: always()
424380
uses: actions/upload-artifact@v4
425381
with:
426382
name: failed-test-videos-proxy
427383
path: ./test/test-results
428-
429-
- name: Remove release packages and test artifacts
430-
run: rm -rf ./release ./test/test-results

.github/workflows/publish.yaml

+6-13
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ concurrency:
2121
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2222

2323
jobs:
24-
# NOTE: this job requires curl, jq and yarn
25-
# All of them are included in ubuntu-latest.
2624
npm:
2725
runs-on: ubuntu-latest
2826
steps:
@@ -33,7 +31,6 @@ jobs:
3331
uses: actions/setup-node@v4
3432
with:
3533
node-version-file: .node-version
36-
cache: "yarn"
3734

3835
- name: Download npm package from release artifacts
3936
uses: robinraju/[email protected]
@@ -43,15 +40,13 @@ jobs:
4340
fileName: "package.tar.gz"
4441
out-file-path: "release-npm-package"
4542

46-
# NOTE@jsjoeio - we do this so we can strip out the v
47-
# i.e. v4.9.1 -> 4.9.1
43+
# Strip out the v (v4.9.1 -> 4.9.1).
4844
- name: Get and set VERSION
4945
run: |
5046
TAG="${{ github.event.inputs.version || github.ref_name }}"
5147
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
5248
53-
- name: Publish npm package and tag with "latest"
54-
run: yarn publish:npm
49+
- run: npm run publish:npm
5550
env:
5651
VERSION: ${{ env.VERSION }}
5752
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -77,8 +72,7 @@ jobs:
7772
git config --global user.name cdrci
7873
git config --global user.email [email protected]
7974
80-
# NOTE@jsjoeio - we do this so we can strip out the v
81-
# i.e. v4.9.1 -> 4.9.1
75+
# Strip out the v (v4.9.1 -> 4.9.1).
8276
- name: Get and set VERSION
8377
run: |
8478
TAG="${{ github.event.inputs.version || github.ref_name }}"
@@ -124,8 +118,7 @@ jobs:
124118
git config --global user.name cdrci
125119
git config --global user.email [email protected]
126120
127-
# NOTE@jsjoeio - we do this so we can strip out the v
128-
# i.e. v4.9.1 -> 4.9.1
121+
# Strip out the v (v4.9.1 -> 4.9.1).
129122
- name: Get and set VERSION
130123
run: |
131124
TAG="${{ github.event.inputs.version || github.ref_name }}"
@@ -151,6 +144,7 @@ jobs:
151144
git commit -m "chore: updating version to ${{ env.VERSION }}"
152145
git push -u origin $(git branch --show)
153146
gh pr create --repo coder/code-server-aur --title "chore: bump version to ${{ env.VERSION }}" --body "PR opened by @$GITHUB_ACTOR" --assignee $GITHUB_ACTOR
147+
154148
docker:
155149
runs-on: ubuntu-20.04
156150
steps:
@@ -176,8 +170,7 @@ jobs:
176170
username: ${{ github.actor }}
177171
password: ${{ secrets.GITHUB_TOKEN }}
178172

179-
# NOTE@jsjoeio - we do this so we can strip out the v
180-
# i.e. v4.9.1 -> 4.9.1
173+
# Strip out the v (v4.9.1 -> 4.9.1).
181174
- name: Get and set VERSION
182175
run: |
183176
TAG="${{ github.event.inputs.version || github.ref_name }}"

0 commit comments

Comments
 (0)