mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
Migrate to pnpm (#2545)
* migrate to pnpm * some fixes * simplify * some more adjustments
This commit is contained in:
parent
9d24d11e1e
commit
6d6383054f
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@ -8,4 +8,4 @@ Fixes #
|
||||
|
||||
## Check List
|
||||
|
||||
- [ ] `yarn run prettier` for formatting code and docs
|
||||
- [ ] `pnpm run prettier` for formatting code and docs
|
||||
|
||||
12
.github/workflows/compressed-size-action.yml
vendored
12
.github/workflows/compressed-size-action.yml
vendored
@ -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:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
version: 8.2.0
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: '**/pnpm-lock.yaml'
|
||||
- uses: preactjs/compressed-size-action@v2
|
||||
|
||||
25
.github/workflows/lint-and-type.yml
vendored
25
.github/workflows/lint-and-type.yml
vendored
@ -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
.github/workflows/test-multiple-builds.yml
vendored
21
.github/workflows/test-multiple-builds.yml
vendored
@ -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: |
|
||||
@ -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
.github/workflows/test-multiple-versions.yml
vendored
42
.github/workflows/test-multiple-versions.yml
vendored
@ -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
|
||||
@ -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:
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
- run: yarn install --frozen-lockfile --check-files
|
||||
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
|
||||
- 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: |
|
||||
@ -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
.github/workflows/test-old-typescript.yml
vendored
38
.github/workflows/test-old-typescript.yml
vendored
@ -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
|
||||
@ -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
.gitignore
vendored
2
.gitignore
vendored
@ -7,8 +7,6 @@ $RECYCLE.BIN/
|
||||
.DS_Store
|
||||
.vscode
|
||||
.docz/
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
coverage/
|
||||
.rpt2_cache/
|
||||
.idea
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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",
|
||||
|
||||
2716
examples/demo/pnpm-lock.yaml
generated
Normal file
2716
examples/demo/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "zustand",
|
||||
"private": true,
|
||||
"version": "4.5.2",
|
||||
"description": "🐻 Bear necessities for state management in React",
|
||||
"private": true,
|
||||
"type": "commonjs",
|
||||
"version": "4.5.2",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
"typesVersions": {
|
||||
@ -150,7 +151,7 @@
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prebuild": "shx rm -rf dist",
|
||||
"build": "concurrently -m 8 'yarn:build:*'",
|
||||
"build": "pnpm run prebuild && pnpm run '/^build:.*/' && pnpm run postbuild",
|
||||
"build:base": "rollup -c",
|
||||
"build:vanilla": "rollup -c --config-vanilla",
|
||||
"build:middleware": "rollup -c --config-middleware",
|
||||
@ -160,14 +161,14 @@
|
||||
"build:react:shallow": "rollup -c --config-react_shallow",
|
||||
"build:traditional": "rollup -c --config-traditional",
|
||||
"build:context": "rollup -c --config-context",
|
||||
"postbuild": "yarn patch-d-ts && yarn copy && yarn patch-esm-ts",
|
||||
"postbuild": "pnpm patch-d-ts && pnpm copy && pnpm patch-esm-ts",
|
||||
"prettier": "prettier \"*.{js,json,md}\" \"{examples,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}\" --write",
|
||||
"prettier:ci": "prettier '*.{js,json,md}' '{examples,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}' --list-different",
|
||||
"eslint": "eslint --no-eslintrc --c .eslintrc.json --fix '*.{js,json,ts}' '{src,tests}/**/*.{ts,tsx}'",
|
||||
"eslint:ci": "eslint --no-eslintrc --c .eslintrc.json '*.{js,json,ts}' '{src,tests}/**/*.{ts,tsx}'",
|
||||
"pretest": "tsc",
|
||||
"test": "vitest --ui --coverage",
|
||||
"test:ci": "vitest",
|
||||
"test": "pnpm run '/^test:.*/'",
|
||||
"test:format": "prettier '*.{js,json,md}' '{examples,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}' --list-different",
|
||||
"test:types": "tsc --noEmit",
|
||||
"test:lint": "eslint --no-eslintrc --c .eslintrc.json '*.{js,json,ts}' '{src,tests}/**/*.{ts,tsx}'",
|
||||
"test:spec": "vitest",
|
||||
"patch-d-ts": "node -e \"var {entries}=require('./rollup.config.js');require('shelljs').find('dist/**/*.d.ts').forEach(f=>{entries.forEach(({find,replacement})=>require('shelljs').sed('-i',new RegExp(' from \\''+find.source.slice(0,-1)+'\\';$'),' from \\''+replacement+'\\';',f));require('shelljs').sed('-i',/ from '(\\.[^']+)\\.ts';$/,' from \\'\\$1\\';',f)})\"",
|
||||
"copy": "shx cp -r dist/src/* dist/esm && shx cp -r dist/src/* dist && shx rm -rf dist/src && shx rm -rf dist/{src,tests} && downlevel-dts dist dist/ts3.4 && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined;\"",
|
||||
"patch-esm-ts": "node -e \"require('shelljs').find('dist/esm/**/*.d.ts').forEach(f=>{var f2=f.replace(/\\.ts$/,'.mts');require('fs').copyFileSync(f,f2);require('shelljs').sed('-i',/ from '(\\.[^']+)';$/,' from \\'\\$1.mjs\\';',f2);require('shelljs').sed('-i',/^declare module '(\\.[^']+)'/,'declare module \\'\\$1.mjs\\'',f2)})\""
|
||||
@ -201,6 +202,7 @@
|
||||
"url": "https://github.com/pmndrs/zustand/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pmndrs/zustand",
|
||||
"packageManager": "pnpm@8.15.0",
|
||||
"dependencies": {
|
||||
"use-sync-external-store": "1.2.0"
|
||||
},
|
||||
@ -227,7 +229,6 @@
|
||||
"@typescript-eslint/parser": "^7.1.0",
|
||||
"@vitest/coverage-v8": "^1.4.0",
|
||||
"@vitest/ui": "^1.4.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"downlevel-dts": "^0.11.0",
|
||||
"esbuild": "^0.20.1",
|
||||
"eslint": "^8.57.0",
|
||||
@ -247,6 +248,7 @@
|
||||
"redux": "^5.0.1",
|
||||
"rollup": "^4.12.0",
|
||||
"rollup-plugin-esbuild": "^6.1.1",
|
||||
"shelljs": "^0.8.5",
|
||||
"shx": "^0.3.4",
|
||||
"typescript": "^5.3.3",
|
||||
"vitest": "^1.4.0"
|
||||
@ -266,6 +268,5 @@
|
||||
"react": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@1.22.21+sha256.dbed5b7e10c552ba0e1a545c948d5473bc6c5a28ce22a8fd27e493e3e5eb6370"
|
||||
}
|
||||
}
|
||||
|
||||
5490
pnpm-lock.yaml
generated
Normal file
5490
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ Don't disregard it because it's cute. It has quite the claws, lots of time was s
|
||||
You can try a live demo [here](https://githubbox.com/pmndrs/zustand/tree/main/examples/demo).
|
||||
|
||||
```bash
|
||||
npm install zustand # or yarn add zustand or pnpm add zustand
|
||||
npm i zustand
|
||||
```
|
||||
|
||||
:warning: This readme is written for JavaScript users. If you are a TypeScript user, be sure to check out our [TypeScript Usage section](#typescript-usage).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user