Skip to content

Commit e4859dc

Browse files
committed
chore: migrate from yarn to npm
- Replace yarn.lock with package-lock.json - Convert `resolutions` to npm `overrides` in package.json - Drop yarn-deduplicate devDependency and remove it from the `prepare` script - Flip .npmrc to package-lock=true so npm maintains the lockfile - Untrack package-lock.json/yarn-error.log in .gitignore - Switch CI workflows (testing, deploy) and the webpack-persistent-cache action to npm - Update CONTRIBUTING.md to instruct contributors to use npm - Update the module-federation example (lerna npmClient, README) to use npm User-facing webpack documentation in src/content/** still mentions yarn because webpack itself supports yarn / Yarn PnP for end users.
1 parent 775dec0 commit e4859dc

11 files changed

Lines changed: 31574 additions & 15319 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ page please create an issue first.
88

99
Start by ensuring that you have Node.js installed and forking the repository:
1010

11-
- Install [Node.js][1] if you have not already.
12-
- Install [Yarn][13] if you have not already. Yarn is an alternative to npm, and it is required for building the site as we use `yarn` specific features like `resolutions` which are not available in other package managers like `pnpm`.
11+
- Install [Node.js][1] if you have not already. npm ships with Node.js, so no separate package manager installation is required.
1312
- Fork the **webpack.js.org** repo from [the main repository][2].
1413
- `git clone <your-clone-url> && cd webpack.js.org`
1514

@@ -21,18 +20,18 @@ Start by ensuring that you have Node.js installed and forking the repository:
2120
2221
Once you are in the project directory, run the following commands:
2322

24-
- `yarn` to pull all dependencies.
25-
- `GITHUB_TOKEN=<your-token-here> yarn fetch-all` - Fetches all updated website content from GitHub.
26-
- `yarn build` to create a production version of the site.
27-
- `yarn start` to develop on a local webpack-dev-server: [localhost:3000][3].
23+
- `npm install` to pull all dependencies.
24+
- `GITHUB_TOKEN=<your-token-here> npm run fetch-all` - Fetches all updated website content from GitHub.
25+
- `npm run build` to create a production version of the site.
26+
- `npm start` to develop on a local webpack-dev-server: [localhost:3000][3].
2827

2928
**Note:** The `fetch` and `fetch-repos` commands must be run before building the site as they populate necessary data for the build process.
3029

31-
> NOTE: run `yarn fetch-repos` and then `yarn fetch` before running `yarn start` command for the first time
30+
> NOTE: run `npm run fetch-repos` and then `npm run fetch` before running `npm start` command for the first time
3231
33-
- `yarn fetch` to retrieve external documentation/data.
32+
- `npm run fetch` to retrieve external documentation/data.
3433

35-
The final command, `yarn fetch`, is optional as both `yarn build` and `yarn start`
34+
The final command, `npm run fetch`, is optional as both `npm run build` and `npm start`
3635
will do this automatically. This step pulls in documentation for loaders/plugins hosted
3736
in separate repositories such as the ones found in the [webpack-contrib][4] organization.
3837
See the `package.json` for the full list of `scripts`.
@@ -60,13 +59,13 @@ you've [installed the plugin][7] if your text editor needs one.
6059
Run the full test suite (lint + Jest) with:
6160

6261
```bash
63-
yarn test
62+
npm test
6463
```
6564

6665
To run only Jest tests:
6766

6867
```bash
69-
yarn jest
68+
npm run jest
7069
```
7170

7271
To update snapshots after intentional UI changes:
@@ -148,5 +147,4 @@ any time spent fixing typos or clarifying sections in the documentation.
148147
[9]: https://help.github.com/articles/proposing-changes-to-your-work-with-pull-requests/
149148
[10]: http://conventionalcommits.org/
150149
[11]: https://github.com/conventional-changelog/standard-version
151-
[13]: https://yarnpkg.com/lang/en/docs/install
152150
[14]: https://dev.to/matks/what-it-means-to-rebase-a-pull-request-submitted-on-github-5717

.github/actions/webpack-persistent-cache/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313
id: build-webpack-persistent-cache
1414
with:
1515
path: node_modules/.cache
16-
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
16+
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/package-lock.json') }}
1717
restore-keys: |-
18-
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
18+
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/package-lock.json') }}
1919
build-${{ hashFiles('**/webpack.*.mjs') }}-

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ jobs:
2121
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2222
with:
2323
node-version: ${{ matrix.node-version }}
24-
cache: yarn
24+
cache: npm
2525

2626
- name: Enable webpack persistent caching
2727
uses: ./.github/actions/webpack-persistent-cache
2828

29-
- run: yarn --frozen-lockfile
29+
- run: npm ci
3030
- name: Build site
31-
run: yarn build
31+
run: npm run build
3232
env:
3333
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
3434
OPENCOLLECTIVE_API_KEY: ${{secrets.OPENCOLLECTIVE_API_KEY}}
35-
- run: yarn lint:links
35+
- run: npm run lint:links
3636

3737
- name: Deploy
3838
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0

.github/workflows/testing.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2323
with:
2424
node-version: ${{ matrix.node-version }}
25-
cache: yarn
25+
cache: npm
2626

27-
- run: yarn --frozen-lockfile
28-
- run: yarn jest
27+
- run: npm ci
28+
- run: npm run jest
2929

3030
lint:
3131
name: Lint
@@ -41,12 +41,12 @@ jobs:
4141
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
4242
with:
4343
node-version: ${{ matrix.node-version }}
44-
cache: yarn
44+
cache: npm
4545

46-
- run: yarn --frozen-lockfile
47-
- run: yarn lint:js
48-
- run: yarn lint:prettier
49-
- run: yarn lint:markdown
46+
- run: npm ci
47+
- run: npm run lint:js
48+
- run: npm run lint:prettier
49+
- run: npm run lint:markdown
5050

5151
proseLint:
5252
name: Proselint
@@ -62,7 +62,7 @@ jobs:
6262
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
6363
with:
6464
node-version: ${{ matrix.node-version }}
65-
cache: yarn
65+
cache: npm
6666

6767
- name: Install MDX Parser
6868
run: npm install -g mdx2vast
@@ -88,9 +88,9 @@ jobs:
8888
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
8989
with:
9090
node-version: ${{ matrix.node-version }}
91-
cache: yarn
91+
cache: npm
9292

93-
- run: yarn --frozen-lockfile
93+
- run: npm ci
9494

9595
- name: Enable webpack persistent caching
9696
uses: ./.github/actions/webpack-persistent-cache
@@ -100,10 +100,10 @@ jobs:
100100
with:
101101
browser: chrome
102102
config-file: cypress.config.js
103-
build: yarn build
104-
start: yarn serve-dist
105-
command: yarn cypress:run
103+
build: npm run build
104+
start: npm run serve-dist
105+
command: npm run cypress:run
106106
env:
107107
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
108108

109-
- run: yarn lint:links
109+
- run: npm run lint:links

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ src/content/contribute/Governance-*.mdx
99
.idea
1010
.DS_Store
1111
npm-debug.log
12-
yarn-error.log
13-
package-lock.json
1412
.cache
1513
internal-links.tap
1614
stats.json

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package-lock=false
1+
package-lock=true

examples/module-federation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Run the following commands in the root directory.
66

77
```bash
8-
yarn
9-
yarn start
8+
npm install
9+
npm start
1010
```
1111

1212
Both `app1` and `app2` are independently deployed apps:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"version": "1.0.0",
3-
"npmClient": "yarn",
3+
"npmClient": "npm",
44
"useWorkspaces": true
55
}

0 commit comments

Comments
 (0)