Skip to content

Commit 0cf9004

Browse files
authored
Merge branch 'master' into docs-update
2 parents cccb19a + cb3b543 commit 0cf9004

215 files changed

Lines changed: 24903 additions & 27207 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codesandbox/ci.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
33
"vanilla",
44
"vanilla-ts",
55
"github/reduxjs/rtk-github-issues-example",
6-
"github/reduxjs/toolkit/examples/query/react/optimistic-updates"
6+
"/examples/query/react/basic",
7+
"/examples/query/react/advanced"
78
],
8-
"node": "14"
9-
}
9+
"node": "14",
10+
"buildCommand": "build:packages",
11+
"packages": [
12+
"packages/toolkit",
13+
"packages/rtk-query-graphql-request-base-query"
14+
],
15+
"publishDirectory": {
16+
"@reduxjs/toolkit": "packages/toolkit",
17+
"@rtk-query/graphql-request-base-query": "packages/rtk-query-graphql-request-base-query"
18+
}
19+
}

.eslintrc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
parser: '@typescript-eslint/parser',
44
rules: {
55
'jsx-a11y/href-no-hash': 'off',
6+
'react/react-in-jsx-scope': 'off',
67
// Taken care of by TypeScript's `noUnusedLocals` / `noUnusedParameters`
78
'no-unused-vars': 'off',
89
'@typescript-eslint/no-unused-vars': 'off',
@@ -39,7 +40,11 @@ module.exports = {
3940
// },
4041
// },
4142
{
42-
files: ['src/tests/*.ts', 'src/**/tests/*.ts', 'src/**/tests/*.tsx'],
43+
files: [
44+
'packages/toolkit/src/tests/*.ts',
45+
'packages/toolkit/src/**/tests/*.ts',
46+
'packages/toolkit/src/**/tests/*.tsx',
47+
],
4348
rules: {
4449
'@typescript-eslint/no-unused-expressions': 'off',
4550
'no-lone-blocks': 'off',

.github/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../packages/toolkit/README.md

.github/workflows/size.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ jobs:
99
- uses: actions/checkout@v1
1010
- uses: andresz1/size-limit-action@v1
1111
with:
12+
directory: packages/toolkit
1213
github_token: ${{ secrets.GITHUB_TOKEN }}
1314
build_script: build-only

.github/workflows/tests.yml

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: CI
22
on: [push, pull_request]
3+
defaults:
4+
run:
5+
working-directory: ./packages/toolkit
6+
37
jobs:
48
build:
59
name: Lint, Test, Build & Pack on Node ${{ matrix.node }}
@@ -18,21 +22,22 @@ jobs:
1822
with:
1923
node-version: ${{ matrix.node }}
2024

21-
- uses: c-hive/gha-npm-cache@v1
25+
- uses: actions/cache@v2
26+
with:
27+
path: .yarn/cache
28+
key: yarn-${{ hashFiles('yarn.lock') }}
29+
restore-keys: yarn-
2230

2331
- name: Install deps
24-
run: npm ci
25-
26-
- name: Build
27-
run: npm run build-ci
32+
run: yarn install
2833

2934
- name: Pack
30-
run: npm pack
35+
run: yarn pack
3136

3237
- uses: actions/upload-artifact@v2
3338
with:
3439
name: package
35-
path: reduxjs-toolkit*.tgz
40+
path: packages/toolkit/package.tgz
3641

3742
test-dist:
3843
name: Test against dist
@@ -51,23 +56,29 @@ jobs:
5156
with:
5257
node-version: ${{ matrix.node }}
5358

54-
- uses: c-hive/gha-npm-cache@v1
59+
- uses: actions/cache@v2
60+
with:
61+
path: .yarn/cache
62+
key: yarn-${{ hashFiles('yarn.lock') }}
63+
restore-keys: yarn-
5564

5665
- name: Install deps
57-
run: npm ci --ignore-scripts
66+
run: yarn install
5867

5968
- uses: actions/download-artifact@v2
6069
with:
6170
name: package
71+
path: packages/toolkit
72+
73+
- run: ls -lah
6274

6375
- name: Install build artifact
64-
run: |
65-
sed -i -e '/"name": "@reduxjs\/toolkit",/d' package.json
66-
npm i reduxjs-toolkit-*.tgz --ignore-scripts
67-
sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./jest.config.js ./src/tests/*.* ./src/query/tests/*.*
76+
run: yarn workspace @reduxjs/toolkit add $(pwd)/package.tgz
77+
78+
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./jest.config.js ./src/tests/*.* ./src/query/tests/*.*
6879

6980
- name: Run tests, against dist
70-
run: npm test
81+
run: yarn test
7182

7283
test-types:
7384
name: Test Types with TypeScript ${{ matrix.ts }}
@@ -88,33 +99,33 @@ jobs:
8899
with:
89100
node-version: ${{ matrix.node }}
90101

91-
- uses: c-hive/gha-npm-cache@v1
102+
- uses: actions/cache@v2
103+
with:
104+
path: .yarn/cache
105+
key: yarn-${{ hashFiles('yarn.lock') }}
106+
restore-keys: yarn-
92107

93108
- name: Install deps
94-
run: npm ci --ignore-scripts
109+
run: yarn install
95110

96111
- name: Install TypeScript ${{ matrix.ts }}
97-
run: npm install typescript@${{ matrix.ts }} --ignore-scripts
112+
run: yarn add typescript@${{ matrix.ts }}
98113

99114
- uses: actions/download-artifact@v2
100115
with:
101116
name: package
117+
path: packages/toolkit
102118

103119
- name: Install build artifact
104-
run: |
105-
sed -i -e '/"name": "@reduxjs\/toolkit",/d' package.json
106-
npm i reduxjs-toolkit-*.tgz --ignore-scripts
107-
sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./jest.config.js ./src/tests/*.* ./src/query/tests/*.*
120+
run: yarn add ./package.tgz
121+
122+
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./jest.config.js ./src/tests/*.* ./src/query/tests/*.*
108123

109124
- name: "@ts-ignore stuff that didn't exist pre-4.1 in the tests"
110125
if: ${{ matrix.ts < 4.1 }}
111126
run: sed -i -e 's/@pre41-ts-ignore/@ts-ignore/' -e '/pre41-remove-start/,/pre41-remove-end/d' ./src/tests/*.* ./src/query/tests/*.ts*
112127

113-
- name: 'disable strictOptionalProperties'
114-
if: ${{ matrix.ts == 'next' }}
115-
run: sed -i -e 's|//\(.*strictOptionalProperties.*\)$|\1|' tsconfig.base.json
116-
117128
- name: Test types
118129
run: |
119-
./node_modules/.bin/tsc --version
120-
npm run type-tests
130+
yarn tsc --version
131+
yarn type-tests

.gitignore

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
node_modules
44
# Dist and query are both build output folders
55
dist*/
6-
!query/
76
# But don't ignore the RTK Query source
8-
!src/query/
97
lib
108
es
11-
yarn.lock
129

1310

1411
.idea/
@@ -20,5 +17,16 @@ build/
2017

2118
typesversions
2219
.cache
23-
.yarn
2420
.yarnrc
21+
.yarn/*
22+
!.yarn/patches
23+
!.yarn/releases
24+
!.yarn/plugins
25+
!.yarn/sdks
26+
!.yarn/versions
27+
.pnp.*
28+
*.tgz
29+
30+
.yalc
31+
yalc.lock
32+
yalc.sig
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/config/webpack.config.js b/config/webpack.config.js
2+
index ba8fd0b9b56a073c6f6173feb9e3154290ceeda2..bf316c8df3b5dd9e862b3b4f02019d449ee06516 100644
3+
--- a/config/webpack.config.js
4+
+++ b/config/webpack.config.js
5+
@@ -24,7 +24,6 @@ const ManifestPlugin = require('webpack-manifest-plugin');
6+
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
7+
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
8+
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
9+
-const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
10+
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
11+
const ESLintPlugin = require('eslint-webpack-plugin');
12+
const paths = require('./paths');
13+
@@ -349,15 +348,6 @@ module.exports = function (webpackEnv) {
14+
// Adds support for installing with Plug'n'Play, leading to faster installs and adding
15+
// guards against forgotten dependencies and such.
16+
PnpWebpackPlugin,
17+
- // Prevents users from importing files from outside of src/ (or node_modules/).
18+
- // This often causes confusion because we only process files within src/ with babel.
19+
- // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
20+
- // please link the files into your node_modules/ and let module-resolution kick in.
21+
- // Make sure your source files are compiled, as they will not be processed in any way.
22+
- new ModuleScopePlugin(paths.appSrc, [
23+
- paths.appPackageJson,
24+
- reactRefreshOverlayEntry,
25+
- ]),
26+
],
27+
},
28+
resolveLoader: {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
name: `@yarnpkg/plugin-compat`,
3+
factory: (require) => {
4+
// we are not using PNP and want to use `typescript@next` in CI without hassle
5+
// dummy implementation to override the built-in version of this plugin
6+
// can be dropped once we switch to yarn 3
7+
return {}
8+
},
9+
}

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Lines changed: 29 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-berry.cjs

Lines changed: 55 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)