Skip to content

Commit 73fb291

Browse files
committed
Add Next example
1 parent 670c365 commit 73fb291

34 files changed

+4958
-1
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
fail-fast: false
140140
matrix:
141141
node: ['16.x']
142-
example: ['cra4', 'cra5']
142+
example: ['cra4', 'cra5', 'next']
143143
defaults:
144144
run:
145145
working-directory: ./examples/publish-ci/${{ matrix.example }}

examples/publish-ci/next/.eslintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
extends: ['react-app', 'prettier'],
3+
parser: '@typescript-eslint/parser',
4+
rules: {
5+
'jsx-a11y/href-no-hash': 'off',
6+
'react/react-in-jsx-scope': 'off',
7+
// Taken care of by TypeScript's `noUnusedLocals` / `noUnusedParameters`
8+
'no-unused-vars': 'off',
9+
'@typescript-eslint/no-unused-vars': 'off',
10+
// Silence some bizarre "rule not found" TSLint error
11+
'@typescript-eslint/no-angle-bracket-type-assertion': 'off',
12+
'no-redeclare': 'off',
13+
// Silence some bizarre "rule not found" TSLint error
14+
'@typescript-eslint/no-redeclare': 'off',
15+
'no-use-before-define': 'off',
16+
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
17+
'@typescript-eslint/consistent-type-imports': ['off'],
18+
'react-hooks/exhaustive-deps': [
19+
'warn',
20+
{
21+
additionalHooks: '(usePossiblyImmediateEffect)',
22+
},
23+
],
24+
},
25+
}

examples/publish-ci/next/.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yalc
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
.pnpm-debug.log*
28+
29+
# local env files
30+
.env*.local
31+
32+
# vercel
33+
.vercel
34+
35+
# typescript
36+
*.tsbuildinfo
37+
next-env.d.ts
38+
39+
typesversions
40+
.cache
41+
.yarnrc
42+
.yarn/*
43+
!.yarn/patches
44+
!.yarn/releases
45+
!.yarn/plugins
46+
!.yarn/sdks
47+
!.yarn/versions
48+
.pnp.*
49+
*.tgz

examples/publish-ci/next/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Redux Toolkit TypeScript Example
2+
3+
This example shows how to integrate Next.js with [Redux Toolkit](https://redux-toolkit.js.org).
4+
5+
The **Redux Toolkit** is a standardized way to write Redux logic (create actions and reducers, setup the store with some default middlewares like redux devtools extension). This example demonstrates each of these features with Next.js
6+
7+
## Deploy your own
8+
9+
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
10+
11+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-redux&project-name=with-redux&repository-name=with-redux)
12+
13+
## How to use
14+
15+
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
16+
17+
```bash
18+
npx create-next-app --example with-redux with-redux-app
19+
```
20+
21+
```bash
22+
yarn create next-app --example with-redux with-redux-app
23+
```
24+
25+
```bash
26+
pnpm create next-app --example with-redux with-redux-app
27+
```
28+
29+
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

examples/publish-ci/next/package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "next",
5+
"build": "next build",
6+
"start": "next start",
7+
"type-check": "tsc",
8+
"serve-app": "yarn start",
9+
"test": "yarn playwright test",
10+
"format": "prettier --write \"./src/**/*.{ts,tsx}\" \"**/*.md\""
11+
},
12+
"dependencies": {
13+
"@reduxjs/toolkit": "^1.9.3",
14+
"msw": "^0.49.2",
15+
"next": "^13.2",
16+
"react": "^18.2.0",
17+
"react-dom": "^18.2.0",
18+
"react-redux": "^8.0.2"
19+
},
20+
"devDependencies": {
21+
"@playwright/test": "^1.31.1",
22+
"@testing-library/jest-dom": "^5.16.5",
23+
"@testing-library/react": "^13.4.0",
24+
"@testing-library/user-event": "^14.4.3",
25+
"@types/jest": "^27.5.2",
26+
"@types/node": "^17.0.45",
27+
"@types/react": "^18.0.26",
28+
"@types/react-dom": "^18.0.10",
29+
"playwright": "^1.31.1",
30+
"prettier": "^2.8.4",
31+
"serve": "^14.2.0",
32+
"typescript": "^4.9.4"
33+
},
34+
"msw": {
35+
"workerDirectory": "public"
36+
}
37+
}
3.5 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)