Skip to content

Commit 6d63830

Browse files
authored
Migrate to pnpm (#2545)
* migrate to pnpm * some fixes * simplify * some more adjustments
1 parent 9d24d11 commit 6d63830

15 files changed

+8296
-7233
lines changed

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Fixes #
88

99
## Check List
1010

11-
- [ ] `yarn run prettier` for formatting code and docs
11+
- [ ] `pnpm run prettier` for formatting code and docs

.github/workflows/compressed-size-action.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: preactjs/compressed-size-action@v2
11+
- uses: actions/checkout@v3
12+
- uses: pnpm/action-setup@v2
13+
with:
14+
version: 8.2.0
15+
- uses: actions/setup-node@v3
1316
with:
14-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
17+
node-version: 18
18+
cache: 'pnpm'
19+
cache-dependency-path: '**/pnpm-lock.yaml'
20+
- uses: preactjs/compressed-size-action@v2

.github/workflows/lint-and-type.yml

+12-13
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v2
13+
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2
1515
with:
16-
node-version: '18'
17-
cache: yarn
18-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
19-
- run: yarn install --frozen-lockfile --check-files
20-
- run: cd examples/demo && yarn install --frozen-lockfile --check-files
21-
- name: Prettier
22-
run: yarn prettier:ci
23-
- name: Lint
24-
run: yarn eslint:ci
25-
- name: Type
26-
run: yarn pretest
16+
version: 8.2.0
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
cache: 'pnpm'
21+
cache-dependency-path: '**/pnpm-lock.yaml'
22+
- run: pnpm install --frozen-lockfile
23+
- run: pnpm test:format
24+
- run: pnpm test:types
25+
- run: pnpm test:lint

.github/workflows/test-multiple-builds.yml

+12-9
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@ jobs:
1515
build: [cjs, esm, umd]
1616
env: [development, production]
1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-node@v2
18+
- uses: actions/checkout@v3
19+
- uses: pnpm/action-setup@v2
2020
with:
21-
node-version: '18'
22-
cache: yarn
23-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
24-
- run: yarn install --frozen-lockfile --check-files
25-
- run: yarn build
21+
version: 8.2.0
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
cache: 'pnpm'
26+
cache-dependency-path: '**/pnpm-lock.yaml'
27+
- run: pnpm install --frozen-lockfile
28+
- run: pnpm build
2629
- name: Use React 17 for production test
2730
if: ${{ matrix.env == 'production' }}
2831
run: |
29-
32+
3033
- name: Patch for DEV-ONLY
3134
if: ${{ matrix.env == 'development' }}
3235
run: |
@@ -63,6 +66,6 @@ jobs:
6366
NODE_ENV: ${{ matrix.env }}
6467
- name: Test ${{ matrix.build }} ${{ matrix.env }}
6568
run: |
66-
yarn test:ci
69+
pnpm test:spec
6770
env:
6871
NODE_ENV: ${{ matrix.env }}

.github/workflows/test-multiple-versions.yml

+23-19
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v2
13+
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2
1515
with:
16-
node-version: '18'
17-
cache: yarn
18-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
19-
- run: yarn install --frozen-lockfile --check-files
20-
- name: Test Build # we don't have any other workflows to test build
21-
run: yarn build
22-
- name: Test Default
23-
run: yarn test:ci
16+
version: 8.2.0
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
cache: 'pnpm'
21+
cache-dependency-path: '**/pnpm-lock.yaml'
22+
- run: pnpm install --frozen-lockfile
23+
- run: pnpm build # we don't have any other workflows to test build
24+
- run: pnpm test:spec
2425

2526
test_matrix:
2627
runs-on: ubuntu-latest
@@ -52,16 +53,19 @@ jobs:
5253
- devtools-skip: CI-MATRIX-NOSKIP
5354
react: 16.8.0
5455
steps:
55-
- uses: actions/checkout@v2
56-
- uses: actions/setup-node@v2
56+
- uses: actions/checkout@v3
57+
- uses: pnpm/action-setup@v2
58+
with:
59+
version: 8.2.0
60+
- uses: actions/setup-node@v3
5761
with:
58-
node-version: '18'
59-
cache: yarn
60-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
61-
- run: yarn install --frozen-lockfile --check-files
62+
node-version: 18
63+
cache: 'pnpm'
64+
cache-dependency-path: '**/pnpm-lock.yaml'
65+
- run: pnpm install --frozen-lockfile
6266
- name: Install legacy testing-library
6367
if: ${{ startsWith(matrix.react, '16.') || startsWith(matrix.react, '17.') }}
64-
run: yarn add -D @testing-library/[email protected]
68+
run: pnpm add -D @testing-library/[email protected]
6569
- name: Patch for React 16
6670
if: ${{ startsWith(matrix.react, '16.') }}
6771
run: |
@@ -73,5 +77,5 @@ jobs:
7377
DEVTOOLS_SKIP: ${{ matrix.devtools-skip }}
7478
- name: Test ${{ matrix.react }} ${{ matrix.devtools-skip }}
7579
run: |
76-
yarn add -D react@${{ matrix.react }} react-dom@${{ matrix.react }}
77-
yarn test:ci
80+
pnpm add -D react@${{ matrix.react }} react-dom@${{ matrix.react }}
81+
pnpm test:spec

.github/workflows/test-old-typescript.yml

+15-23
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ jobs:
2828
- 4.2.3
2929
- 4.1.5
3030
steps:
31-
- uses: actions/checkout@v2
32-
- uses: actions/setup-node@v2
31+
- uses: actions/checkout@v3
32+
- uses: pnpm/action-setup@v2
3333
with:
34-
node-version: '18'
35-
cache: yarn
36-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
37-
- run: yarn install --frozen-lockfile --check-files
38-
- run: yarn build
34+
version: 8.2.0
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: 18
38+
cache: 'pnpm'
39+
cache-dependency-path: '**/pnpm-lock.yaml'
40+
- run: pnpm install --frozen-lockfile
41+
- run: pnpm build
3942
- name: Patch for Old TS
4043
run: |
4144
sed -i~ 's/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//' tests/*.tsx
@@ -46,24 +49,13 @@ jobs:
4649
sed -i~ 's/"zustand": \["\.\/src\/index\.ts"\],/"zustand": [".\/dist\/index.d.ts"],/' tsconfig.json
4750
sed -i~ 's/"zustand\/\*": \["\.\/src\/\*\.ts"\]/"zustand\/*": [".\/dist\/*.d.ts"]/' tsconfig.json
4851
sed -i~ 's/"include": .*/"include": ["src\/types.d.ts", "dist\/**\/*", "tests\/**\/*"],/' tsconfig.json
49-
yarn json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/node']='18.13.0';"
50-
yarn add -D @types/[email protected]
52+
pnpm json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/node']='18.13.0';"
53+
pnpm add -D @types/[email protected]
5154
- name: Install old TypeScript
52-
run: yarn add -D typescript@${{ matrix.typescript }}
55+
run: pnpm add -D typescript@${{ matrix.typescript }}
5356
- name: Patch testing setup for Old TS
5457
if: ${{ matrix.typescript == '4.4.4' || matrix.typescript == '4.3.5' || matrix.typescript == '4.2.3' || matrix.typescript == '4.1.5' }}
5558
run: |
56-
rm node_modules/@vitest/expect/dist/*.d.ts
57-
echo "declare module '@vitest/expect'" >> ./src/types.d.ts
58-
rm node_modules/@vitest/runner/dist/*.d.ts
59-
echo "declare module '@vitest/runner'" >> ./src/types.d.ts
60-
rm node_modules/@vitest/spy/dist/*.d.ts
61-
echo "declare module '@vitest/spy'" >> ./src/types.d.ts
62-
rm node_modules/@vitest/utils/dist/*.d.ts
63-
echo "declare module '@vitest/utils'" >> ./src/types.d.ts
64-
rm node_modules/vite-node/dist/*.d.ts
65-
echo "declare module 'vite-node'" >> ./src/types.d.ts
66-
rm node_modules/vitest/dist/*.d.ts
67-
echo "declare module 'vitest'" >> ./src/types.d.ts
59+
6860
- name: Test ${{ matrix.typescript }}
69-
run: yarn tsc --noEmit
61+
run: pnpm test:types

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ $RECYCLE.BIN/
77
.DS_Store
88
.vscode
99
.docz/
10-
package-lock.json
11-
pnpm-lock.yaml
1210
coverage/
1311
.rpt2_cache/
1412
.idea

CONTRIBUTING.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,13 @@ you can use this suggested workflow:
6565

6666
- Fork this repository;
6767
- Create a new feature branch based on the `main` branch;
68-
- Install dependencies by running `yarn`
69-
([version 1](https://classic.yarnpkg.com/lang/en/docs/install));
68+
- Install dependencies by running `pnpm`;
7069
- Create failing tests for your fix or new feature;
7170
- Implement your changes and confirm that all test are passing.
7271
You can run the tests continuously during development
73-
with the `yarn test` command.
72+
with the `pnpm test` command.
7473
- If you want to test it in a React project:
75-
- Either use `yarn link`, or
74+
- Either use `pnpm link`, or
7675
- Use the `yalc` package.
7776
- Commit your changes (see the [committing guidelines]).
7877
- Submit a PR for review.

examples/demo/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
1010
"preview": "vite preview"
1111
},
12+
"packageManager": "[email protected]",
1213
"dependencies": {
1314
"@react-three/drei": "^9.78.2",
1415
"@react-three/fiber": "^8.13.7",
1516
"@react-three/postprocessing": "^2.14.13",
1617
"@types/three": "^0.155.0",
1718
"meshline": "^3.1.6",
19+
"postprocessing": "^6.35.4",
1820
"prism-react-renderer": "^2.0.6",
1921
"prismjs": "^1.29.0",
2022
"react": "^18.2.0",

0 commit comments

Comments
 (0)