Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate RTK Query repo contents into the RTK repo #1006

Merged
merged 212 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
40d9475
initial api experiments
phryneas Oct 15, 2020
69b1d83
naive hook design
phryneas Oct 15, 2020
034f25a
move types out
phryneas Oct 18, 2020
817e5fb
basic functionality
phryneas Oct 18, 2020
dc44f37
format
phryneas Oct 19, 2020
8afccb7
add middleware, typings
phryneas Oct 19, 2020
c593152
only startQuery/startMutation actions create substates now
phryneas Oct 25, 2020
0fadc9f
basic hook implementation
phryneas Oct 26, 2020
de49d24
add todos to readme
phryneas Oct 28, 2020
90ed20d
Update README.md
phryneas Oct 31, 2020
4d89ebb
use promise.requestId & promise.arg
phryneas Oct 31, 2020
a8e69f7
split up into files
phryneas Oct 31, 2020
c612af0
basic on-mutation query refetch logic
phryneas Oct 31, 2020
f79343b
fix
phryneas Oct 31, 2020
3fd3a5f
do not test on node 10, build in CSB
phryneas Oct 31, 2020
6bcc064
subscribe only on query, not on refetch
phryneas Nov 1, 2020
4ba703f
add warning for normal RTK
phryneas Nov 1, 2020
9a72bd6
fix mutation return type
phryneas Nov 1, 2020
8846a95
delete queries with no subscribers if they would refetch
phryneas Nov 1, 2020
502f645
implement a skip option for useQuery to prevent fetching on initial r…
phryneas Nov 1, 2020
31abac4
invalidation "no id" => "invalidate all of type"
phryneas Nov 1, 2020
8d1895e
add `skipSelector` symbol
phryneas Nov 1, 2020
c41e9dd
simplify provides & invalidates, make them optional
phryneas Nov 1, 2020
b4b3d78
pass initial `arg` as second argument to provides & invalidates
phryneas Nov 1, 2020
7ad0b20
add fetchBaseQuery, some exports & README
phryneas Nov 1, 2020
bd18e09
rename package
phryneas Nov 1, 2020
9db4643
update readme
phryneas Nov 1, 2020
0e4001e
different response type handling
phryneas Nov 2, 2020
1e39db7
tweak response header parsing
phryneas Nov 2, 2020
89c9982
remove console.log
phryneas Nov 2, 2020
79be930
diagram
phryneas Nov 3, 2020
b05cd87
error handling
phryneas Nov 3, 2020
5f9524d
better return value for useMutation mutate function
phryneas Nov 3, 2020
a63bbcf
return a refetch function from useQuery that does said refetch
phryneas Nov 3, 2020
fd61a37
eslint config
phryneas Nov 3, 2020
0190d71
timeout invalidation
phryneas Nov 3, 2020
8626189
fix refreshing
phryneas Nov 3, 2020
5e52dd4
Add posts demo
msutkowski Nov 5, 2020
0b81434
move logic from query hook into action creator
phryneas Nov 5, 2020
ef742ef
Add svelte example, maybe batch (#5)
msutkowski Nov 6, 2020
5742059
fetchBaseQuery queryString -> url, also accepts single string as arum…
phryneas Nov 6, 2020
ee28902
add postProcess endpoint option
phryneas Nov 6, 2020
06f5caf
Bind redux store to svelte store (#6)
msutkowski Nov 7, 2020
e38ff6c
move logic from hook into mutation action creator
phryneas Nov 7, 2020
5c48989
cleanup
phryneas Nov 7, 2020
23fa79b
add track option to mutation action creator
phryneas Nov 7, 2020
c65bc15
Allow a shorthand of entityType for invalidates (#8)
msutkowski Nov 8, 2020
abbca77
add concept of `subscriptionOptions`, add `pollingInterval` option, d…
phryneas Nov 8, 2020
8f84890
Enhance/fetch base query (#7)
themindoverall Nov 8, 2020
d34d71f
basic polling logic (WIP, untested)
phryneas Nov 8, 2020
109fbc5
make peerDependencies optional
phryneas Nov 10, 2020
bdda54d
Fixes, add polling to svelte example
msutkowski Nov 10, 2020
0075c27
remove "endpoint" level between queryState & querySubState
phryneas Nov 10, 2020
26df371
fix subscription bug
phryneas Nov 10, 2020
f40ad3d
put endpoint into querySubState and as part of queryCacheKey
phryneas Nov 10, 2020
f72d246
move subscriptions out of querySubState
phryneas Nov 10, 2020
ce52211
flatten mutation state
phryneas Nov 10, 2020
f001d75
Fix polling, update example
msutkowski Nov 11, 2020
a1cc254
Add timers example
msutkowski Nov 11, 2020
a3db044
Fix import
msutkowski Nov 11, 2020
ff91a15
Add individual poll interval to time entries
msutkowski Nov 11, 2020
698773f
switch polling to `setTimeout`
phryneas Nov 11, 2020
e76593a
Fix testing and config issues (#19)
msutkowski Nov 12, 2020
30abb78
Merge branch 'main' into subscriptionOptions
phryneas Nov 12, 2020
bd116d2
Merge pull request #10 from rtk-incubator/subscriptionOptions
phryneas Nov 12, 2020
547c49b
Examples cleanup (#20)
msutkowski Nov 13, 2020
149104e
Starting on the docs :tada:
msutkowski Nov 13, 2020
997fe5e
Remove boilerplate, start stubbing content
msutkowski Nov 13, 2020
abac1c7
Add netlify config
msutkowski Nov 13, 2020
fe42cd7
fix `args` argument to `calculateProvidedBy`
Nov 13, 2020
0e5923e
Update README.md
phryneas Nov 15, 2020
7509821
rename to rtk-query
phryneas Nov 15, 2020
7917ea4
Quick start
msutkowski Nov 15, 2020
ecfb267
refactor: allow to add definitions after the initial api definition
Nov 13, 2020
c36f149
Update examples/svelte/src/App.svelte
phryneas Nov 13, 2020
5e6a670
define API, `injectEndpoints` to be used by `createApi` itself
phryneas Nov 14, 2020
1f731b8
`ApiWithInjectedEndpoints` type & codesandbox examples
phryneas Nov 14, 2020
2e95e9d
Apply suggestions from code review
phryneas Nov 15, 2020
5ae2a7f
Temp-fix broken links
markerikson Nov 15, 2020
12168c8
Update quick-start.md
markerikson Nov 15, 2020
95dfc8c
move to TS 4.1, add hooks TS4.1-style
phryneas Nov 15, 2020
e8c7d0c
fix example import after package rename
phryneas Nov 15, 2020
732fee3
remove outdated TODO list from README
phryneas Nov 15, 2020
d3ce4f7
Merge pull request #21 from msutkowski/docusaurus
markerikson Nov 15, 2020
d9ae1f8
fix type resolution for "/dist" import in TS4.1
phryneas Nov 15, 2020
16dd3bc
make `reducerPath` and `entityTypes` optional
phryneas Nov 15, 2020
6daaa81
validate entityTypes on runtime
phryneas Nov 15, 2020
77d0457
disable tests for windows & osx for now
phryneas Nov 15, 2020
b59da25
Rename postProcess to transformResponse
msutkowski Nov 16, 2020
5579053
await baseQuery
msutkowski Nov 16, 2020
95a0edd
Add flatten util, add tests
msutkowski Nov 16, 2020
325e61e
Initial documentation
msutkowski Nov 16, 2020
0b029eb
sort object keys before stringifying in `defaultSerializeQueryArgs`
phryneas Nov 16, 2020
aa67e26
use "shallow stable" `arg` value in `useQuery` hooks
phryneas Nov 16, 2020
b41a786
Add test to confirm kv order change does not rerender
msutkowski Nov 17, 2020
1a5717b
Apply suggestions from code review
phryneas Nov 17, 2020
6986f36
make prettier happy
phryneas Nov 17, 2020
eadfa24
Docs: Add more clarity to mutations, queries, and createApi. Add more…
msutkowski Nov 19, 2020
f36d022
change `InternalQueryArgs` generic to `BaseQuery` generic, add timest…
phryneas Nov 17, 2020
897cef2
tests now import from '@rtk-incubator/rtk-query'
phryneas Nov 21, 2020
3ef633d
Add isLoading, isError, isSuccess, isFetching booleans (#39)
msutkowski Nov 21, 2020
1057501
tests for cleanup behaviour
phryneas Nov 21, 2020
aee73e3
check if there are still subscribers before cleaning up
phryneas Nov 21, 2020
1bb1f5a
add setupApiStore test helper
phryneas Nov 21, 2020
c9e431f
Add a usePrefetch hook and prefetchThunk action
msutkowski Nov 22, 2020
5df20d6
useMutation: fix hook, add test (#47)
msutkowski Nov 22, 2020
a5b4971
Optimistic updates (#46)
phryneas Nov 24, 2020
5f0975c
update TS to 4.1 final
phryneas Nov 24, 2020
c9e3e30
Change api shape (#48)
phryneas Nov 25, 2020
14809b6
Docs: intro to optimistic updates (#49)
msutkowski Nov 25, 2020
21f1c4a
typed error handling
phryneas Nov 25, 2020
764463d
Idea: Add baseHeaders and dispatch to validateStatus
msutkowski Nov 25, 2020
501ea93
Update docs/api/createApi.md
msutkowski Nov 25, 2020
2256515
Update examples/react/src/app/services/posts.ts
msutkowski Nov 25, 2020
1f54ac4
Add prepareHeaders
msutkowski Nov 25, 2020
01f8cd2
error handling tests
phryneas Nov 25, 2020
8d05a79
Merge branch 'errorHandling' into errorHandling-addHeadersAndDispatch
msutkowski Nov 25, 2020
0cb5cb0
typed error handling
phryneas Nov 25, 2020
c1b4085
error handling tests
phryneas Nov 25, 2020
5f91dca
clean error from state after successful query
phryneas Nov 26, 2020
ce9463d
fix up docs on invalidation behaviour
phryneas Nov 26, 2020
81cb2a3
Update getState type
msutkowski Nov 26, 2020
d082b19
thunk action matchers (#50)
phryneas Nov 26, 2020
3b4e2df
Merge branch 'main' into errorHandling-addHeadersAndDispatch
msutkowski Nov 26, 2020
a205b5f
Update QueryApi types and tests
msutkowski Nov 26, 2020
9465246
Fix buildThunks
msutkowski Nov 26, 2020
d8951bd
Add auth example and token usage to examples
msutkowski Nov 26, 2020
f564cdb
Merge branch 'main' into errorHandling-addHeadersAndDispatch
msutkowski Nov 26, 2020
2daf740
Fix Matcher types, add example of extraReducers with a matcher
msutkowski Nov 26, 2020
54d4faf
change `defaultSerializeQueryArgs`, more arguments to SerializeQueryA…
phryneas Nov 26, 2020
2270835
Merge branch 'main' into errorHandling-addHeadersAndDispatch
msutkowski Nov 26, 2020
32be32b
Add prepareHeaders to fetchBaseQuery, expose dispatch, getState to ba…
msutkowski Nov 26, 2020
6f4b52b
Tests: fetchBaseQuery behavior (#57)
msutkowski Nov 29, 2020
73bc783
Docs: Update api references, rename simple-query to rtk-query everywh…
msutkowski Nov 29, 2020
1c9869c
Update README.md
markerikson Nov 29, 2020
03b64b5
overhaul of union types returned by query selectors & hooks (#58)
phryneas Nov 29, 2020
8c5b648
update RTK to 1.5, remove check for "unstable" RTK version (#60)
phryneas Nov 29, 2020
6e61186
Rework build/setup process to work better across platforms
markerikson Nov 29, 2020
0fc9e70
Fix file copying issues:
markerikson Nov 29, 2020
f95b2c1
Merge pull request #61 from rtk-incubator/docs/cross-platform-setup
markerikson Nov 29, 2020
1163969
Switch RTK to be a peer dep
markerikson Nov 29, 2020
2da7a8f
Add RTK as a devDep
markerikson Nov 29, 2020
8730119
Merge pull request #62 from rtk-incubator/feature/rtk-peer-deps
markerikson Nov 29, 2020
8ae62b8
Examples: Update import paths for CSB (#63)
msutkowski Nov 29, 2020
5fd5fff
Docs content and layout editing pass (#65)
markerikson Nov 29, 2020
5f45a38
Implement retrying (#64)
phryneas Nov 30, 2020
7cfd6dd
add apiProvider (#67)
phryneas Nov 30, 2020
5d0a71f
Add ApiProvider test and docs. Add Authentication example (#69)
msutkowski Dec 1, 2020
a18661d
Fix return types for matchers (#70)
msutkowski Dec 1, 2020
72370c2
Code Splitting documentation (#72)
msutkowski Dec 1, 2020
afe6ae0
move internal exports out of entry point (#73)
phryneas Dec 1, 2020
6692893
Update README
msutkowski Dec 1, 2020
2a08290
Fix lint errors warning about newlines
markerikson Dec 1, 2020
d62aca7
Mark package as public
markerikson Dec 1, 2020
9153761
Docs cleanup: Rename outdated hooks/actions references (#75)
msutkowski Dec 1, 2020
f6a55ad
Merge branch 'main' of https://github.com/rtk-incubator/rtk-query int…
markerikson Dec 1, 2020
bbc2cb1
Really mark package as public
markerikson Dec 1, 2020
0f44097
v0.1.0-alpha.0
markerikson Dec 1, 2020
57bae6e
Fix repository URLs
markerikson Dec 1, 2020
bcda15d
v0.1.0-alpha.1
markerikson Dec 1, 2020
48fbc47
Re-re-fix repo URL
markerikson Dec 1, 2020
1af78f8
v0.1.0-alpha.2
markerikson Dec 1, 2020
b1efe44
Mark sideEffects: false for tree shaking
markerikson Dec 1, 2020
90f0ae7
v0.1.0-alpha.3
markerikson Dec 1, 2020
1c21902
v0.1.0
markerikson Dec 1, 2020
d984e02
update createApi docs (#76)
phryneas Dec 1, 2020
1933770
Use latest versions of svelte/react-hooks examples (#82)
msutkowski Dec 2, 2020
4a9a258
Implement refetchOnMountOrArgChange (#80)
msutkowski Dec 4, 2020
b221a12
Export FetchArgs from fetchBaseQuery (#87)
msutkowski Dec 4, 2020
151c777
Handle empty json response (#91)
airjp73 Dec 6, 2020
963af60
Implement refetchOnFocus, refetchOnReconnect (#90)
msutkowski Dec 12, 2020
e4502f6
remove phantom type identifying state (#100)
phryneas Dec 12, 2020
0875c04
Allow for a custom fetchFn in fetchBaseQuery (#105)
msutkowski Dec 13, 2020
0651d5b
docs: update comparison (#103)
tannerlinsley Dec 14, 2020
3e29c4b
Allow endpoints to have optional/undefined headers (#108)
msutkowski Dec 14, 2020
346ef24
split query hooks, add sub-selector (#106)
phryneas Dec 16, 2020
49f5c7a
split up into "core" & "redux-hooks" module (#116)
phryneas Dec 17, 2020
8f75b4a
Add unwrap to the mutation hook (#117)
msutkowski Dec 17, 2020
5f2bb7a
Error handling copy improvements, note about `.unwrap()` (#115)
msutkowski Dec 17, 2020
94731b4
Deprecate UseQueryStateDefaultResult.status (#118)
phryneas Dec 17, 2020
ecdec3f
Make prepareHeaders support async functions (#123)
schadenn Dec 18, 2020
159a629
Make transformResponse support async functions (#120)
phryneas Dec 18, 2020
ab0d17e
selectFromResult documentation (#119)
msutkowski Dec 19, 2020
f19b3d5
Docs: Add prefetch immediately recipe (#124)
msutkowski Dec 20, 2020
f37f599
Add algolia config (#126)
msutkowski Dec 21, 2020
f9a83b7
use authorization instead of authentication (#128)
msutkowski Dec 24, 2020
8629843
manual build via rollup (#109)
phryneas Dec 25, 2020
c283f66
add onStart onError onSuccess hooks to query (#130)
kahirokunn Dec 25, 2020
9633327
mutation promise: return baseQuery result instead of mutation state (…
phryneas Dec 25, 2020
6bc3652
run tests on PRs
phryneas Dec 25, 2020
2300f72
Link directly to #redux on Reactiflux (#127)
nickserv Dec 25, 2020
1704dc1
merge `main` into `next` (#132)
phryneas Dec 26, 2020
f8e10d8
Move `internalActions.prefetchThunk` to `util.prefetchThunk` (#133)
phryneas Dec 26, 2020
0f3d27d
Enhance endpoints (#102)
phryneas Dec 26, 2020
b9cf179
allow passing options to react hooks module (#134)
phryneas Dec 26, 2020
425913a
Docs: Use code-generation everywhere (#136)
msutkowski Dec 26, 2020
dee2345
rename createPureApi to createBaseApi (#137)
phryneas Dec 26, 2020
c33066a
Prepare 0.2.0 release
phryneas Dec 26, 2020
de5d06a
v0.2.0-0
phryneas Dec 26, 2020
2a1a410
v0.2.0
phryneas Dec 26, 2020
b7f6b42
Docs: correct import statement for setupListeners (#174)
mjgwood Mar 22, 2021
09fd728
Fix typo in docs (#182)
dutzi Mar 22, 2021
cce1054
fix docs typo (#188)
dutzi Mar 27, 2021
32ae39a
fix docs typo (#187)
dutzi Mar 27, 2021
f373492
Docs: typo fix
dutzi Apr 1, 2021
3fcf4cb
Merge next into main (#214)
markerikson Apr 19, 2021
1ae1538
v0.3.0
markerikson Apr 19, 2021
071a6e3
Move the entire repo contents under /query for migration
markerikson Apr 20, 2021
5a4c979
Merge remote-tracking branch 'rtk-query/feature/migrate-to-rtk' into …
markerikson Apr 20, 2021
a788e00
Fix test running enough to pass
markerikson Apr 20, 2021
7677196
Try temporarily disabling TS typetests and CSB CI
markerikson Apr 20, 2021
91e11b6
Temporarily disable Netlify builds and Compressed Size
markerikson Apr 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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