Skip to content

Commit b5a6aa1

Browse files
authored
feat: switch to npm as default package manager (#226927)
* feat: move from yarn to npm * chore: skip yarn.lock files * fix: playwright download * chore: fix compile and hygiene * chore: bump vsce@2.17.0 Refs microsoft/vscode-vsce@8b49e9d * test: update results for bat and sh colorizer tests * fix: add missing lock files for windows * fix: switch to legacy-peer-deps * chore: update markdown-it@14.1.0 Refs markdown-it/markdown-it@737c95a esbuild step in extensions-ci-pr was previously using markdown-it from root which had userland punycode and was able to compile successfully. * ci: increase pr timeout for windows integration tests * chore: fix product build * build: ignore extension dev dependency for rcedit * build: fix working directory inside container * build: fix dependency generation * npm: update dependencies * ci: use global npmrc * ci: update cache * ci: setup global npmrc for private npm auth * build: fix extension bundling * chore: sync npm dependencies * ci: debug env variables for container * ci: fix win32 cli pipeline * build: fix npmrc config usage for build/ and remote/ dirs * fix: windows build * fix: container builds * fix: markdown-language-features tests and bundling ``` [03:58:22] Error: Command failed: /Users/demohan/.nvm/versions/node/v20.15.1/bin/node /Users/demohan/github/vscode/extensions/markdown-language-features/esbuild-notebook.js --outputRoot /Users/demohan/github/vscode/.build/extensions/markdown-language-features ✘ [ERROR] Could not resolve "punycode" extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27: 14 │ var punycode = require('punycode'); ╵ ~~~~~~~~~~ The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. ``` Adds userland package based on markdown-it/markdown-it@beed9ae * fix: container builds for distro * chore: update yarn occurrences * fixup! chore: bump vsce@2.17.0 Uses the closest version to `main` branch that does not include microsoft/vscode-vsce@d3cc84c while still having the fix microsoft/vscode-vsce@8b49e9d * chore: sync npm dependencies * chore: sync npm dependencies * chore: sync npm dependencies * chore: throw error when yarn is used for installation * chore: add review feedback * chore: switch exec => run where needed * chore: npm sync dependencies * fix: markdown-language-features bundling ``` ✘ [ERROR] Could not resolve "punycode" extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27: 14 │ var punycode = require('punycode'); ╵ ~~~~~~~~~~ The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. ``` Adds missing userland package based on markdown-it/markdown-it@beed9ae, can be removed once we update markdown-it >= 14.1.0 * ci: rename no-yarn-lock-changes.yml * chore: sync npm dependencies * ci: restore no-yarn-lock-changes.yml We can disable it in a separate PR to keep the required checks happy and also need workflow edit perms. * chore: sync npm dependencies * ci: rebuild cache * ci: fix no-package-lock-changes.yml * chore: bump distro * chore: rm yarn.lock files * chore: rm yarn.lock files without dependencies * chore: add vscode-selfhost-import-aid to postinstall dirs * chore: bump distro
1 parent 5ae8ffb commit b5a6aa1

File tree

306 files changed

+38280
-23071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+38280
-23071
lines changed

.configurations/configuration.dsc.yaml

+1-12
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@ properties:
1818
id: OpenJS.NodeJS.LTS
1919
version: "20.14.0"
2020
source: winget
21-
- resource: NpmDsc/NpmPackage
22-
id: yarn
23-
dependsOn:
24-
- npm
25-
directives:
26-
description: Install Yarn
27-
allowPrerelease: true
28-
settings:
29-
Name: 'yarn'
30-
Global: true
31-
PackageDirectory: '${WinGetConfigRoot}\..\'
3221
- resource: Microsoft.WinGet.DSC/WinGetPackage
3322
directives:
3423
description: Install Python 3.10
@@ -56,7 +45,7 @@ properties:
5645
includeRecommended: true
5746
components:
5847
- Microsoft.VisualStudio.Workload.VCTools
59-
- resource: YarnDsc/YarnInstall
48+
- resource: NpmDsc/NpmInstall
6049
dependsOn:
6150
- npm
6251
directives:

.devcontainer/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ RUN git config --system codespaces-theme.hide-status 1
77

88
USER node
99
RUN npm install -g node-gyp
10-
RUN YARN_CACHE="$(yarn cache dir)" && rm -rf "$YARN_CACHE" && ln -s /vscode-dev/yarn-cache "$YARN_CACHE"
10+
RUN NPM_CACHE="$(npm config get cache)" && rm -rf "$NPM_CACHE" && ln -s /vscode-dev/npm-cache "$NPM_CACHE"
1111
RUN echo 'export DISPLAY="${DISPLAY:-:1}"' | tee -a ~/.bashrc >> ~/.zshrc
1212

1313
USER root
14-
CMD chown node:node /vscode-dev && sudo -u node mkdir -p /vscode-dev/yarn-cache && sleep inf
14+
CMD chown node:node /vscode-dev && sudo -u node mkdir -p /vscode-dev/npm-cache && sleep inf

.devcontainer/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If you already have VS Code and Docker installed, you can click the badge above
2424
2525
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Dev Containers: Clone Repository in Container Volume...**.
2626

27-
> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or when using the Hyper-V engine on Windows. We recommend using the WSL filesystem on Windows or the "clone repository in container" approach on Windows and macOS instead since it uses "named volume" rather than the local filesystem.
27+
> **Tip:** While you can use your local source tree instead, operations like `npm i` can be slow on macOS or when using the Hyper-V engine on Windows. We recommend using the WSL filesystem on Windows or the "clone repository in container" approach on Windows and macOS instead since it uses "named volume" rather than the local filesystem.
2828
2929
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
3030

@@ -85,7 +85,7 @@ To start working with Code - OSS, follow these steps:
8585
1. In your local VS Code client, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
8686

8787
```bash
88-
yarn install
88+
npm i
8989
bash scripts/code.sh
9090
```
9191

.devcontainer/post-create.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

3-
yarn install --network-timeout 180000
4-
yarn electron
3+
npm i
4+
npm run electron

.github/workflows/basic.yml

+35-34
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,26 @@ jobs:
4242
with:
4343
path: "**/node_modules"
4444
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
45-
- name: Get yarn cache directory path
46-
id: yarnCacheDirPath
45+
- name: Get npm cache directory path
46+
id: npmCacheDirPath
4747
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
48-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
49-
- name: Cache yarn directory
48+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
49+
- name: Cache npm directory
5050
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
5151
uses: actions/cache@v4
5252
with:
53-
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
54-
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
55-
restore-keys: ${{ runner.os }}-yarnCacheDir-
56-
- name: Execute yarn
53+
path: ${{ steps.npmCacheDirPath.outputs.dir }}
54+
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
55+
restore-keys: ${{ runner.os }}-npmCacheDir-
56+
- name: Execute npm
5757
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
5858
env:
5959
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
6060
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
61-
run: yarn --frozen-lockfile --network-timeout 180000
61+
run: npm ci
6262

6363
- name: Compile and Download
64-
run: yarn npm-run-all --max-old-space-size=4095 -lp compile "electron x64"
64+
run: npm exec -- npm-run-all -lp compile "electron x64"
6565

6666
- name: Run Unit Tests
6767
id: electron-unit-tests
@@ -94,44 +94,45 @@ jobs:
9494
with:
9595
path: "**/node_modules"
9696
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
97-
- name: Get yarn cache directory path
98-
id: yarnCacheDirPath
97+
- name: Get npm cache directory path
98+
id: npmCacheDirPath
9999
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
100-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
101-
- name: Cache yarn directory
100+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
101+
- name: Cache npm directory
102102
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
103103
uses: actions/cache@v4
104104
with:
105-
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
106-
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
107-
restore-keys: ${{ runner.os }}-yarnCacheDir-
108-
- name: Execute yarn
105+
path: ${{ steps.npmCacheDirPath.outputs.dir }}
106+
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
107+
restore-keys: ${{ runner.os }}-npmCacheDir-
108+
- name: Execute npm
109109
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
110110
env:
111111
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
112112
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
113-
run: yarn --frozen-lockfile --network-timeout 180000
113+
run: npm ci
114114

115115
- name: Run Hygiene Checks
116-
run: yarn gulp hygiene
116+
run: npm run gulp hygiene
117117

118118
- name: Run Valid Layers Checks
119-
run: yarn valid-layers-check
119+
run: npm run valid-layers-check
120120

121121
- name: Compile /build/
122-
run: yarn --cwd build compile
122+
run: npm run compile
123+
working-directory: build
123124

124125
- name: Check clean git state
125126
run: ./.github/workflows/check-clean-git-state.sh
126127

127128
- name: Run eslint
128-
run: yarn eslint
129+
run: npm run eslint
129130

130131
- name: Run vscode-dts Compile Checks
131-
run: yarn vscode-dts-compile-check
132+
run: npm run vscode-dts-compile-check
132133

133134
- name: Run Trusted Types Checks
134-
run: yarn tsec-compile-check
135+
run: npm run tsec-compile-check
135136

136137
warm-cache:
137138
name: Warm up node modules cache
@@ -156,20 +157,20 @@ jobs:
156157
with:
157158
path: "**/node_modules"
158159
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
159-
- name: Get yarn cache directory path
160-
id: yarnCacheDirPath
160+
- name: Get npm cache directory path
161+
id: npmCacheDirPath
161162
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
162-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
163-
- name: Cache yarn directory
163+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
164+
- name: Cache npm directory
164165
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
165166
uses: actions/cache@v4
166167
with:
167-
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
168-
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
169-
restore-keys: ${{ runner.os }}-yarnCacheDir-
170-
- name: Execute yarn
168+
path: ${{ steps.npmCacheDirPath.outputs.dir }}
169+
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
170+
restore-keys: ${{ runner.os }}-npmCacheDir-
171+
- name: Execute npm
171172
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
172173
env:
173174
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
174175
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
175-
run: yarn --frozen-lockfile --network-timeout 180000
176+
run: npm ci

0 commit comments

Comments
 (0)