-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* migrate to pnpm * wip: fix some * add typed-macro * hack path * wip: some fixes * wip: some fixes * wip: some more fixes * ignore type error * ignore with any * Revert "ignore with any" This reverts commit eb8dae0. * add types/unist * Revert "Revert "ignore with any"" This reverts commit 190f9d8.
- Loading branch information
Showing
14 changed files
with
15,359 additions
and
9,713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,18 +15,21 @@ jobs: | |
build: [cjs, esm] | ||
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 [email protected] [email protected] @testing-library/[email protected] | ||
pnpm add -D [email protected] [email protected] @testing-library/[email protected] | ||
- name: Patch for DEV-ONLY | ||
if: ${{ matrix.env == 'development' }} | ||
run: | | ||
|
@@ -41,7 +44,7 @@ jobs: | |
if: ${{ matrix.build == 'cjs' }} | ||
run: | | ||
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\1.js')/" vitest.config.ts | ||
sed -i~ "s/\"valtio\/vanilla\"/\"..\/..\/..\/dist\/vanilla.js\"/" node_modules/derive-valtio/dist/index.umd.js | ||
sed -i~ "s/\"valtio\/vanilla\"/\"..\/..\/..\/..\/..\/..\/dist\/vanilla.js\"/" node_modules/derive-valtio/dist/index.umd.js | ||
- name: Patch for ESM | ||
if: ${{ matrix.build == 'esm' }} | ||
run: | | ||
|
@@ -53,7 +56,7 @@ jobs: | |
if: ${{ matrix.build == 'umd' }} | ||
run: | | ||
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/umd\1.${NODE_ENV}.js')/" vitest.config.ts | ||
sed -i~ "s/\"valtio\/vanilla\"/\"..\/..\/..\/dist\/umd\/vanilla.${NODE_ENV}.js\"/" node_modules/derive-valtio/dist/index.umd.js | ||
sed -i~ "s/\"valtio\/vanilla\"/\"..\/..\/..\/..\/..\/..\/dist\/umd\/vanilla.${NODE_ENV}.js\"/" node_modules/derive-valtio/dist/index.umd.js | ||
env: | ||
NODE_ENV: ${{ matrix.env }} | ||
- name: Patch for SystemJS | ||
|
@@ -64,6 +67,6 @@ jobs: | |
NODE_ENV: ${{ matrix.env }} | ||
- name: Test ${{ matrix.build }} ${{ matrix.env }} | ||
run: | | ||
yarn test:ci | ||
pnpm test:spec | ||
env: | ||
NODE_ENV: ${{ matrix.env }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +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 | ||
- 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 | ||
|
@@ -37,17 +39,20 @@ jobs: | |
- 19.0.0-beta-1beb73de0f-20240503 | ||
- 0.0.0-experimental-1beb73de0f-20240503 | ||
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 | ||
- run: yarn build | ||
node-version: 18 | ||
cache: 'pnpm' | ||
cache-dependency-path: '**/pnpm-lock.yaml' | ||
- run: pnpm install --frozen-lockfile | ||
- run: pnpm build # for macro test | ||
- name: Install legacy testing-library | ||
if: ${{ startsWith(matrix.react, '16.') || startsWith(matrix.react, '17.') }} | ||
run: yarn add -D @testing-library/[email protected] | ||
run: pnpm add -D @testing-library/[email protected] | ||
- name: Patch for React 16 | ||
if: ${{ startsWith(matrix.react, '16.') }} | ||
run: | | ||
|
@@ -56,5 +61,5 @@ jobs: | |
sed -i~ 's/import\.meta\.env[?]\.MODE/"DEVELOPMENT".toLowerCase()/' src/*.ts src/*/*.ts src/*/*/*.ts | ||
- name: Test ${{ matrix.react }} | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,14 +32,17 @@ jobs: | |
- 3.8.3 | ||
- 3.7.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 | ||
|
@@ -57,36 +60,24 @@ jobs: | |
sed -i~ '1s/^/import React from "react";/' tests/*.tsx | ||
sed -i~ 's/"jsx": "react-jsx"/"jsx": "react"/' tsconfig.json | ||
sed -i~ 's/"noUncheckedIndexedAccess": true,//' tsconfig.json | ||
yarn json -I -f package.json -e "this.resolutions={}; this.resolutions['pretty-format']='25.5.0'; this.resolutions['@types/prettier']='2.4.2'; this.resolutions['@types/yargs']='17.0.13'; this.resolutions['@types/node']='18.11.18';" | ||
yarn add -D [email protected] @types/[email protected] @types/[email protected] @types/[email protected] @types/[email protected] | ||
pnpm json -I -f package.json -e "this.resolutions={}; this.resolutions['pretty-format']='25.5.0'; this.resolutions['@types/prettier']='2.4.2'; this.resolutions['@types/yargs']='17.0.13'; this.resolutions['@types/node']='18.11.18';" | ||
pnpm add -D [email protected] @types/[email protected] @types/[email protected] @types/[email protected] @types/[email protected] | ||
rm -r tests/macro-vite.* | ||
- name: Install old TypeScript | ||
run: | | ||
yarn add -D typescript@${{ matrix.typescript }} | ||
rm node_modules/parse5/dist/*.d.ts | ||
pnpm add -D typescript@${{ matrix.typescript }} | ||
rm node_modules/.pnpm/parse5@*/node_modules/parse5/dist/*.d.ts | ||
- 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' || matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} | ||
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 [email protected] @vitest/[email protected] @vitest/[email protected] | ||
- name: Patch testing setup for older TS | ||
if: ${{ matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} | ||
run: | | ||
yarn add -D @testing-library/[email protected] @testing-library/[email protected] | ||
pnpm add -D @testing-library/[email protected] @testing-library/[email protected] | ||
rm node_modules/vitest/dist/*.d.ts | ||
rm node_modules/parse5/dist/*.d.ts | ||
rm node_modules/.pnpm/@types+babel__traverse@*/node_modules/@types/babel__traverse/*.d.ts | ||
echo "declare module 'vitest'" >> ./src/types.d.ts | ||
- name: Test ${{ matrix.typescript }} | ||
run: | | ||
rm -r node_modules/@types/babel__core/node_modules | ||
yarn tsc --noEmit | ||
pnpm test:types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,3 @@ yarn-error.log* | |
# misc | ||
.DS_Store | ||
.idea | ||
|
||
# pnpn & npm lockfiles | ||
pnpm-lock.yaml | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"name": "valtio", | ||
"description": "💊 Valtio makes proxy-state simple for React and Vanilla", | ||
"private": true, | ||
"type": "commonjs", | ||
"version": "1.13.2", | ||
"description": "💊 Valtio makes proxy-state simple for React and Vanilla", | ||
"main": "./index.js", | ||
"types": "./index.d.ts", | ||
"typesVersions": { | ||
|
@@ -52,8 +53,8 @@ | |
"sideEffects": false, | ||
"scripts": { | ||
"prebuild": "shx rm -rf dist", | ||
"build": "concurrently -m 8 'yarn:build:*'", | ||
"build-watch": "concurrently -n watch: 'yarn:build:* --watch'", | ||
"build": "pnpm run prebuild && pnpm run '/^build:.*/' && pnpm run postbuild", | ||
"build-watch": "pnpm run '/^build:.*/' --watch", | ||
"build:base": "rollup -c", | ||
"build:utils": "rollup -c --config-utils", | ||
"build:vanilla": "rollup -c --config-vanilla", | ||
|
@@ -62,14 +63,14 @@ | |
"build:react_utils": "rollup -c --config-react_utils", | ||
"build:macro": "rollup -c --config-macro", | ||
"build:macro_vite": "rollup -c --config-macro_vite", | ||
"postbuild": "yarn patch-d-ts && yarn copy && yarn patch-macro-vite && yarn patch-ts3.4 && yarn patch-esm-ts", | ||
"postbuild": "pnpm patch-d-ts && pnpm copy && pnpm patch-macro-vite && pnpm patch-ts3.4 && pnpm patch-esm-ts", | ||
"prettier": "prettier '*.{js,json,md}' '{src,tests,docs}/**/*.{ts,tsx,md,mdx}' --write", | ||
"prettier:ci": "prettier '*.{js,json,md}' '{src,tests,docs}/**/*.{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}' '{src,tests,docs}/**/*.{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,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-macro-vite": "shx cp dist/esm/macro/vite.d.ts dist/macro/ && shx cp dist/ts3.4/esm/macro/vite.d.ts dist/ts3.4/macro/", | ||
|
@@ -103,6 +104,7 @@ | |
"url": "https://github.com/pmndrs/valtio/issues" | ||
}, | ||
"homepage": "https://github.com/pmndrs/valtio", | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"derive-valtio": "0.1.0", | ||
"proxy-compare": "2.6.0", | ||
|
@@ -123,7 +125,11 @@ | |
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@testing-library/react": "^15.0.6", | ||
"@typed-macro/core": "1.0.0-alpha", | ||
"@typed-macro/runtime": "1.0.0-alpha", | ||
"@types/babel-plugin-macros": "^3.1.3", | ||
"@types/babel-plugin-tester": "^9.0.10", | ||
"@types/babel__traverse": "^7.20.5", | ||
"@types/jsdom": "^21.1.6", | ||
"@types/react": "18.2.56", | ||
"@types/react-dom": "^18.3.0", | ||
|
@@ -135,7 +141,6 @@ | |
"aslemammad-vite-plugin-macro": "^1.0.0", | ||
"babel-plugin-macros": "^3.1.0", | ||
"babel-plugin-tester": "10.1.0", | ||
"concurrently": "^8.2.2", | ||
"downlevel-dts": "^0.11.0", | ||
"esbuild": "^0.20.2", | ||
"eslint": "8.57.0", | ||
|
@@ -157,6 +162,7 @@ | |
"redux": "^5.0.1", | ||
"rollup": "^4.17.2", | ||
"rollup-plugin-esbuild": "^6.1.1", | ||
"shelljs": "^0.8.5", | ||
"shx": "^0.3.4", | ||
"ts-expect": "^1.3.0", | ||
"tslib": "^2.6.2", | ||
|
@@ -178,6 +184,5 @@ | |
"react": { | ||
"optional": true | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} | ||
} |
Oops, something went wrong.