Skip to content

Commit b526ee1

Browse files
authored
Merge pull request #3005 from tanem/housekeeping
Migrate examples to vite and latest codesandbox template config
2 parents 5fdd7a3 + 53ac718 commit b526ee1

42 files changed

Lines changed: 566 additions & 74 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.

.github/copilot-instructions.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,31 @@ Managed by Renovate (`config:js-lib` preset):
6060
- Always run `npm test` after changes; use `npm run test:src` for quick
6161
source-only feedback during development
6262

63+
## Examples
64+
65+
Examples live in `examples/` and are designed to open on CodeSandbox. Their
66+
"platform" dependencies (vite, @vitejs/plugin-react, next, typescript,
67+
@types/react, @types/react-dom) must match the official CodeSandbox
68+
sandbox-templates at
69+
https://github.com/codesandbox/sandbox-templates/tree/main.
70+
71+
Reference templates:
72+
73+
- Vite-based examples → `react-vite` / `react-vite-ts`
74+
- Next.js examples → `nextjs`
75+
76+
Renovate is disabled for `examples/**` (via `ignorePaths` in
77+
`renovate.json`). Updates are manual: check the reference template, update all
78+
examples in one commit, and verify at least one example still opens correctly
79+
on CodeSandbox.
80+
81+
Example-specific deps (e.g. `@mui/material`, `react-router-dom`,
82+
`react-transition-group`) are not governed by the templates: update these as
83+
needed but test on CodeSandbox before merging.
84+
85+
Do not bump vite, @vitejs/plugin-react, next, or typescript in examples
86+
beyond the versions in the reference templates.
87+
6388
## Versioning
6489

6590
Strict semver — no breaking changes without a major version bump, including

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ render(<Enhanced isAnimating />, document.getElementById('root'))
9494

9595
## Live Examples
9696

97-
- HOC: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/hoc) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/hoc)
98-
- Material UI: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/material-ui) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/material-ui)
99-
- Multiple Instances: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/multiple-instances) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/multiple-instances)
100-
- Next App Router: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/next-app-router) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/next-app-router)
101-
- Next Pages Router: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/next-pages-router) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/next-pages-router)
102-
- Original Design: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/original-design) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/original-design)
103-
- Plain JS: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/plain-js) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/plain-js)
104-
- React Router V6: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/react-router-v6) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/react-router-v6)
105-
- Render Props: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/render-props) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/render-props)
106-
- UMD Build (Development): [Source](https://github.com/tanem/react-nprogress/tree/master/examples/umd-dev) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/umd-dev)
107-
- UMD Build (Production): [Source](https://github.com/tanem/react-nprogress/tree/master/examples/umd-prod) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/umd-prod)
97+
- HOC: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/hoc) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/hoc)
98+
- Material UI: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/material-ui) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/material-ui)
99+
- Multiple Instances: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/multiple-instances) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/multiple-instances)
100+
- Next App Router: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/next-app-router) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/next-app-router)
101+
- Next Pages Router: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/next-pages-router) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/next-pages-router)
102+
- Original Design: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/original-design) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/original-design)
103+
- Plain JS: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/plain-js) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/plain-js)
104+
- React Router V6: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/react-router-v6) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/react-router-v6)
105+
- Render Props: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/render-props) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/render-props)
106+
- UMD Build (Development): [Source](https://github.com/tanem/react-nprogress/tree/master/examples/umd-dev) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/umd-dev)
107+
- UMD Build (Production): [Source](https://github.com/tanem/react-nprogress/tree/master/examples/umd-prod) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-nprogress/tree/master/examples/umd-prod)
108108

109109
## API
110110

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"setupTasks": [
3+
{
4+
"name": "Update pnpm",
5+
"command": "npm i -g pnpm@latest"
6+
},
7+
{
8+
"name": "Install Dependencies",
9+
"command": "pnpm install"
10+
}
11+
],
12+
"tasks": {
13+
"dev": {
14+
"name": "dev",
15+
"command": "pnpm dev",
16+
"runAtStart": true,
17+
"preview": {
18+
"port": 5173
19+
}
20+
},
21+
"build": {
22+
"name": "build",
23+
"command": "pnpm build",
24+
"runAtStart": false
25+
},
26+
"preview": {
27+
"name": "preview",
28+
"command": "pnpm preview",
29+
"runAtStart": false
30+
},
31+
"install": {
32+
"name": "install dependencies",
33+
"command": "pnpm install"
34+
}
35+
}
36+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Devcontainer",
3+
"image": "ghcr.io/codesandbox/devcontainers/typescript-node:latest"
4+
}

examples/hoc/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
"react-dom": "19.2.4"
1414
},
1515
"devDependencies": {
16-
"@types/react": "19.2.14",
17-
"@types/react-dom": "19.2.3",
18-
"@vitejs/plugin-react": "5.1.4",
19-
"typescript": "5.9.3",
20-
"vite": "7.3.1"
16+
"@types/react": "^19.0.0",
17+
"@types/react-dom": "^19.0.0",
18+
"@vitejs/plugin-react": "^4.3.4",
19+
"typescript": "^5.7.2",
20+
"vite": "^6.0.3"
2121
},
2222
"scripts": {
2323
"dev": "vite",
24-
"build": "tsc -b && vite build",
25-
"preview": "vite preview"
24+
"build": "tsc && vite build",
25+
"preview": "vite preview",
26+
"start": "vite"
2627
}
2728
}

