@pplancq/react-template 2.0.1 β†’ 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 CHANGED
@@ -1,3 +1,40 @@
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
+
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)
19
+
20
+ ### Features
21
+
22
+ * **react-template:** remove babel config ([c2990a0](https://github.com/pplancq/dev-tools/commit/c2990a08061bed421d85d48d8381f5fd9096d4e5))
23
+ * **react-template:** replace @vitejs/plugin-react by @vitejs/plugin-react-swc ([e613869](https://github.com/pplancq/dev-tools/commit/e613869e5233833d6fe0cd4a9ab67a24ab575db2))
24
+
25
+ ### Bug Fixes
26
+
27
+ * **react-template:** fix warning fron react-router-dom ([6e71da3](https://github.com/pplancq/dev-tools/commit/6e71da3ac8393d2e6975bb84a388499f63947265))
28
+ * **deps:** update dependency react-hook-form to ^7.53.2 ([ea74c8c](https://github.com/pplancq/dev-tools/commit/ea74c8cd15493d60213c4ca6b9979e88c793f11f))
29
+ * **deps:** update react-query mono repo to ^5.60.2 ([d95ce29](https://github.com/pplancq/dev-tools/commit/d95ce290ca9a9730bdeb0ff330897449bf2a0f79))
30
+
31
+
32
+ ### Dependencies
33
+
34
+ * **@pplancq/eslint-config:** upgraded to 4.0.2
35
+ * **@pplancq/postcss-config:** upgraded to 2.1.4
36
+ * **@pplancq/webpack-config:** upgraded to 1.7.0
37
+
1
38
  ## @pplancq/react-template [2.0.1](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.0.0...@pplancq/react-template@2.0.1) (2024-11-11)
2
39
 
3
40
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pplancq/react-template",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "license": "MIT",
5
5
  "description": "react template",
6
6
  "author": "pplancq <paul.plancq@outlook.fr>",
@@ -37,17 +37,16 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@hookform/resolvers": "^3.9.1",
40
- "@tanstack/react-query": "^5.59.20",
41
- "@tanstack/react-query-devtools": "^5.59.20",
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
- "react-hook-form": "^7.53.1",
45
- "react-router-dom": "^6.28.0",
44
+ "react-hook-form": "^7.53.2",
45
+ "react-router": "^7.0.1",
46
46
  "yup": "^1.4.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@commitlint/cli": "^19.5.0",
50
- "@pplancq/babel-config": "*",
49
+ "@commitlint/cli": "^19.6.0",
51
50
  "@pplancq/commitlint-config": "*",
52
51
  "@pplancq/eslint-config": "*",
53
52
  "@pplancq/postcss-config": "*",
@@ -59,23 +58,23 @@
59
58
  "@testing-library/user-event": "^14.5.2",
60
59
  "@types/react": "^18.3.12",
61
60
  "@types/react-dom": "^18.3.1",
62
- "@vitejs/plugin-react": "^4.3.3",
63
- "@vitest/coverage-v8": "^2.1.4",
61
+ "@vitejs/plugin-react-swc": "^3.7.1",
62
+ "@vitest/coverage-v8": "^2.1.5",
64
63
  "concurrently": "^9.1.0",
65
- "eslint": "^9.14.0",
64
+ "eslint": "^9.15.0",
66
65
  "eslint-plugin-prettier": "^5.2.1",
67
- "husky": "^9.1.6",
66
+ "husky": "^9.1.7",
68
67
  "jsdom": "^25.0.1",
69
68
  "lint-staged": "^15.2.10",
70
- "msw": "^2.6.2",
69
+ "msw": "^2.6.5",
71
70
  "prettier": "^3.3.3",
72
71
  "stylelint": "^16.10.0",
73
72
  "stylelint-prettier": "^5.0.2",
74
73
  "tsc-files": "^1.1.4",
75
- "typescript": "^5.6.3",
74
+ "typescript": "^5.7.2",
76
75
  "vite-plugin-svgr": "^4.3.0",
77
- "vite-tsconfig-paths": "^5.1.0",
78
- "vitest": "^2.1.4",
76
+ "vite-tsconfig-paths": "^5.1.3",
77
+ "vitest": "^2.1.5",
79
78
  "vitest-axe": "^1.0.0-pre.3",
80
79
  "vitest-sonar-reporter": "^2.0.0",
81
80
  "webpack": "^5.96.1",
@@ -87,7 +86,7 @@
87
86
  },
88
87
  "volta": {
89
88
  "node": "22.11.0",
90
- "npm": "10.9.0"
89
+ "npm": "10.9.1"
91
90
  },
92
91
  "browserslist": {
93
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.4'
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()
@@ -30,11 +30,8 @@ const getPackageManager = () => {
30
30
  const packageManager = getPackageManager();
31
31
 
32
32
  console.info('\nremove webpack ...');
33
- runCommand(
34
- `${packageManager} remove @pplancq/webpack-config @pplancq/babel-config webpack webpack-cli webpack-dev-server`,
35
- );
33
+ runCommand(`${packageManager} remove @pplancq/webpack-config webpack webpack-cli webpack-dev-server`);
36
34
  rmSync(resolve(__dirname, '../webpack.config.js'));
37
- rmSync(resolve(__dirname, '../babelrc.js'));
38
35
  console.info('\ninstall vite package ...');
39
36
  runCommand(
40
37
  `${packageManager} ${packageManager === YARN ? 'add --dev' : 'install --save-dev'} vite vite-plugin-eslint2 vite-plugin-stylelint sass`,
@@ -42,7 +39,7 @@ runCommand(
42
39
 
43
40
  writeFileSync(
44
41
  resolve(__dirname, '../vite.config.mts'),
45
- `import react from '@vitejs/plugin-react'
42
+ `import react from '@vitejs/plugin-react-swc'
46
43
  import { resolve } from 'path'
47
44
  import { defineConfig, loadEnv } from 'vite'
48
45
  import eslintPlugin from 'vite-plugin-eslint2'
@@ -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-dom';\n" +
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-dom';
4
+ import { RouterProvider } from 'react-router';
5
5
 
6
6
  import '@Front/assets/css';
7
7
 
@@ -1,6 +1,6 @@
1
1
  import logo from '@Front/assets/images/logo.png';
2
2
  import { Logo } from '@Front/ui/atoms/Logo';
3
- import { Link } from 'react-router-dom';
3
+ import { Link } from 'react-router';
4
4
 
5
5
  import classes from './Footer.module.css';
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { render } from '@testing-library/react';
2
- import { BrowserRouter as Router } from 'react-router-dom';
2
+ import { BrowserRouter as Router } from 'react-router';
3
3
  import { Footer } from '../Footer';
4
4
 
5
5
  describe('Footer Component', () => {
@@ -7,6 +7,7 @@ exports[`Footer Component > should render the Footer component correctly 1`] = `
7
7
  >
8
8
  <hr />
9
9
  <a
10
+ data-discover="true"
10
11
  href="/"
11
12
  >
12
13
  <img
@@ -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-dom';
4
+ import { Link } from 'react-router';
5
5
 
6
6
  import classes from './Header.module.css';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { render } from '@testing-library/react';
2
- import { BrowserRouter as Router } from 'react-router-dom';
2
+ import { BrowserRouter as Router } from 'react-router';
3
3
  import { Header } from '../Header';
4
4
 
5
5
  describe('Header Component', () => {
@@ -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,4 +1,4 @@
1
- import { RouteObject } from 'react-router-dom';
1
+ import { RouteObject } from 'react-router';
2
2
  import { ReactHookFormDemo } from './ReactHookFormDemo';
3
3
 
4
4
  export const reactHookFormDemoRoutes: RouteObject = {
@@ -1,4 +1,4 @@
1
- import { RouteObject } from 'react-router-dom';
1
+ import { RouteObject } from 'react-router';
2
2
  import { ReactQueryDemo } from './ReactQueryDemo';
3
3
 
4
4
  export const reactQueryDemoRoutes: RouteObject = {
@@ -1,5 +1,5 @@
1
1
  import { render } from '@testing-library/react';
2
- import { BrowserRouter as Router } from 'react-router-dom';
2
+ import { BrowserRouter as Router } from 'react-router';
3
3
  import { Demo } from '../Demo';
4
4
 
5
5
  describe('Demo Component', () => {
@@ -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,5 +1,5 @@
1
1
  import { reactHookFormDemoRoutes } from '@Front/pages/Demo/ReactHookFormDemo';
2
- import { RouteObject } from 'react-router-dom';
2
+ import { RouteObject } from 'react-router';
3
3
  import { Demo } from './Demo';
4
4
  import { reactQueryDemoRoutes } from './ReactQueryDemo';
5
5
 
@@ -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-dom';
4
+ import { Outlet } from 'react-router';
5
5
 
6
6
  export const Layout = () => {
7
7
  return (
@@ -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-dom v6)
52
- import { RouteObject } from 'react-router-dom';
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 = {
@@ -1,6 +1,6 @@
1
1
  import logo from '@Front/assets/images/logo.png';
2
2
  import { Logo } from '@Front/ui/atoms/Logo';
3
- import { Link, useRouteError } from 'react-router-dom';
3
+ import { Link, useRouteError } from 'react-router';
4
4
 
5
5
  import classes from './UnexpectedError.module.css';
6
6
 
@@ -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-dom` library to facilitate route creation and navigation between different views of our application.
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-dom`](#react-router-dom)
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-dom">πŸ§‘πŸ»β€πŸ’» Using `react-router-dom` </span>
22
+ ## <span id="react-router">πŸ§‘πŸ»β€πŸ’» Using `react-router` </span>
23
23
 
24
- `react-router-dom` 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:
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-dom';
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-dom';
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-dom';
1
+ import { createBrowserRouter } from 'react-router';
2
2
  import { routeObject } from './routes';
3
3
 
4
4
  interface CreateRouterProps {
@@ -6,5 +6,7 @@ interface CreateRouterProps {
6
6
  }
7
7
 
8
8
  export const createRouter = ({ basename }: CreateRouterProps = {}) => {
9
- return createBrowserRouter(routeObject, { basename });
9
+ return createBrowserRouter(routeObject, {
10
+ basename,
11
+ });
10
12
  };
@@ -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-dom';
3
+ import type { RouteObject } from 'react-router';
4
4
  import { UnexpectedError } from 'src/pages/UnexpectedError';
5
5
 
6
6
  export const routeObject: RouteObject[] = [
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from 'react';
2
- import { NavLink as RouterNavLink } from 'react-router-dom';
2
+ import { NavLink as RouterNavLink } from 'react-router';
3
3
 
4
4
  type NavLinkProps = ComponentProps<typeof RouterNavLink>;
5
5
 
package/vitest.config.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
- import react from '@vitejs/plugin-react';
2
+ import react from '@vitejs/plugin-react-swc';
3
3
  import { resolve } from 'path';
4
4
  import { loadEnv } from 'vite';
5
5
  import svgr from 'vite-plugin-svgr';
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-dom': { singleton: true, requiredVersion: deps['react-router-dom'] },
18
+ // 'react-router': { singleton: true, requiredVersion: deps['react-router'] },
19
19
  // },
20
20
  // }),
21
21
  // ],
package/.babelrc.js DELETED
@@ -1 +0,0 @@
1
- module.exports = { extends: '@pplancq/babel-config' };