Skip to content

Commit 45de908

Browse files
committed
Merge branch 'create-slice-creators' into entity-methods-creator
2 parents e888b32 + b10f345 commit 45de908

File tree

204 files changed

+15585
-7650
lines changed

Some content is hidden

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

204 files changed

+15585
-7650
lines changed

.github/workflows/test-codegen.yml

Lines changed: 112 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: RTK-Query OpenAPI Codegen Tests
4+
name: RTKQ OpenAPI Codegen
55
defaults:
66
run:
77
working-directory: ./packages/rtk-query-codegen-openapi
@@ -23,24 +23,128 @@ jobs:
2323
codegen:
2424
- 'packages/rtk-query-codegen-openapi/**'
2525
- 'yarn.lock'
26+
- '.github/workflows/test-codegen.yml'
2627
2728
build:
28-
needs: changes
29+
needs: [changes]
2930
if: ${{ needs.changes.outputs.codegen == 'true' }}
3031

31-
runs-on: ubuntu-latest
32+
defaults:
33+
run:
34+
working-directory: ./packages/rtk-query-codegen-openapi
35+
36+
runs-on: ${{ matrix.os }}
37+
38+
name: 'Build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
3239

3340
strategy:
3441
matrix:
3542
node-version: ['20.x']
43+
os: [ubuntu-latest]
3644

3745
steps:
38-
- uses: actions/checkout@v4
39-
- name: Use Node.js ${{ matrix.node-version }}
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
49+
- name: Setup Node ${{ matrix.node-version }}
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: ${{ matrix.node-version }}
53+
cache: 'yarn'
54+
55+
- name: Install dependencies
56+
run: yarn install
57+
58+
- name: Pack
59+
run: yarn pack
60+
61+
- name: Upload artifact
62+
uses: actions/upload-artifact@v4
63+
id: artifact-upload-step
64+
with:
65+
name: package
66+
path: ./packages/rtk-query-codegen-openapi/package.tgz
67+
68+
- name: Did we fail?
69+
if: failure()
70+
run: ls -lR
71+
72+
test:
73+
needs: build
74+
defaults:
75+
run:
76+
working-directory: ./packages/rtk-query-codegen-openapi
77+
name: 'Test build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
78+
runs-on: ${{ matrix.os }}
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
node-version: [20.x]
83+
os: [ubuntu-latest]
84+
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
89+
- name: Setup Node ${{ matrix.node-version }}
4090
uses: actions/setup-node@v4
4191
with:
42-
node-version: ${{ matrix.node }}
92+
node-version: ${{ matrix.node-version }}
4393
cache: 'yarn'
4494

45-
- run: yarn install
46-
- run: yarn test
95+
- name: Download artifact
96+
id: download-artifact
97+
uses: actions/download-artifact@v4
98+
with:
99+
path: ./packages/rtk-query-codegen-openapi
100+
name: package
101+
102+
- name: Install dependencies
103+
run: yarn install
104+
105+
- name: Install build artifact
106+
run: yarn add ./package.tgz
107+
108+
- name: Remove path alias
109+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json
110+
111+
- name: Run tests
112+
run: yarn test
113+
env:
114+
TEST_DIST: true
115+
116+
- name: Did we fail?
117+
if: failure()
118+
run: ls -R
119+
120+
are-the-types-wrong:
121+
name: Check package definition with are-the-types-wrong
122+
123+
needs: [build]
124+
runs-on: ubuntu-latest
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
node-version: [20.x]
129+
steps:
130+
- name: Checkout repo
131+
uses: actions/checkout@v4
132+
133+
- name: Use node ${{ matrix.node-version }}
134+
uses: actions/setup-node@v4
135+
with:
136+
node-version: ${{ matrix.node-version }}
137+
cache: 'yarn'
138+
139+
- name: Install deps
140+
run: yarn install
141+
142+
- name: Download artifact
143+
id: download-artifact
144+
uses: actions/download-artifact@v4
145+
with:
146+
path: ./packages/rtk-query-codegen-openapi
147+
name: package
148+
149+
- name: Run are-the-types-wrong
150+
run: yarn dlx @arethetypeswrong/cli@latest ./package.tgz --format table

.github/workflows/tests.yml

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,26 @@ jobs:
9292
- name: Install build artifact
9393
run: yarn workspace @reduxjs/toolkit add $(pwd)/package.tgz
9494

