-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
19,810 additions
and
17,872 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
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 |
---|---|---|
|
@@ -12,21 +12,24 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: [cjs, umd] # [cjs, esm, umd, system] | ||
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 [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: | | ||
|
@@ -40,28 +43,31 @@ jobs: | |
- name: Patch for CJS | ||
if: ${{ matrix.build == 'cjs' }} | ||
run: | | ||
sed -i~ "s/<rootDir>\/src\(.*\)\.ts/<rootDir>\/dist\1.js/" package.json | ||
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\1.js')/" vitest.config.ts | ||
sed -i~ "s/import { useResetAtom } from 'jotai\/react\/utils'/const { useResetAtom } = require('..\/..\/..\/dist\/react\/utils.js')/" tests/react/utils/useResetAtom.test.tsx | ||
sed -i~ "s/import { RESET, atomWithReducer, atomWithReset } from 'jotai\/vanilla\/utils'/const { RESET, atomWithReducer, atomWithReset } = require('..\/..\/..\/dist\/vanilla\/utils.js')/" tests/react/utils/useResetAtom.test.tsx | ||
- name: Patch for ESM | ||
if: ${{ matrix.build == 'esm' }} | ||
run: | | ||
sed -i~ "s/<rootDir>\/src\(.*\)\.ts/<rootDir>\/dist\/esm\1.js" package.json | ||
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/esm\1.mjs')/" vitest.config.ts | ||
sed -i~ "1s/^/import.meta.env=import.meta.env||{};import.meta.env.MODE='${NODE_ENV}';/" tests/*/*.tsx tests/*/*/*.tsx | ||
env: | ||
NODE_ENV: ${{ matrix.env }} | ||
- name: Patch for UMD | ||
if: ${{ matrix.build == 'umd' }} | ||
run: | | ||
sed -i~ "s/<rootDir>\/src\(.*\)\.ts/<rootDir>\/dist\/umd\1.${NODE_ENV}.js/" package.json | ||
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/umd\1.${NODE_ENV}.js')/" vitest.config.ts | ||
rm tests/react/utils/useResetAtom.test.tsx # FIXME we skip this for now. Actually I'm not sure if we really run tests with UMD build | ||
env: | ||
NODE_ENV: ${{ matrix.env }} | ||
- name: Patch for SystemJS | ||
if: ${{ matrix.build == 'system' }} | ||
run: | | ||
sed -i~ "s/<rootDir>\/src\(.*\)\.ts/<rootDir>\/dist\/system\1.${NODE_ENV}.js/" package.json | ||
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/system\1.${NODE_ENV}.js')/" vitest.config.ts | ||
env: | ||
NODE_ENV: ${{ matrix.env }} | ||
- name: Test ${{ matrix.build }} ${{ matrix.env }} | ||
run: | | ||
yarn test:ci | ||
pnpm test-build:spec # 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,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 | ||
|
@@ -36,25 +37,28 @@ jobs: | |
- 18.3.0-canary-4b84f1161-20240318 | ||
- 0.0.0-experimental-4b84f1161-20240318 | ||
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/[email protected] | ||
run: pnpm add -D @testing-library/[email protected] | ||
- name: Patch for React 16 | ||
if: ${{ startsWith(matrix.react, '16.') }} | ||
run: | | ||
sed -i~ '1s/^/import React from "react";/' tests/*/*.tsx tests/*/*/*.tsx | ||
sed -i~ 's/"jsx": "react-jsx"/"jsx": "react"/' tsconfig.json | ||
sed -i~ 's/import\.meta\.env[?]\.MODE/"DEVELOPMENT".toLowerCase()/' src/*.ts src/*/*.ts src/*/*/*.ts | ||
- name: Test Build # we need to build for babel tests | ||
run: yarn build | ||
run: pnpm build | ||
- 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 |
---|---|---|
|
@@ -13,7 +13,8 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
typescript: | ||
- 5.3.2 | ||
- 5.4.4 | ||
- 5.3.3 | ||
- 5.2.2 | ||
- 5.1.6 | ||
- 5.0.4 | ||
|
@@ -30,14 +31,17 @@ jobs: | |
- 3.9.7 | ||
- 3.8.3 | ||
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 Newer TS | ||
if: ${{ matrix.typescript == '4.9.5' || matrix.typescript == '4.8.4' }} | ||
run: | | ||
|
@@ -47,7 +51,7 @@ jobs: | |
sed -i~ 's/"jotai\/\*": \["\.\/src\/\*\.ts"\]/"jotai\/*": [".\/dist\/*.d.ts"]/' tsconfig.json | ||
sed -i~ 's/"include": .*/"include": ["src\/types.d.ts", "dist\/**\/*", "tests\/**\/*"],/' tsconfig.json | ||
- name: Patch for Old TS | ||
if: ${{ matrix.typescript == '4.7.4' || matrix.typescript == '4.6.4' || matrix.typescript == '4.5.5' || 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.') }} | ||
if: ${{ matrix.typescript == '4.7.4' || matrix.typescript == '4.6.4' || matrix.typescript == '4.5.5' || 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: | | ||
sed -i~ 's/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//' tests/*/*.tsx tests/*/*/*.tsx | ||
sed -i~ 's/"target":/"skipLibCheck":true,"target":/' tsconfig.json | ||
|
@@ -65,19 +69,23 @@ jobs: | |
sed -i~ 's/"jsx": "react-jsx",/"jsx": "react",/' tsconfig.json | ||
sed -i~ 's/"noUncheckedIndexedAccess": true,//' tsconfig.json | ||
sed -i~ 's/^import type /import /' tests/*/*.tsx tests/*/*/*.tsx | ||
yarn json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/prettier']='2.4.2'; this.resolutions['@types/node']='18.11.18';" | ||
yarn add -D @types/[email protected] @types/[email protected] @types/[email protected] @types/[email protected] | ||
pnpm json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/prettier']='2.4.2'; this.resolutions['@types/node']='18.11.18';" | ||
pnpm add -D @types/[email protected] @types/[email protected] @types/[email protected] @types/[email protected] | ||
rm -r tests/react/vanilla-utils/atomWithObservable.* | ||
- 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' || matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} | ||
run: | | ||
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 | ||
echo "declare module 'vitest'" >> ./src/types.d.ts | ||
- name: Test ${{ matrix.typescript }} | ||
run: | | ||
rm -r node_modules/@types/babel__core/node_modules | ||
sed -i~ 's/">=4.2": {/">=4.1": {/' node_modules/rxjs/package.json | ||
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
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
Oops, something went wrong.