atom.INTERNAL_onInit
hook to support sync effects
#2702
Workflow file for this run
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
name: Test Old TypeScript | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
test_matrix: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
typescript: | |
- 5.5.4 | |
- 5.4.5 | |
- 5.3.3 | |
- 5.2.2 | |
- 5.1.6 | |
- 5.0.4 | |
- 4.9.5 | |
- 4.8.4 | |
- 4.7.4 | |
- 4.6.4 | |
- 4.5.5 | |
- 4.4.4 | |
- 4.3.5 | |
- 4.2.3 | |
- 4.1.5 | |
- 4.0.5 | |
- 3.9.7 | |
- 3.8.3 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- run: pnpm install | |
- run: pnpm build | |
- name: Patch for all TS | |
run: | | |
sed -i~ 's/"isolatedDeclarations": true,//' tsconfig.json | |
- name: Patch for v4/v3 TS | |
if: ${{ startsWith(matrix.typescript, '4.') || startsWith(matrix.typescript, '3.') }} | |
run: | | |
sed -i~ 's/"verbatimModuleSyntax": true,//' tsconfig.json | |
- name: Patch for Newer TS | |
if: ${{ matrix.typescript == '4.9.5' || matrix.typescript == '4.8.4' }} | |
run: | | |
sed -i~ 's/"moduleResolution": "bundler",/"moduleResolution": "node",/' tsconfig.json | |
sed -i~ 's/"allowImportingTsExtensions": true,//' tsconfig.json | |
sed -i~ 's/"jotai": \["\.\/src\/index\.ts"\],/"jotai": [".\/dist\/index.d.ts"],/' tsconfig.json | |
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.') }} | |
run: | | |
sed -i~ 's/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//' tests/*/*.tsx tests/*/*/*.tsx | |
sed -i~ 's/"target":/"skipLibCheck":true,"target":/' tsconfig.json | |
sed -i~ 's/"exactOptionalPropertyTypes": true,//' tsconfig.json | |
sed -i~ 's/"moduleResolution": "bundler",/"moduleResolution": "node",/' tsconfig.json | |
sed -i~ 's/"allowImportingTsExtensions": true,//' tsconfig.json | |
sed -i~ 's/"jotai": \["\.\/src\/index\.ts"\],/"jotai": [".\/dist\/ts3.8\/index.d.ts"],/' tsconfig.json | |
sed -i~ 's/"jotai\/\*": \["\.\/src\/\*\.ts"\]/"jotai\/*": [".\/dist\/ts3.8\/*.d.ts"]/' tsconfig.json | |
sed -i~ 's/"include": .*/"include": ["src\/types.d.ts", "dist\/**\/*", "tests\/**\/*"],/' tsconfig.json | |
pnpm add -D @testing-library/[email protected] @types/[email protected] | |
- name: Patch for Older TS | |
if: ${{ matrix.typescript == '4.2.3' || matrix.typescript == '4.1.5' || matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} | |
run: | | |
sed -i~ 's/import\.meta\.env/(import.meta.env as any)/' tests/*/*.tsx tests/*/*/*.tsx | |
sed -i~ '1s/^/\/\/\/ <reference types="react\/experimental" \/>\nimport React from "react";/' tests/*/*.tsx tests/*/*/*.tsx | |
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 | |
pnpm json -I -f package.json -e "this.resolutions={}; this.resolutions['@types/prettier']='2.4.2'; this.resolutions['@types/node']='18.11.18'; this.resolutions['@types/react']='18.2.56';" | |
pnpm add -D @types/[email protected] @types/[email protected] @types/[email protected] @types/[email protected] @types/[email protected] | |
rm -r tests/react/vanilla-utils/atomWithObservable.* | |
- name: Install old 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] | |
pnpm add -D @testing-library/jest-dom@5 @types/testing-library__jest-dom@5 | |
pnpm add -D @types/[email protected] | |
sed -i~ 's/"@testing-library\/jest-dom"/"@types\/testing-library__jest-dom"/' tsconfig.json | |
- name: Patch testing setup for older TS | |
if: ${{ matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} | |
run: | | |
pnpm add -D @testing-library/[email protected] @testing-library/[email protected] @types/[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 | |
pnpm test:types |