examples/hoc/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"compilerOptions": {
33
"target": "ES2020",
4+
"useDefineForClassFields": true,
45
"lib": ["ES2020", "DOM", "DOM.Iterable"],
56
"module": "ESNext",
6-
"moduleResolution": "bundler",
77
"skipLibCheck": true,
8+
"moduleResolution": "bundler",
9+
"allowImportingTsExtensions": true,
10+
"resolveJsonModule": true,
811
"isolatedModules": true,
12+
"moduleDetection": "force",
913
"noEmit": true,
1014
"jsx": "react-jsx",
1115
"strict": true
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"setupTasks": [
3+
{
4+
"name": "Update pnpm",
5+
"command": "npm i -g pnpm@latest"
6+
},
7+
{
8+
"name": "Install Dependencies",
9+
"command": "pnpm install"
10+
}
11+
],
12+
"tasks": {
13+
"dev": {
14+
"name": "dev",
15+
"command": "pnpm dev",
16+
"runAtStart": true,
17+
"preview": {
18+
"port": 5173
19+
}
20+
},
21+
"build": {
22+
"name": "build",
23+
"command": "pnpm build",
24+
"runAtStart": false
25+
},
26+
"preview": {
27+
"name": "preview",
28+
"command": "pnpm preview",
29+
"runAtStart": false
30+
},
31+
"install": {
32+
"name": "install dependencies",
33+
"command": "pnpm install"
34+
}
35+
}
36+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Devcontainer",
3+
"image": "ghcr.io/codesandbox/devcontainers/typescript-node:latest"
4+
}

examples/material-ui/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
"react-dom": "19.2.4"
1717
},
1818
"devDependencies": {
19-
"@types/react": "19.2.14",
20-
"@types/react-dom": "19.2.3",
21-
"@vitejs/plugin-react": "5.1.4",
22-
"typescript": "5.9.3",
23-
"vite": "7.3.1"
19+
"@types/react": "^19.0.0",
20+
"@types/react-dom": "^19.0.0",
21+
"@vitejs/plugin-react": "^4.3.4",
22+
"typescript": "^5.7.2",
23+
"vite": "^6.0.3"
2424
},
2525
"scripts": {
2626
"dev": "vite",
27-
"build": "tsc -b && vite build",
28-
"preview": "vite preview"
27+
"build": "tsc && vite build",
28+
"preview": "vite preview",
29+
"start": "vite"
2930
}
3031
}

examples/material-ui/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"compilerOptions": {
33
"target": "ES2020",
4+
"useDefineForClassFields": true,
45
"lib": ["ES2020", "DOM", "DOM.Iterable"],
56
"module": "ESNext",
6-
"moduleResolution": "bundler",
77
"skipLibCheck": true,
8+
"moduleResolution": "bundler",
9+
"allowImportingTsExtensions": true,
10+
"resolveJsonModule": true,
811
"isolatedModules": true,
12+
"moduleDetection": "force",
913
"noEmit": true,
1014
"jsx": "react-jsx",
1115
"strict": true

0 commit comments

Comments
 (0)