Skip to content

Commit

Permalink
feat: switch to npm as default package manager (microsoft#226927)
Browse files Browse the repository at this point in the history
* feat: move from yarn to npm

* chore: skip yarn.lock files

* fix: playwright download

* chore: fix compile and hygiene

* chore: bump [email protected]

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 [email protected]

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 [email protected]

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
  • Loading branch information
deepak1556 authored Sep 6, 2024
1 parent 5ae8ffb commit b5a6aa1
Show file tree
Hide file tree
Showing 306 changed files with 38,280 additions and 23,071 deletions.
13 changes: 1 addition & 12 deletions .configurations/configuration.dsc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ properties:
id: OpenJS.NodeJS.LTS
version: "20.14.0"
source: winget
- resource: NpmDsc/NpmPackage
id: yarn
dependsOn:
- npm
directives:
description: Install Yarn
allowPrerelease: true
settings:
Name: 'yarn'
Global: true
PackageDirectory: '${WinGetConfigRoot}\..\'
- resource: Microsoft.WinGet.DSC/WinGetPackage
directives:
description: Install Python 3.10
Expand Down Expand Up @@ -56,7 +45,7 @@ properties:
includeRecommended: true
components:
- Microsoft.VisualStudio.Workload.VCTools
- resource: YarnDsc/YarnInstall
- resource: NpmDsc/NpmInstall
dependsOn:
- npm
directives:
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ RUN git config --system codespaces-theme.hide-status 1

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

USER root
CMD chown node:node /vscode-dev && sudo -u node mkdir -p /vscode-dev/yarn-cache && sleep inf
CMD chown node:node /vscode-dev && sudo -u node mkdir -p /vscode-dev/npm-cache && sleep inf
4 changes: 2 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you already have VS Code and Docker installed, you can click the badge above
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...**.

> **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.
> **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.
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.

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

```bash
yarn install
npm i
bash scripts/code.sh
```

Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

yarn install --network-timeout 180000
yarn electron
npm i
npm run electron
69 changes: 35 additions & 34 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@ jobs:
with:
path: "**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
- name: Get yarn cache directory path
id: yarnCacheDirPath
- name: Get npm cache directory path
id: npmCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn directory
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
uses: actions/cache@v4
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-yarnCacheDir-
- name: Execute yarn
path: ${{ steps.npmCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-npmCacheDir-
- name: Execute npm
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
run: yarn --frozen-lockfile --network-timeout 180000
run: npm ci

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

- name: Run Unit Tests
id: electron-unit-tests
Expand Down Expand Up @@ -94,44 +94,45 @@ jobs:
with:
path: "**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
- name: Get yarn cache directory path
id: yarnCacheDirPath
- name: Get npm cache directory path
id: npmCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn directory
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
uses: actions/cache@v4
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-yarnCacheDir-
- name: Execute yarn
path: ${{ steps.npmCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-npmCacheDir-
- name: Execute npm
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
run: yarn --frozen-lockfile --network-timeout 180000
run: npm ci

- name: Run Hygiene Checks
run: yarn gulp hygiene
run: npm run gulp hygiene

- name: Run Valid Layers Checks
run: yarn valid-layers-check
run: npm run valid-layers-check

- name: Compile /build/
run: yarn --cwd build compile
run: npm run compile
working-directory: build

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

- name: Run eslint
run: yarn eslint
run: npm run eslint

- name: Run vscode-dts Compile Checks
run: yarn vscode-dts-compile-check
run: npm run vscode-dts-compile-check

- name: Run Trusted Types Checks
run: yarn tsec-compile-check
run: npm run tsec-compile-check

warm-cache:
name: Warm up node modules cache
Expand All @@ -156,20 +157,20 @@ jobs:
with:
path: "**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
- name: Get yarn cache directory path
id: yarnCacheDirPath
- name: Get npm cache directory path
id: npmCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn directory
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
uses: actions/cache@v4
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-yarnCacheDir-
- name: Execute yarn
path: ${{ steps.npmCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-npmCacheDir-
- name: Execute npm
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
run: yarn --frozen-lockfile --network-timeout 180000
run: npm ci
Loading

0 comments on commit b5a6aa1

Please sign in to comment.