Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps)!: migrate from yarn to npm + workspaces #6322

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file exists exclusively for running the functional tests.
# These values are deliberately hardcoded.

# The relative path trick is necessary because `yarn build` will
# The relative path trick is necessary because `npm run build` will
# be running from the `./build/` directory.

CONTENT_ROOT=testing/content/files
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# These are @mdn-bot because the auto-merge GHA workflow uses the PAT of this account.
# If another reviewer is specified, update the PAT token or auto-merge will cease to be automatic.
/package.json @mdn-bot
/yarn.lock @mdn-bot
/package-lock.json @mdn-bot
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
1. Read the Community Participation Guidelines: https://www.mozilla.org/about/governance/policies/participation/
2. Ensure that there is an open issue for the problem you're solving, or create it first: https://github.com/mdn/yari/issues/new/choose
3. Fork the repository and create your branch from `main`.
4. Run `yarn` in the repository root.
4. Run `npm install` in the repository root.
5. Make sure to sign all your commits: https://docs.github.com/authentication/managing-commit-signature-verification/signing-commits
-->

Expand Down
3 changes: 1 addition & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ dependencies:
- changed-files:
- any-glob-to-any-file:
- "**/poetry.lock"
- "**/yarn.lock"

- "**/package-lock.json"
deployer:
- changed-files:
- any-glob-to-any-file: "deployer/**/*"
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm
cache-dependency-path: "**/package-lock.json"

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install all npm packages
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -118,7 +119,7 @@ jobs:
# Now is not the time to worry about flaws.
BUILD_FLAW_LEVELS: "*:ignore"

# Uncomment when hacking on this workflow. It means the `yarn build`
# Uncomment when hacking on this workflow. It means the `npm run build`
# finishes much sooner, which can be helpful debugging the other stuff
# the workflow needs to do.
# BUILD_FOLDERSEARCH: web/html
Expand All @@ -136,16 +137,16 @@ jobs:
# Info about which CONTENT_* environment variables were set and to what.
echo "CONTENT_ROOT=$CONTENT_ROOT"
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT"
yarn build:prepare
npm run build:prepare

yarn tool sync-translated-content
npm run tool sync-translated-content

# Spread the work across 2 processes. Why 2? Because that's what you
# get in the default GitHub hosting Linux runners.
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
yarn build:docs --locale en-us --locale ja --locale fr &
npm run build:docs -- --locale en-us --locale ja --locale fr &
build1=$!
yarn build:docs --not-locale en-us --not-locale ja --not-locale fr &
npm run build:docs -- --not-locale en-us --not-locale ja --not-locale fr &
build2=$!

# You must explicitly specify the job you're waiting-on to ensure
Expand All @@ -159,15 +160,15 @@ jobs:
du -sh client/build

# Generate sitemap index file
yarn build --sitemap-index
npm run build --sitemap-index

# SSR all pages
yarn render:html
npm run render:html

# Generate whatsdeployed files.
yarn tool whatsdeployed --output client/build/_whatsdeployed/code.json
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json
npm run tool whatsdeployed -- --output client/build/_whatsdeployed/code.json
npm run tool whatsdeployed $CONTENT_ROOT -- --output client/build/_whatsdeployed/content.json
npm run tool whatsdeployed $CONTENT_TRANSLATED_ROOT -- --output client/build/_whatsdeployed/translated-content.json

- name: Deploy with deployer
env:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/developing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm
cache-dependency-path: "**/package-lock.json"

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install all npm packages
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -55,8 +56,8 @@ jobs:
# the content if loading this page fails.
ls "$CONTENT_ROOT/en-us/mdn/kitchensink"

yarn build:prepare
yarn start > /tmp/stdout.log 2> /tmp/stderr.log &
npm run build:prepare
npm run start > /tmp/stdout.log 2> /tmp/stderr.log &

- name: Wait for servers
run: |
Expand All @@ -68,7 +69,7 @@ jobs:

- name: Test viewing the dev server
run: |
yarn test:developing
npm run test:developing

- name: Debug server's stdout and stderr if tests failed
if: failure()
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ jobs:
if: steps.release.outputs.release_created
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm
registry-url: "https://registry.npmjs.org"

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
if: steps.release.outputs.release_created
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install
- name: Install all npm packages
if: steps.release.outputs.release_created
run: yarn --frozen-lockfile
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -57,14 +57,14 @@ jobs:
# whoami endpoint.
REACT_APP_DISABLE_AUTH: true

