Skip to content

Commit

Permalink
Migrate to pnpm (#2545)
Browse files Browse the repository at this point in the history
* migrate to pnpm

* some fixes

* simplify

* some more adjustments
  • Loading branch information
dai-shi committed May 12, 2024
1 parent 9d24d11 commit 6d63830
Show file tree
Hide file tree
Showing 15 changed files with 8,296 additions and 7,233 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Fixes #

## Check List

- [ ] `yarn run prettier` for formatting code and docs
- [ ] `pnpm run prettier` for formatting code and docs
12 changes: 9 additions & 3 deletions .github/workflows/compressed-size-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
- uses: actions/setup-node@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- uses: preactjs/compressed-size-action@v2
25 changes: 12 additions & 13 deletions .github/workflows/lint-and-type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
node-version: '18'
cache: yarn
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: yarn install --frozen-lockfile --check-files
- run: cd examples/demo && yarn install --frozen-lockfile --check-files
- name: Prettier
run: yarn prettier:ci
- name: Lint
run: yarn eslint:ci
- name: Type
run: yarn pretest
version: 8.2.0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: pnpm test:format
- run: pnpm test:types
- run: pnpm test:lint
21 changes: 12 additions & 9 deletions .github/workflows/test-multiple-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ jobs:
build: [cjs, esm, umd]
env: [development, production]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
node-version: '18'
cache: yarn
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: yarn install --frozen-lockfile --check-files
- run: yarn build
version: 8.2.0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Use React 17 for production test
if: ${{ matrix.env == 'production' }}
run: |
yarn add -D react@17.0.2 react-dom@17.0.2 @testing-library/react@12.1.4
pnpm add -D react@17.0.2 react-dom@17.0.2 @testing-library/react@12.1.4
- name: Patch for DEV-ONLY
if: ${{ matrix.env == 'development' }}
run: |
Expand Down Expand Up @@ -63,6 +66,6 @@ jobs:
NODE_ENV: ${{ matrix.env }}
- name: Test ${{ matrix.build }} ${{ matrix.env }}
run: |
yarn test:ci
pnpm test:spec
env:
NODE_ENV: ${{ matrix.env }}
42 changes: 23 additions & 19 deletions .github/workflows/test-multiple-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
node-version: '18'
cache: yarn
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: yarn install --frozen-lockfile --check-files
- name: Test Build # we don't have any other workflows to test build
run: yarn build
- name: Test Default
run: yarn test:ci
version: 8.2.0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: pnpm build # we don't have any other workflows to test build
- run: pnpm test:spec

test_matrix:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,16 +53,19 @@ jobs:
- devtools-skip: CI-MATRIX-NOSKIP
react: 16.8.0
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: yarn install --frozen-lockfile --check-files
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- name: Install legacy testing-library
if: ${{ startsWith(matrix.react, '16.') || startsWith(matrix.react, '17.') }}
run: yarn add -D @testing-library/react@12.1.4
run: pnpm add -D @testing-library/react@12.1.4
- name: Patch for React 16
if: ${{ startsWith(matrix.react, '16.') }}
run: |
Expand All @@ -73,5 +77,5 @@ jobs:
DEVTOOLS_SKIP: ${{ matrix.devtools-skip }}
- name: Test ${{ matrix.react }} ${{ matrix.devtools-skip }}
run: |
yarn add -D react@${{ matrix.react }} react-dom@${{ matrix.react }}
yarn test:ci
pnpm add -D react@${{ matrix.react }} react-dom@${{ matrix.react }}
pnpm test:spec
38 changes: 15 additions & 23 deletions .github/workflows/test-old-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ jobs:
- 4.2.3
- 4.1.5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
node-version: '18'
cache: yarn
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: yarn install --frozen-lockfile --check-files
- run: yarn build
version: 8.2.0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Patch for Old TS
run: |
sed -i~ 's/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//' tests/*.tsx
Expand All @@ -46,24 +49,13 @@ jobs:
sed -i~ 's/"zustand": \["\.\/src\/index\.ts"\],/"zustand": [".\/dist\/index.d.ts"],/' tsconfig.json
sed -i~ 's/"zustand\/\*": \["\.\/src\/\*\.ts"\]/"zustand\/*": [".\/dist\/*.d.ts"]/' tsconfig.json
sed -i~ 's/"include": .*/"include": ["src\/types.d.ts", "dist\/**\/*", "tests\/**\/*"],/' tsconfig.json
yarn json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/node']='18.13.0';"
yarn add -D @types/node@18.13.0
pnpm json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/node']='18.13.0';"
pnpm add -D @types/node@18.13.0
- name: Install old TypeScript
run: yarn add -D typescript@${{ matrix.typescript }}
run: pnpm add -D typescript@${{ matrix.typescript }}
- name: Patch testing setup for Old TS
if: ${{ matrix.typescript == '4.4.4' || matrix.typescript == '4.3.5' || matrix.typescript == '4.2.3' || matrix.typescript == '4.1.5' }}
run: |
rm node_modules/@vitest/expect/dist/*.d.ts
echo "declare module '@vitest/expect'" >> ./src/types.d.ts
rm node_modules/@vitest/runner/dist/*.d.ts
echo "declare module '@vitest/runner'" >> ./src/types.d.ts
rm node_modules/@vitest/spy/dist/*.d.ts
echo "declare module '@vitest/spy'" >> ./src/types.d.ts
rm node_modules/@vitest/utils/dist/*.d.ts
echo "declare module '@vitest/utils'" >> ./src/types.d.ts
rm node_modules/vite-node/dist/*.d.ts
echo "declare module 'vite-node'" >> ./src/types.d.ts
rm node_modules/vitest/dist/*.d.ts
echo "declare module 'vitest'" >> ./src/types.d.ts
pnpm add -D vitest@0.33.0 @vitest/coverage-v8@0.33.0 @vitest/ui@0.33.0
- name: Test ${{ matrix.typescript }}
run: yarn tsc --noEmit
run: pnpm test:types
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ $RECYCLE.BIN/
.DS_Store
.vscode
.docz/
package-lock.json
pnpm-lock.yaml
coverage/
.rpt2_cache/
.idea
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@ you can use this suggested workflow:

- Fork this repository;
- Create a new feature branch based on the `main` branch;
- Install dependencies by running `yarn`
([version 1](https://classic.yarnpkg.com/lang/en/docs/install));
- Install dependencies by running `pnpm`;
- Create failing tests for your fix or new feature;
- Implement your changes and confirm that all test are passing.
You can run the tests continuously during development
with the `yarn test` command.
with the `pnpm test` command.
- If you want to test it in a React project:
- Either use `yarn link`, or
- Either use `pnpm link`, or
- Use the `yalc` package.
- Commit your changes (see the [committing guidelines]).
- Submit a PR for review.
Expand Down
2 changes: 2 additions & 0 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"packageManager": "pnpm@8.15.0",
"dependencies": {
"@react-three/drei": "^9.78.2",
"@react-three/fiber": "^8.13.7",
"@react-three/postprocessing": "^2.14.13",
"@types/three": "^0.155.0",
"meshline": "^3.1.6",
"postprocessing": "^6.35.4",
"prism-react-renderer": "^2.0.6",
"prismjs": "^1.29.0",
"react": "^18.2.0",
Expand Down

0 comments on commit 6d63830

Please sign in to comment.