95-
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts ./src/tests/*.* ./src/query/tests/*.*
95+
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
9696

9797
- name: Run tests, against dist
98+
env:
99+
TEST_DIST: true
98100
run: yarn test
99101

102+
- name: Run type tests with `moduleResolution Bundler`
103+
run: rm -rf dist && yarn tsc -p . --moduleResolution Bundler --module ESNext --noEmit false --declaration --emitDeclarationOnly --outDir dist --target ESNext && rm -rf dist
104+
100105
test-types:
101-
name: Test Types with TypeScript ${{ matrix.ts }}
106+
name: 'Test Types: TS ${{ matrix.ts }}'
102107

103108
needs: [build]
104109
runs-on: ubuntu-latest
105110
strategy:
106111
fail-fast: false
107112
matrix:
108113
node: ['20.x']
109-
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4']
114+
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
110115
steps:
111116
- name: Checkout repo
112117
uses: actions/checkout@v4
@@ -134,9 +139,11 @@ jobs:
134139
- name: Show installed RTK versions
135140
run: yarn info @reduxjs/toolkit
136141

137-
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts ./src/tests/*.* ./src/query/tests/*.*
142+
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
138143

139144
- name: Test types
145+
env:
146+
TEST_DIST: true
140147
run: |
141148
yarn tsc --version
142149
yarn type-tests
@@ -243,3 +250,54 @@ jobs:
243250

244251
- name: Run are-the-types-wrong
245252
run: yarn attw ./package.tgz --format table --ignore-rules false-cjs
253+
254+
test-type-portability:
255+
name: 'Test Type Portability: TS ${{ matrix.ts }} + Node ${{ matrix.node }}'
256+
needs: [build]
257+
runs-on: ubuntu-latest
258+
strategy:
259+
fail-fast: false
260+
matrix:
261+
node: ['20.x']
262+
ts: ['5.3', '5.4', '5.5', 'next']
263+
example:
264+
[
265+
{ name: 'bundler', moduleResolution: 'Bundler' },
266+
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
267+
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
268+
]
269+
steps:
270+
- name: Checkout repo
271+
uses: actions/checkout@v4
272+
273+
- name: Use node ${{ matrix.node }}
274+
uses: actions/setup-node@v4
275+
with:
276+
node-version: ${{ matrix.node }}
277+
cache: 'yarn'
278+
279+
- name: Install deps
280+
run: yarn install
281+
282+
- uses: actions/download-artifact@v4
283+
with:
284+
name: package
285+
path: packages/toolkit
286+
287+
- name: Install build artifact
288+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz
289+
290+
- name: Install TypeScript ${{ matrix.ts }}
291+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }}
292+
293+
- name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}`
294+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test
295+
296+
- name: Test type portability with `moduleResolution Node10`
297+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
298+
299+
- name: Test type portability with `moduleResolution Node10` and `type module` in `package.json`
300+
if: matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler'
301+
run: |
302+
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
303+
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false

.yarn/patches/console-testing-library-npm-0.6.1-4d9957d402.patch

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1+
diff --git a/package.json b/package.json
2+
index b924e066ecfdb30917b9c1056b360834da357698..15e155bd84f9d16537ffe36f9a87debcb0ec3591 100644
3+
--- a/package.json
4+
+++ b/package.json
5+
@@ -8,12 +8,15 @@
6+
"type": "module",
7+
"main": "dist/index.js",
8+
"typings": "index.d.ts",
9+
+ "types": "index.d.ts",
10+
"exports": {
11+
".": {
12+
+ "types": "./index.d.ts",
13+
"require": "./dist/index.js",
14+
"default": "./src/index.js"
15+
},
16+
"./pure": {
17+
+ "types": "./pure.d.ts",
18+
"require": "./dist/pure.js",
19+
"default": "./src/pure.js"
20+
}
21+
diff --git a/pure.d.ts b/pure.d.ts
22+
index b13bb4eb87d0b316bb51bd6094b2353c6fc8527d..ee01cc9bd3233f5e67b050d48e22202b495a4a0a 100644
23+
--- a/pure.d.ts
24+
+++ b/pure.d.ts
25+
@@ -1 +1 @@
26+
-export * from './';
27+
+export * from './index.js';
128
diff --git a/src/index.js b/src/index.js
229
index 90ff7fa3d7d4fa62dbbf638958ae4e28abd089a8..28434687b5163b7472e86bdb11bed69e0868e660 100644
330
--- a/src/index.js
431
+++ b/src/index.js
532
@@ -1,4 +1,4 @@
633
-import { mockConsole, createConsole } from './pure';
734
+import { mockConsole, createConsole } from './pure.js';
8-
35+
936
// Keep an instance of the original console and export it
1037
const originalConsole = global.console;
1138
diff --git a/src/pure.js b/src/pure.js
@@ -15,7 +42,7 @@ index b00ea2abbaea833e336676aa46e7ced2d59d6d88..42b83ed83fa16cf2234571500fe09868
1542
@@ -228,10 +228,11 @@ export function restore() {
1643
global.console = global.originalConsole;
1744
}
18-
45+
1946
+/*
2047
if (typeof expect === 'function' && typeof expect.extend === 'function') {
2148
expect.extend({
@@ -24,13 +51,13 @@ index b00ea2abbaea833e336676aa46e7ced2d59d6d88..42b83ed83fa16cf2234571500fe09868
2451
+ // Workaround for custom inline snapshot matchers
2552
const error = new Error();
2653
const stacks = error.stack.split('\n');
27-
54+
2855
@@ -245,7 +246,6 @@ if (typeof expect === 'function' && typeof expect.extend === 'function') {
2956
error.stack = stacks.join('\n');
30-
57+
3158
const context = Object.assign(this, { error });
3259
- /* -------------------------------------------------------------- */
33-
60+
3461
const testingConsoleInstance =
3562
(received && received.testingConsole) || received;
3663
@@ -270,3 +270,4 @@ if (typeof expect === 'function' && typeof expect.extend === 'function') {

0 commit comments

Comments
 (0)