Skip to content

Commit

Permalink
Merge pull request #1006 from reduxjs/feature/migrate-rtkq-source
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson authored Apr 20, 2021
2 parents e17b400 + 91e11b6 commit cfd925b
Show file tree
Hide file tree
Showing 207 changed files with 54,408 additions and 74 deletions.
File renamed without changes.
20 changes: 10 additions & 10 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Compressed Size
# name: Compressed Size

on: [pull_request]
# on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
# jobs:
# build:
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v1
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
# steps:
# - uses: actions/checkout@v2
# - uses: preactjs/compressed-size-action@v1
# with:
# repo-token: '${{ secrets.GITHUB_TOKEN }}'
112 changes: 56 additions & 56 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,59 +33,59 @@ jobs:
name: package
path: reduxjs-toolkit*.tgz

test:
name: Test Types with TypeScript ${{ matrix.ts }}

needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['14.x']
ts: ['3.8', '3.9', '4.0', '4.1', 'next']
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- uses: c-hive/gha-npm-cache@v1

- name: Install deps
run: npm ci --ignore-scripts

- name: Install TypeScript ${{ matrix.ts }}
run: npm install typescript@${{ matrix.ts }} --ignore-scripts

- uses: actions/download-artifact@v2
with:
name: package

- name: Unpack build artifact to dist
run: tar -xzvf reduxjs-toolkit-*.tgz --strip-components=1 package/dist

