Skip to content

Commit 1cc61f1

Browse files
authored
chore: use pnpm (#1542)
* chore: migrate to pnpm * chore: remove smoke tests * chore: fix "auto-update-worker" integration test
1 parent 049f21d commit 1cc61f1

File tree

10 files changed

+10488
-10755
lines changed

10 files changed

+10488
-10755
lines changed

.github/workflows/ci.yml

+17-11
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ jobs:
2020
uses: actions/setup-node@v3
2121
with:
2222
node-version: 16
23-
cache: yarn
23+
24+
- uses: pnpm/action-setup@v2
25+
with:
26+
version: 7.12
2427

2528
- name: Install dependencies
26-
run: yarn install --frozen-lockfile
29+
run: pnpm install --frozen-lockfile
2730

2831
- name: Unit tests
29-
run: yarn test:unit
32+
run: pnpm test:unit
3033

3134
- name: Build
32-
run: yarn build
35+
run: pnpm build
3336

3437
- name: Integration tests
35-
run: yarn test:integration
38+
run: pnpm test:integration
3639

3740
# Checks the library's compatibility with different
3841
# TypeScript versions to discover type regressions.
@@ -53,18 +56,21 @@ jobs:
5356
uses: actions/setup-node@v3
5457
with:
5558
node-version: 16
56-
cache: yarn
59+
60+
- uses: pnpm/action-setup@v2
61+
with:
62+
version: 7.12
5763

5864
- name: Install dependencies
59-
run: yarn install --frozen-lockfile
65+
run: pnpm install
6066

6167
- name: Install TypeScript ${{ matrix.ts }}
62-
run: yarn add typescript@${{ matrix.ts }}
68+
run: pnpm add typescript@${{ matrix.ts }}
6369

6470
- name: Build
65-
run: yarn build
71+
run: pnpm build
6672

6773
- name: Typings tests
6874
run: |
69-
yarn tsc --version
70-
yarn test:ts
75+
pnpm tsc --version
76+
pnpm test:ts

.github/workflows/release.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,27 @@ jobs:
2020
with:
2121
node-version: 16
2222
always-auth: true
23-
cache: yarn
23+
24+
- uses: pnpm/action-setup@v2
25+
with:
26+
version: 7.12
2427

2528
- name: Setup Git
2629
run: |
2730
git config --local user.name "Artem Zakharchenko"
2831
git config --local user.email "kettanaito@gmail.com"
2932
3033
- name: Install dependencies
31-
run: yarn install --frozen-lockfile
34+
run: pnpm install
3235

3336
- name: Build
34-
run: yarn build
37+
run: pnpm build
3538

3639
- name: Tests
37-
run: yarn test
40+
run: pnpm test
3841

3942
- name: Release
40-
run: yarn release
43+
run: pnpm release
4144
env:
4245
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }}
4346
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/smoke.yml

-30
This file was deleted.

CONTRIBUTING.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ Please use the GitHub UI to [fork this repository](https://github.com/mswjs/msw)
3232

3333
```bash
3434
$ cd msw
35-
$ yarn install
36-
$ yarn start
35+
$ pnpm install
36+
$ pnpm start
3737
```
3838

39-
> Please use [Yarn][yarn-url] while working on this project.
39+
> Please use [PNPM][pnpm-url] while working on this project.
4040
4141
## Git workflow
4242

@@ -104,22 +104,22 @@ test('multiplies two given numbers', () => {
104104
Once your test is written, run it in isolation.
105105

106106
```bash
107-
$ yarn test:unit src/utils/multiply.test.ts
107+
$ pnpm test:unit src/utils/multiply.test.ts
108108
```
109109

110110
At this point, the actual implementation is not ready yet, so you can expect your test to fail. **That's perfect**. Add the necessary modules and logic, and gradually see your test cases pass.
111111

112112
#### Running all unit tests
113113

114114
```bash
115-
$ yarn test:unit
115+
$ pnpm test:unit
116116
```
117117

118118
### Integration tests
119119

120120
We follow an example-driven testing paradigm, meaning that each integration test represents a _usage example_. Mock Service Worker can be used in different environments (browser, Node.js), making such usage examples different.
121121

122-
> **Make sure that you [build the library](#build) before running the integration tests**. It's a good idea to keep the build running (`yarn start`) while working on the tests. Keeping both compiler and test runner in watch mode boosts your productivity.
122+
> **Make sure that you [build the library](#build) before running the integration tests**. It's a good idea to keep the build running (`pnpm start`) while working on the tests. Keeping both compiler and test runner in watch mode boosts your productivity.
123123
124124
#### Browser integration tests
125125

@@ -227,23 +227,23 @@ test('returns a mocked response', async () => {
227227
#### Running all integration tests
228228

229229
```bash
230-
$ yarn test:integration
230+
$ pnpm test:integration
231231
```
232232

233233
#### Running a single integration test
234234

235235
```bash
236-
$ yarn test:integration test/rest-api/basic.test.ts
236+
$ pnpm test:integration test/rest-api/basic.test.ts
237237
```
238238

239239
## Build
240240

241241
Build the library with the following command:
242242

243243
```bash
244-
$ yarn build
244+
$ pnpm build
245245
```
246246

247-
[yarn-url]: https://classic.yarnpkg.com/en/
247+
[pnpm-url]: https://pnpm.io/
248248
[jest-url]: https://jestjs.io
249249
[page-with-url]: https://github.com/kettanaito/page-with

config/scripts/smoke.sh

-74
This file was deleted.

ossjs.release.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
script: 'yarn publish --new-version $RELEASE_VERSION',
2+
script: 'pnpm publish --no-git-checks',
33
}

package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@
3030
"clean": "rimraf ./lib",
3131
"lint": "eslint \"{cli,config,src,test}/**/*.ts\"",
3232
"build": "cross-env NODE_ENV=production tsup",
33-
"test": "yarn test:unit && yarn test:integration",
33+
"test": "pnpm test:unit && pnpm test:integration",
3434
"test:unit": "cross-env BABEL_ENV=test jest --maxWorkers=3",
3535
"test:integration": "jest --config=./test/jest.config.js --maxWorkers=1",
36-
"test:smoke": "./config/scripts/smoke.sh",
3736
"test:ts": "ts-node test/typings/run.ts",
38-
"prepare": "yarn simple-git-hooks init",
39-
"prepack": "yarn build",
37+
"prepare": "pnpm simple-git-hooks init",
38+
"prepack": "pnpm build",
4039
"release": "release publish",
4140
"postinstall": "node -e \"try{require('./config/scripts/postinstall')}catch(e){}\""
4241
},
@@ -169,8 +168,8 @@
169168
}
170169
},
171170
"simple-git-hooks": {
172-
"pre-commit": "yarn lint-staged",
173-
"prepare-commit-msg": "grep -qE '^[^#]' .git/COMMIT_EDITMSG || (exec < /dev/tty && yarn cz --hook || true)",
174-
"commit-msg": "yarn commitlint --edit $1"
171+
"pre-commit": "pnpm lint-staged",
172+
"prepare-commit-msg": "grep -qE '^[^#]' .git/COMMIT_EDITMSG || (exec < /dev/tty && pnpm cz --hook || true)",
173+
"commit-msg": "pnpm commitlint --edit $1"
175174
}
176175
}

0 commit comments

Comments
 (0)