@pplancq/react-template 2.1.0 β 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.json +11 -11
- package/public/mockServiceWorker.js +1 -1
- package/scripts/removeDemo.js +1 -1
- package/src/components/App/App.tsx +1 -1
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Footer/__tests__/Footer.test.tsx +2 -2
- package/src/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +1 -0
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/__tests__/Header.test.tsx +2 -2
- package/src/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +2 -0
- package/src/pages/Demo/ReactHookFormDemo/routes.tsx +1 -1
- package/src/pages/Demo/ReactQueryDemo/routes.tsx +1 -1
- package/src/pages/Demo/__tests__/Demo.test.tsx +2 -2
- package/src/pages/Demo/__tests__/__snapshots__/Demo.test.tsx.snap +2 -0
- package/src/pages/Demo/routes.tsx +1 -1
- package/src/pages/Layout/Layout.tsx +1 -1
- package/src/pages/README.md +2 -2
- package/src/pages/UnexpectedError/UnexpectedError.tsx +1 -1
- package/src/routing/README.md +6 -6
- package/src/routing/routerFactory.ts +1 -7
- package/src/routing/routes.tsx +1 -1
- package/src/ui/atoms/NavLink/NavLink.tsx +1 -1
- package/webpack.config.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## @pplancq/react-template [2.2.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.1.0...@pplancq/react-template@2.2.0) (2024-11-26)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **react-template:** migrate to react-router v7 ([fe86866](https://github.com/pplancq/dev-tools/commit/fe868665f1e028d844c2c55a99e856a043baa70c))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **deps:** update react-query mono repo to ^5.61.0 ([ab3e03e](https://github.com/pplancq/dev-tools/commit/ab3e03e0309e9ffc48f405c328410fb81e6325d3))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* **@pplancq/eslint-config:** upgraded to 4.0.3
|
|
15
|
+
* **@pplancq/postcss-config:** upgraded to 2.1.5
|
|
16
|
+
* **@pplancq/webpack-config:** upgraded to 1.7.1
|
|
17
|
+
|
|
1
18
|
## @pplancq/react-template [2.1.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.0.1...@pplancq/react-template@2.1.0) (2024-11-18)
|
|
2
19
|
|
|
3
20
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pplancq/react-template",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "react template",
|
|
6
6
|
"author": "pplancq <paul.plancq@outlook.fr>",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@hookform/resolvers": "^3.9.1",
|
|
40
|
-
"@tanstack/react-query": "^5.
|
|
41
|
-
"@tanstack/react-query-devtools": "^5.
|
|
40
|
+
"@tanstack/react-query": "^5.61.0",
|
|
41
|
+
"@tanstack/react-query-devtools": "^5.61.0",
|
|
42
42
|
"react": "^18.3.1",
|
|
43
43
|
"react-dom": "^18.3.1",
|
|
44
44
|
"react-hook-form": "^7.53.2",
|
|
45
|
-
"react-router
|
|
45
|
+
"react-router": "^7.0.1",
|
|
46
46
|
"yup": "^1.4.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@commitlint/cli": "^19.
|
|
49
|
+
"@commitlint/cli": "^19.6.0",
|
|
50
50
|
"@pplancq/commitlint-config": "*",
|
|
51
51
|
"@pplancq/eslint-config": "*",
|
|
52
52
|
"@pplancq/postcss-config": "*",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
"@vitejs/plugin-react-swc": "^3.7.1",
|
|
62
62
|
"@vitest/coverage-v8": "^2.1.5",
|
|
63
63
|
"concurrently": "^9.1.0",
|
|
64
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.15.0",
|
|
65
65
|
"eslint-plugin-prettier": "^5.2.1",
|
|
66
|
-
"husky": "^9.1.
|
|
66
|
+
"husky": "^9.1.7",
|
|
67
67
|
"jsdom": "^25.0.1",
|
|
68
68
|
"lint-staged": "^15.2.10",
|
|
69
|
-
"msw": "^2.6.
|
|
69
|
+
"msw": "^2.6.5",
|
|
70
70
|
"prettier": "^3.3.3",
|
|
71
71
|
"stylelint": "^16.10.0",
|
|
72
72
|
"stylelint-prettier": "^5.0.2",
|
|
73
73
|
"tsc-files": "^1.1.4",
|
|
74
|
-
"typescript": "^5.
|
|
74
|
+
"typescript": "^5.7.2",
|
|
75
75
|
"vite-plugin-svgr": "^4.3.0",
|
|
76
|
-
"vite-tsconfig-paths": "^5.1.
|
|
76
|
+
"vite-tsconfig-paths": "^5.1.3",
|
|
77
77
|
"vitest": "^2.1.5",
|
|
78
78
|
"vitest-axe": "^1.0.0-pre.3",
|
|
79
79
|
"vitest-sonar-reporter": "^2.0.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"volta": {
|
|
88
88
|
"node": "22.11.0",
|
|
89
|
-
"npm": "10.9.
|
|
89
|
+
"npm": "10.9.1"
|
|
90
90
|
},
|
|
91
91
|
"browserslist": {
|
|
92
92
|
"production": [
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.6.
|
|
11
|
+
const PACKAGE_VERSION = '2.6.6'
|
|
12
12
|
const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
package/scripts/removeDemo.js
CHANGED
|
@@ -34,7 +34,7 @@ mkdirSync(resolveSrc('/pages/Home'));
|
|
|
34
34
|
writeFileSync(resolveSrc('/pages/Home/index.ts'), "export { homeRoutes } from './routes';\n", { encoding: 'utf-8' });
|
|
35
35
|
writeFileSync(
|
|
36
36
|
resolveSrc('/pages/Home/routes.tsx'),
|
|
37
|
-
"import type { RouteObject } from 'react-router
|
|
37
|
+
"import type { RouteObject } from 'react-router';\n" +
|
|
38
38
|
"import { Home } from './Home';\n" +
|
|
39
39
|
'\n' +
|
|
40
40
|
'export const homeRoutes: RouteObject = {\n' +
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { queryClient } from '@Front/config';
|
|
2
2
|
import { withProvider } from '@Front/providers';
|
|
3
3
|
import { createRouter } from '@Front/routing/routerFactory';
|
|
4
|
-
import { RouterProvider } from 'react-router
|
|
4
|
+
import { RouterProvider } from 'react-router';
|
|
5
5
|
|
|
6
6
|
import '@Front/assets/css';
|
|
7
7
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { render } from '@testing-library/react';
|
|
2
|
-
import { BrowserRouter as Router } from 'react-router
|
|
2
|
+
import { BrowserRouter as Router } from 'react-router';
|
|
3
3
|
import { Footer } from '../Footer';
|
|
4
4
|
|
|
5
5
|
describe('Footer Component', () => {
|
|
6
6
|
it('should render the Footer component correctly', () => {
|
|
7
7
|
const { container } = render(
|
|
8
|
-
<Router
|
|
8
|
+
<Router>
|
|
9
9
|
<Footer />
|
|
10
10
|
</Router>,
|
|
11
11
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logo from '@Front/assets/images/logo.png';
|
|
2
2
|
import { Logo } from '@Front/ui/atoms/Logo';
|
|
3
3
|
import { Navigation } from '@Front/ui/molecules/Navigation';
|
|
4
|
-
import { Link } from 'react-router
|
|
4
|
+
import { Link } from 'react-router';
|
|
5
5
|
|
|
6
6
|
import classes from './Header.module.css';
|
|
7
7
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { render } from '@testing-library/react';
|
|
2
|
-
import { BrowserRouter as Router } from 'react-router
|
|
2
|
+
import { BrowserRouter as Router } from 'react-router';
|
|
3
3
|
import { Header } from '../Header';
|
|
4
4
|
|
|
5
5
|
describe('Header Component', () => {
|
|
6
6
|
it('should render the Header component correctly', () => {
|
|
7
7
|
const { container } = render(
|
|
8
|
-
<Router
|
|
8
|
+
<Router>
|
|
9
9
|
<Header />
|
|
10
10
|
</Router>,
|
|
11
11
|
);
|
|
@@ -6,6 +6,7 @@ exports[`Header Component > should render the Header component correctly 1`] = `
|
|
|
6
6
|
class="_container_63c2ea"
|
|
7
7
|
>
|
|
8
8
|
<a
|
|
9
|
+
data-discover="true"
|
|
9
10
|
href="/"
|
|
10
11
|
>
|
|
11
12
|
<img
|
|
@@ -23,6 +24,7 @@ exports[`Header Component > should render the Header component correctly 1`] = `
|
|
|
23
24
|
<a
|
|
24
25
|
aria-current="page"
|
|
25
26
|
class="_a_75d6d6 active"
|
|
27
|
+
data-discover="true"
|
|
26
28
|
href="/"
|
|
27
29
|
>
|
|
28
30
|
Demo
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { render } from '@testing-library/react';
|
|
2
|
-
import { BrowserRouter as Router } from 'react-router
|
|
2
|
+
import { BrowserRouter as Router } from 'react-router';
|
|
3
3
|
import { Demo } from '../Demo';
|
|
4
4
|
|
|
5
5
|
describe('Demo Component', () => {
|
|
6
6
|
it('should render the Demo component correctly', () => {
|
|
7
7
|
const { container } = render(
|
|
8
|
-
<Router
|
|
8
|
+
<Router>
|
|
9
9
|
<Demo />
|
|
10
10
|
</Router>,
|
|
11
11
|
);
|
|
@@ -189,6 +189,7 @@ exports[`Demo Component > should render the Demo component correctly 1`] = `
|
|
|
189
189
|
>
|
|
190
190
|
<a
|
|
191
191
|
class="_a_85a2c3"
|
|
192
|
+
data-discover="true"
|
|
192
193
|
href="/reactQueryDemo"
|
|
193
194
|
>
|
|
194
195
|
Run Demo
|
|
@@ -226,6 +227,7 @@ exports[`Demo Component > should render the Demo component correctly 1`] = `
|
|
|
226
227
|
>
|
|
227
228
|
<a
|
|
228
229
|
class="_a_85a2c3"
|
|
230
|
+
data-discover="true"
|
|
229
231
|
href="/reactHookFormDemo"
|
|
230
232
|
>
|
|
231
233
|
Run Demo
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Footer } from '@Front/components/Footer';
|
|
2
2
|
import { Header } from '@Front/components/Header';
|
|
3
3
|
import { MainTemplate } from '@Front/ui/templates/MainTemplate';
|
|
4
|
-
import { Outlet } from 'react-router
|
|
4
|
+
import { Outlet } from 'react-router';
|
|
5
5
|
|
|
6
6
|
export const Layout = () => {
|
|
7
7
|
return (
|
package/src/pages/README.md
CHANGED
|
@@ -48,8 +48,8 @@ Suppose we have a "UserProfile" page with a complex structure:
|
|
|
48
48
|
// index.ts
|
|
49
49
|
export { userProfileRoutes } from './routes';
|
|
50
50
|
|
|
51
|
-
// routes.tsx (react-router
|
|
52
|
-
import { RouteObject } from 'react-router
|
|
51
|
+
// routes.tsx (react-router v7)
|
|
52
|
+
import { RouteObject } from 'react-router';
|
|
53
53
|
import { UserProfile } from './UserProfile';
|
|
54
54
|
|
|
55
55
|
export const userProfileRoutes: RouteObject = {
|
package/src/routing/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# πrouting
|
|
2
2
|
|
|
3
|
-
The "routing" folder is responsible for managing navigation within the application. We use the `react-router
|
|
3
|
+
The "routing" folder is responsible for managing navigation within the application. We use the `react-router` library to facilitate route creation and navigation between different views of our application.
|
|
4
4
|
|
|
5
5
|
## π Table of Contents
|
|
6
6
|
|
|
7
7
|
- [Folder Organization](#folder-organization)
|
|
8
|
-
- [Using `react-router
|
|
8
|
+
- [Using `react-router`](#react-router)
|
|
9
9
|
- [Using `appRoutes.ts`](#using-appRoutes)
|
|
10
10
|
- [Learn More](#learn-more)
|
|
11
11
|
|
|
@@ -19,13 +19,13 @@ In the "routing" folder, you can find the following files and components:
|
|
|
19
19
|
|
|
20
20
|
3. **`appRoutes.ts`** It contains a simple structure to define the paths of our application.
|
|
21
21
|
|
|
22
|
-
## <span id="react-router
|
|
22
|
+
## <span id="react-router">π§π»βπ» Using `react-router` </span>
|
|
23
23
|
|
|
24
|
-
`react-router
|
|
24
|
+
`react-router` is a library that makes it easy to create routes in a React application. You can import it into the appropriate files to define routes and manage navigation between views. Here's a simple example of its usage:
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
27
|
import { createRoot } from 'react-dom/client';
|
|
28
|
-
import { createBrowserRouter, RouterProvider } from 'react-router
|
|
28
|
+
import { createBrowserRouter, RouterProvider } from 'react-router/dom';
|
|
29
29
|
|
|
30
30
|
const router = createBrowserRouter([
|
|
31
31
|
{
|
|
@@ -62,7 +62,7 @@ export const appRoutes = {
|
|
|
62
62
|
article: '/post/:id',
|
|
63
63
|
};
|
|
64
64
|
// component.tsx
|
|
65
|
-
import { NavLink, generatePath } from 'react-router
|
|
65
|
+
import { NavLink, generatePath } from 'react-router/dom';
|
|
66
66
|
import { appRoutes } from '@Front/routing/appRoutes';
|
|
67
67
|
export const ComponentName = () => {
|
|
68
68
|
return <NavLink to={generatePath(appRoutes.article, { id: 1 })}>link to article 1</NavLink>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createBrowserRouter } from 'react-router
|
|
1
|
+
import { createBrowserRouter } from 'react-router';
|
|
2
2
|
import { routeObject } from './routes';
|
|
3
3
|
|
|
4
4
|
interface CreateRouterProps {
|
|
@@ -8,11 +8,5 @@ interface CreateRouterProps {
|
|
|
8
8
|
export const createRouter = ({ basename }: CreateRouterProps = {}) => {
|
|
9
9
|
return createBrowserRouter(routeObject, {
|
|
10
10
|
basename,
|
|
11
|
-
future: {
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
|
-
// @ts-expect-error
|
|
14
|
-
v7_startTransition: true,
|
|
15
|
-
v7_relativeSplatPath: true,
|
|
16
|
-
},
|
|
17
11
|
});
|
|
18
12
|
};
|
package/src/routing/routes.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { demoRoutes } from '@Front/pages/Demo';
|
|
2
2
|
import { Layout } from '@Front/pages/Layout';
|
|
3
|
-
import type { RouteObject } from 'react-router
|
|
3
|
+
import type { RouteObject } from 'react-router';
|
|
4
4
|
import { UnexpectedError } from 'src/pages/UnexpectedError';
|
|
5
5
|
|
|
6
6
|
export const routeObject: RouteObject[] = [
|
package/webpack.config.js
CHANGED
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
|
15
15
|
// shared: {
|
|
16
16
|
// react: { singleton: true, requiredVersion: deps.react },
|
|
17
17
|
// 'react-dom': { singleton: true, requiredVersion: deps['react-dom'] },
|
|
18
|
-
// 'react-router
|
|
18
|
+
// 'react-router': { singleton: true, requiredVersion: deps['react-router'] },
|
|
19
19
|
// },
|
|
20
20
|
// }),
|
|
21
21
|
// ],
|