- name: Remap @redux/toolkit from src to dist
run: |
sed -i -e 's|@reduxjs/toolkit": \["./src"\]|@reduxjs/toolkit": ["."]|' ./type-tests/files/tsconfig.json
- name: Prefix `freeze` re-export for pre-3.7 TS versions with @ts-ignore
if: ${{ matrix.ts < 3.7 }}
run: |
sed -i -e "/import .* freeze .* from 'immer'/s/^/\/\/ @ts-ignore\n/" dist/typings.d.ts
sed -i -e "/ freeze,/s/^/ \/\/ @ts-ignore\n/" src/index.ts
- name: Use typings-tester for old TS versions
if: ${{ matrix.ts < 3.9 }}
run: |
sed -i -e 's/"cd type-tests.*"/"npm run test type-tests"/' package.json
sed -i -e 's/@ts-expect-error/typings:expect-error/' type-tests/files/*.typetest.ts
sed -i -e 's/@ts-expect-error/@ts-ignore/' type-tests/files/*.ts
mv type-tests/types.test.disabled.ts type-tests/types.test.ts
- name: Test types
run: |
./node_modules/.bin/tsc --version
npm run type-tests
# test:
# name: Test Types with TypeScript ${{ matrix.ts }}

# needs: [build]
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# node: ['14.x']
# ts: ['3.8', '3.9', '4.0', '4.1', 'next']
# steps:
# - name: Checkout repo
# uses: actions/checkout@v2

# - name: Use node ${{ matrix.node }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node }}

# - uses: c-hive/gha-npm-cache@v1

# - name: Install deps
# run: npm ci --ignore-scripts

# - name: Install TypeScript ${{ matrix.ts }}
# run: npm install typescript@${{ matrix.ts }} --ignore-scripts

# - uses: actions/download-artifact@v2
# with:
# name: package

# - name: Unpack build artifact to dist
# run: tar -xzvf reduxjs-toolkit-*.tgz --strip-components=1 package/dist

# - name: Remap @redux/toolkit from src to dist
# run: |
# sed -i -e 's|@reduxjs/toolkit": \["./src"\]|@reduxjs/toolkit": ["."]|' ./type-tests/files/tsconfig.json

# - name: Prefix `freeze` re-export for pre-3.7 TS versions with @ts-ignore
# if: ${{ matrix.ts < 3.7 }}
# run: |
# sed -i -e "/import .* freeze .* from 'immer'/s/^/\/\/ @ts-ignore\n/" dist/typings.d.ts
# sed -i -e "/ freeze,/s/^/ \/\/ @ts-ignore\n/" src/index.ts

# - name: Use typings-tester for old TS versions
# if: ${{ matrix.ts < 3.9 }}
# run: |
# sed -i -e 's/"cd type-tests.*"/"npm run test type-tests"/' package.json
# sed -i -e 's/@ts-expect-error/typings:expect-error/' type-tests/files/*.typetest.ts
# sed -i -e 's/@ts-expect-error/@ts-ignore/' type-tests/files/*.ts
# mv type-tests/types.test.disabled.ts type-tests/types.test.ts

# - name: Test types
# run: |
# ./node_modules/.bin/tsc --version
# npm run type-tests
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ yarn.lock
temp/
.tmp-projections

.rts2*
.rts2*

typesversions
.cache
.yarn
.yarnrc
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js']
setupFilesAfterEnv: ['./jest.setup.js'],
testPathIgnorePatterns: ['<rootDir>/query/*'],
}
3 changes: 2 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
base = "website"
publish = "build"
command = "npm run netlify-build && cp _redirects ./build"
ignore = "git diff --quiet HEAD^ HEAD docs website"
#ignore = "git diff --quiet HEAD^ HEAD docs website"
ignore = "true"

[build.environment]
NODE_VERSION = "10"
3 changes: 3 additions & 0 deletions query/.codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sandboxes": ["new", "react-ts", "/examples/react", "/examples/svelte"]
}
1 change: 1 addition & 0 deletions query/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
18 changes: 18 additions & 0 deletions query/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
extends: ['react-app', 'prettier/@typescript-eslint', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
rules: {
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_' }],
'no-redeclare': 'off',
// '@typescript-eslint/no-redeclare': ['error'], // rule not found?,
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
},
};
91 changes: 91 additions & 0 deletions query/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI
on: [push, pull_request]
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['12.x']
os: [ubuntu-latest] #, windows-latest, macOS-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts

- name: Lint
run: yarn lint

- name: Test
run: yarn test --ci --coverage --maxWorkers=2

- name: Pack (including Prepare)
run: npm pack

- uses: actions/upload-artifact@v2
with:
name: package
path: rtk-incubator-rtk-query*.tgz

test:
name: Test Types with TypeScript ${{ matrix.ts }}

needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['12.x']
ts: ['3.9', '4.0', '4.1', '4.2', 'next']
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts

- name: Install TypeScript ${{ matrix.ts }}
run: npm install typescript@${{ matrix.ts }} --ignore-scripts

- uses: actions/download-artifact@v2
with:
name: package

- name: Unpack build artifact to dist
run: tar -xzvf rtk-incubator-rtk-query-*.tgz --strip-components=1 package/dist

- name: Remap @redux/toolkit from src to dist
run: |
sed -i -re 's|(@rtk-incubator/rtk-query.*)\./src|\1./|' ./test/tsconfig.json
- name: '@ts-ignore @ts-expect-error messages in pre-3.9 in the tests'
if: ${{ matrix.ts < 3.9 }}
run: |
sed -i 's/@ts-expect-error/@ts-ignore/' test/*.ts*
- name: "@ts-ignore stuff that didn't exist pre-4.1 in the tests"
if: ${{ matrix.ts < 4.1 }}
run: sed -i -e 's/@pre41-ts-ignore/@ts-ignore/' -e '/pre41-remove-start/,/pre41-remove-end/d' test/*.ts*

- name: Test types
run: |
./node_modules/.bin/tsc --version
./node_modules/.bin/tsc --skipLibCheck -p test
12 changes: 12 additions & 0 deletions query/.github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: size
on: [pull_request]
jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v1
- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions query/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
15 changes: 15 additions & 0 deletions query/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"endOfLine": "auto",
"printWidth": 120,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"overrides": [
{
"files": "*.ts",
"options": {
"parser": "babel-ts"
}
}
]
}
19 changes: 19 additions & 0 deletions query/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"args": ["test", "--runInBand", "${file}"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"program": "${workspaceFolder}/node_modules/.bin/tsdx"
}
]
}
7 changes: 7 additions & 0 deletions query/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"jest.pathToJest": "npm test --",
"jest.enableInlineErrorMessages": true,
"jest.autoEnable": false,
"editor.formatOnSave": true
}
21 changes: 21 additions & 0 deletions query/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Lenz Weber

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit cfd925b

Please sign in to comment.