# The 'yarn build:prepare' command is going to try to build up a
# The 'npm run build:prepare' command is going to try to build up a
# file for the git history so it can have an index of each files.
# This makes sense in most of the cases where you have a CONTENT_ROOT
# which you'll want to build. But the CONTENT_ROOT can't be empty
# so you have to set it to something. So let's (ab)use the content
# we use for the end-to-end testing.
CONTENT_ROOT: testing/content/files
run: yarn build:prepare
run: npm run build:prepare

- name: Publish
if: steps.release.outputs.release_created
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/npm-published-simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"
cache: npm
cache-dependency-path: "**/package-lock.json"

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install all npm packages
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -55,7 +56,7 @@ jobs:
REACT_APP_DISABLE_AUTH: true
CONTENT_ROOT: testing/content/files
run: |
yarn build:prepare
npm run build:prepare

- name: Build and install tarball
run: |
Expand All @@ -66,25 +67,24 @@ jobs:
ls -lh $TARBALL
mv $TARBALL mdn/content/
cd mdn/content
yarn cache clean --all
yarn add file:$TARBALL
yarn install
npm add file:$TARBALL
npm install

- name: (mdn/content) yarn yari-build --help
- name: (mdn/content) npx yari-build
working-directory: mdn/content
run: yarn yari-build --help
run: npx yari-build --help

- name: (mdn/content) yarn yari-filecheck --help
- name: (mdn/content) npx yari-filecheck
working-directory: mdn/content
run: yarn yari-filecheck --help
run: npx yari-filecheck --help

- name: (mdn/content) yarn yari-tool
- name: (mdn/content) npx yari-tool
working-directory: mdn/content
run: yarn yari-tool --help
run: npx yari-tool --help

- name: (mdn/content) yarn start
- name: (mdn/content) npm run start
working-directory: mdn/content
run: yarn start > /tmp/stdout.log 2> /tmp/stderr.log &
run: npm run start > /tmp/stdout.log 2> /tmp/stderr.log &

- name: View some URLs on localhost:5042
run: |
Expand All @@ -102,12 +102,12 @@ jobs:
# Testing that dev server is not relevant or important in this context.
DEVELOPING_SKIP_DEV_URL: true
run: |
yarn test:developing
npm run test:developing

- name: SSR build a page
working-directory: mdn/content
run: |
yarn build files/en-us/mdn/kitchensink/index.md
npm run build files/en-us/mdn/kitchensink/index.md

- name: Debug server's stdout and stderr if tests failed
if: failure()
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- client/src/**
- .github/workflows/performance.yml
- package.json
- yarn.lock
- package-lock.json

jobs:
lighthouse:
Expand All @@ -28,16 +28,17 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm
cache-dependency-path: "**/package-lock.json"

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install all npm packages
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -52,16 +53,16 @@ jobs:
# Google Analytics tag which is most realistic.
BUILD_GOOGLE_ANALYTICS_MEASUREMENT_ID: G-XXXXXXXX
run: |
yarn build:prepare
# BUILD_FOLDERSEARCH=mdn/kitchensink yarn build:docs
BUILD_FOLDERSEARCH=web/javascript/reference/global_objects/array/foreach yarn build:docs
yarn render:html
npm run build:prepare
# BUILD_FOLDERSEARCH=mdn/kitchensink npm run build:docs
BUILD_FOLDERSEARCH=web/javascript/reference/global_objects/array/foreach npm run build:docs
npm run render:html

- name: Serve and lhci
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
yarn start:static-server &
npm run start:static-server &
sleep 1
curl --retry-connrefused --retry 5 \
http://localhost:5042/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach/ > /dev/null
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/pr-bundlesize-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install all npm packages
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build:client
run: npm run build:client
env:
ANALYZE_BUNDLE_PR: true

Expand All @@ -61,22 +61,22 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock.json') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install all npm packages
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build:client
run: npm run build:client
env:
ANALYZE_BUNDLE_PR: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"
cache: npm

- name: Lint markdown files
run: |
Expand Down
Loading
Loading