@pplancq/react-template 2.3.16 → 2.4.1
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 +40 -0
- package/commitlint.config.mjs +3 -0
- package/eslint.config.mjs +7 -0
- package/{.lintstagedrc.js → lint-staged.config.mjs} +1 -1
- package/package.json +22 -21
- package/postcss.config.mjs +5 -0
- package/prettier.config.mjs +5 -0
- package/scripts/lint.js +1 -1
- package/scripts/{migrateToVite.js → migrateToVite.cjs} +64 -18
- package/scripts/{removeDemo.js → removeDemo.cjs} +1 -1
- package/stylelint.config.mjs +3 -0
- package/.commitlintrc.js +0 -1
- package/.postcssrc.js +0 -1
- package/.prettierrc.js +0 -1
- package/.stylelintrc.js +0 -1
- /package/{webpack.config.js → webpack.config.cjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## @pplancq/react-template [2.4.1](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.4.0...@pplancq/react-template@2.4.1) (2025-05-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **deps:** update dependency @tanstack/react-query-devtools to ^5.74.6 ([69d5494](https://github.com/pplancq/dev-tools/commit/69d5494ccff7180150e7ce82689b6aa7012f0edc))
|
|
6
|
+
* **deps:** update dependency react-hook-form to ^7.56.1 ([c1bac28](https://github.com/pplancq/dev-tools/commit/c1bac28d52010e9d52f8268d79bf3d7caa8f56d8))
|
|
7
|
+
* **deps:** update dependency react-router to ^7.5.2 ([91381af](https://github.com/pplancq/dev-tools/commit/91381af3ea604e56f7db91e90e5b346e5ba7ddc9))
|
|
8
|
+
* **deps:** update dependency react-router to ^7.5.3 ([7f27493](https://github.com/pplancq/dev-tools/commit/7f274931028c3ded16b920a9f51e1ff96ed8581d))
|
|
9
|
+
* **react-template:** update migration script to remove webpack configuration file ([fe77fa2](https://github.com/pplancq/dev-tools/commit/fe77fa2e2f4c9549e694d31aca61da29b7156cf9))
|
|
10
|
+
* **deps:** update react-query mono repo to ^5.75.0 ([45f1c7e](https://github.com/pplancq/dev-tools/commit/45f1c7e3d65cc9e28ff7c026ffcc5f2c019db15c))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
* **@pplancq/eslint-config:** upgraded to 4.0.21
|
|
16
|
+
* **@pplancq/postcss-config:** upgraded to 2.1.10
|
|
17
|
+
* **@pplancq/webpack-config:** upgraded to 1.9.12
|
|
18
|
+
|
|
19
|
+
## @pplancq/react-template [2.4.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.3.16...@pplancq/react-template@2.4.0) (2025-04-23)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **react-template:** enhance Vite migration by adding public path configuration and build options ([4bfa14a](https://github.com/pplancq/dev-tools/commit/4bfa14a8f1765f02281742f2d3f189e74460b4e3))
|
|
24
|
+
* **react-template:** improve plugin configuration and update ESLint settings ([a311045](https://github.com/pplancq/dev-tools/commit/a31104522edeeccd252a498348c9fb8d4df2d125))
|
|
25
|
+
* **react-template:** migrate configuration files to ES module syntax and update related scripts ([b9d9bd0](https://github.com/pplancq/dev-tools/commit/b9d9bd04a42a024b276254772765b3ecfeda4415))
|
|
26
|
+
* **react-template:** update file paths and remove obsolete configurations ([d48bbe0](https://github.com/pplancq/dev-tools/commit/d48bbe042c304bc8a708bd0d741613601d0ee9cf))
|
|
27
|
+
* **react-template:** update package scripts for Vite integration and add mock environment support ([e534e40](https://github.com/pplancq/dev-tools/commit/e534e40e5dbcf2c14231b7e6d400b8591ecdffd2))
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **deps:** update dependency react-router to ^7.5.1 ([ae0c0e5](https://github.com/pplancq/dev-tools/commit/ae0c0e579612faf1371644ce3a6d7fa40883993a))
|
|
32
|
+
* **deps:** update react-query mono repo to ^5.74.4 ([8c56b6b](https://github.com/pplancq/dev-tools/commit/8c56b6be39c9e3e932b1a8d994dc676c5068efad))
|
|
33
|
+
* **react-template:** update tsconfig to replace webpack config with vite ([68b87e2](https://github.com/pplancq/dev-tools/commit/68b87e2ce031f771efc0c0f087362242afc3ec73))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Dependencies
|
|
37
|
+
|
|
38
|
+
* **@pplancq/eslint-config:** upgraded to 4.0.20
|
|
39
|
+
* **@pplancq/webpack-config:** upgraded to 1.9.11
|
|
40
|
+
|
|
1
41
|
## @pplancq/react-template [2.3.16](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.3.15...@pplancq/react-template@2.3.16) (2025-04-14)
|
|
2
42
|
|
|
3
43
|
### Bug Fixes
|
package/eslint.config.mjs
CHANGED
|
@@ -11,5 +11,12 @@ export default defineConfig({
|
|
|
11
11
|
'import/no-extraneous-dependencies': 'off',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
files: ['**/*.config.{js,cjs,mjs,ts,cts,mts}'],
|
|
16
|
+
rules: {
|
|
17
|
+
'import/no-default-export': 'off',
|
|
18
|
+
'import/no-extraneous-dependencies': 'off',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
14
21
|
],
|
|
15
22
|
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pplancq/react-template",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "react template",
|
|
6
6
|
"author": "pplancq <paul.plancq@outlook.fr>",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/pplancq/dev-tools",
|
|
10
|
-
"directory": "packages/
|
|
9
|
+
"url": "git+https://github.com/pplancq/dev-tools.git",
|
|
10
|
+
"directory": "packages/react-template"
|
|
11
11
|
},
|
|
12
|
+
"type": "module",
|
|
12
13
|
"scripts": {
|
|
13
14
|
"start": "webpack serve",
|
|
14
15
|
"start:mock": "webpack serve --env FRONT_MOCK_ENABLE=true",
|
|
@@ -24,8 +25,8 @@
|
|
|
24
25
|
"lint:prettier:fix": "prettier \"{mocks,public,src}/**/*.!(js|jsx|mjs|ts|tsx|scss|css)\" --write --ignore-unknown",
|
|
25
26
|
"lint:tsc": "tsc --noEmit",
|
|
26
27
|
"package:check": "npm exec --yes package-lock-utd@1.1.3",
|
|
27
|
-
"remove:demo": "node ./scripts/removeDemo.
|
|
28
|
-
"migrate:vite": "node ./scripts/migrateToVite.
|
|
28
|
+
"remove:demo": "node ./scripts/removeDemo.cjs",
|
|
29
|
+
"migrate:vite": "node ./scripts/migrateToVite.cjs",
|
|
29
30
|
"_prepare": "husky",
|
|
30
31
|
"_postinstall": "msw init"
|
|
31
32
|
},
|
|
@@ -38,12 +39,12 @@
|
|
|
38
39
|
],
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@hookform/resolvers": "^5.0.1",
|
|
41
|
-
"@tanstack/react-query": "^5.
|
|
42
|
-
"@tanstack/react-query-devtools": "^5.
|
|
42
|
+
"@tanstack/react-query": "^5.75.0",
|
|
43
|
+
"@tanstack/react-query-devtools": "^5.75.0",
|
|
43
44
|
"react": "^19.1.0",
|
|
44
45
|
"react-dom": "^19.1.0",
|
|
45
|
-
"react-hook-form": "^7.
|
|
46
|
-
"react-router": "^7.5.
|
|
46
|
+
"react-hook-form": "^7.56.1",
|
|
47
|
+
"react-router": "^7.5.3",
|
|
47
48
|
"yup": "^1.6.1"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
@@ -57,28 +58,28 @@
|
|
|
57
58
|
"@testing-library/jest-dom": "^6.6.3",
|
|
58
59
|
"@testing-library/react": "^16.3.0",
|
|
59
60
|
"@testing-library/user-event": "^14.6.1",
|
|
60
|
-
"@types/react": "^19.1.
|
|
61
|
-
"@types/react-dom": "^19.1.
|
|
62
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
63
|
-
"@vitest/coverage-v8": "^3.1.
|
|
61
|
+
"@types/react": "^19.1.2",
|
|
62
|
+
"@types/react-dom": "^19.1.3",
|
|
63
|
+
"@vitejs/plugin-react-swc": "^3.9.0",
|
|
64
|
+
"@vitest/coverage-v8": "^3.1.2",
|
|
64
65
|
"concurrently": "^9.1.2",
|
|
65
|
-
"eslint": "^9.
|
|
66
|
+
"eslint": "^9.25.1",
|
|
66
67
|
"eslint-plugin-prettier": "^5.2.6",
|
|
67
68
|
"husky": "^9.1.7",
|
|
68
|
-
"jsdom": "^26.
|
|
69
|
-
"lint-staged": "^15.5.
|
|
70
|
-
"msw": "^2.7.
|
|
69
|
+
"jsdom": "^26.1.0",
|
|
70
|
+
"lint-staged": "^15.5.1",
|
|
71
|
+
"msw": "^2.7.5",
|
|
71
72
|
"prettier": "^3.5.3",
|
|
72
|
-
"stylelint": "^16.
|
|
73
|
+
"stylelint": "^16.19.1",
|
|
73
74
|
"stylelint-prettier": "^5.0.3",
|
|
74
75
|
"tsc-files": "^1.1.4",
|
|
75
76
|
"typescript": "^5.8.3",
|
|
76
77
|
"vite-plugin-svgr": "^4.3.0",
|
|
77
78
|
"vite-tsconfig-paths": "^5.1.4",
|
|
78
|
-
"vitest": "^3.1.
|
|
79
|
+
"vitest": "^3.1.2",
|
|
79
80
|
"vitest-axe": "^1.0.0-pre.5",
|
|
80
81
|
"vitest-sonar-reporter": "^2.0.0",
|
|
81
|
-
"webpack": "^5.99.
|
|
82
|
+
"webpack": "^5.99.7",
|
|
82
83
|
"webpack-cli": "^6.0.1",
|
|
83
84
|
"webpack-dev-server": "^5.2.1"
|
|
84
85
|
},
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"node": ">=20.12.2"
|
|
87
88
|
},
|
|
88
89
|
"volta": {
|
|
89
|
-
"node": "22.
|
|
90
|
+
"node": "22.15.0",
|
|
90
91
|
"npm": "11.3.0"
|
|
91
92
|
},
|
|
92
93
|
"browserslist": {
|
package/scripts/lint.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
2
|
+
import concurrently from 'concurrently';
|
|
3
3
|
|
|
4
4
|
const { result } = concurrently(['npm:lint:eslint', 'npm:lint:tsc', 'npm:lint:stylelint', 'npm:lint:prettier'], {
|
|
5
5
|
prefixColors: 'auto',
|
|
@@ -31,7 +31,7 @@ const packageManager = getPackageManager();
|
|
|
31
31
|
|
|
32
32
|
console.info('\nremove webpack ...');
|
|
33
33
|
runCommand(`${packageManager} remove @pplancq/webpack-config webpack webpack-cli webpack-dev-server`);
|
|
34
|
-
rmSync(resolve(__dirname, '../webpack.config.
|
|
34
|
+
rmSync(resolve(__dirname, '../webpack.config.cjs'));
|
|
35
35
|
console.info('\ninstall vite package ...');
|
|
36
36
|
runCommand(
|
|
37
37
|
`${packageManager} ${packageManager === YARN ? 'add --dev' : 'install --save-dev'} vite vite-plugin-eslint2 vite-plugin-stylelint sass`,
|
|
@@ -40,58 +40,104 @@ runCommand(
|
|
|
40
40
|
writeFileSync(
|
|
41
41
|
resolve(__dirname, '../vite.config.mts'),
|
|
42
42
|
`import react from '@vitejs/plugin-react-swc'
|
|
43
|
-
import { resolve } from 'path'
|
|
44
43
|
import { defineConfig, loadEnv } from 'vite'
|
|
45
44
|
import eslintPlugin from 'vite-plugin-eslint2'
|
|
46
45
|
import stylelintPlugin from 'vite-plugin-stylelint'
|
|
47
46
|
import svgr from 'vite-plugin-svgr'
|
|
48
47
|
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
|
48
|
+
import packageJson from './package.json'
|
|
49
|
+
|
|
50
|
+
const resolveModule = (module: string) => {
|
|
51
|
+
try {
|
|
52
|
+
require.resolve(module);
|
|
53
|
+
return true;
|
|
54
|
+
} catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
49
58
|
|
|
50
59
|
export default defineConfig(({ mode }) => {
|
|
51
60
|
const env = loadEnv(mode, process.cwd(), '')
|
|
52
61
|
|
|
62
|
+
const disableStyleLintPlugin =
|
|
63
|
+
(env.DISABLE_STYLELINT_PLUGIN ?? 'false') === 'true' || !resolveModule('stylelint');
|
|
64
|
+
const disableEsLintPlugin =
|
|
65
|
+
(env.DISABLE_ESLINT_PLUGIN ?? 'false') === 'true' || !resolveModule('eslint');
|
|
66
|
+
const publicUrl = env.PUBLIC_URL ?? packageJson.homepage ?? '/';
|
|
67
|
+
const publicPath = mode === 'development'
|
|
68
|
+
? '/'
|
|
69
|
+
: new URL(publicUrl.endsWith('/') ? publicUrl : \`\${publicUrl}/\`, 'http://localhost').pathname;
|
|
70
|
+
|
|
53
71
|
return {
|
|
54
72
|
plugins: [
|
|
55
73
|
react(),
|
|
56
74
|
viteTsconfigPaths(),
|
|
57
75
|
svgr(),
|
|
58
|
-
eslintPlugin({
|
|
76
|
+
!disableEsLintPlugin && eslintPlugin({
|
|
59
77
|
emitErrorAsWarning: true,
|
|
60
78
|
cache: false
|
|
61
79
|
}),
|
|
62
|
-
stylelintPlugin({
|
|
80
|
+
!disableStyleLintPlugin && stylelintPlugin({
|
|
63
81
|
emitErrorAsWarning: true,
|
|
64
82
|
cache: false
|
|
65
83
|
})
|
|
66
|
-
],
|
|
84
|
+
].filter(Boolean),
|
|
67
85
|
envPrefix: env.ENV_PREFIX ?? 'FRONT_',
|
|
86
|
+
base: publicPath,
|
|
68
87
|
server: {
|
|
69
|
-
port: parseInt(
|
|
70
|
-
open: (
|
|
71
|
-
},
|
|
72
|
-
root: resolve(__dirname, 'public'),
|
|
73
|
-
publicDir: resolve(__dirname, 'public'),
|
|
74
|
-
resolve: {
|
|
75
|
-
alias: { '/src': resolve(__dirname, 'src') }
|
|
88
|
+
port: parseInt(env.PORT ?? '3000', 10),
|
|
89
|
+
open: (env.BROWSER ?? 'false') === 'true'
|
|
76
90
|
},
|
|
77
91
|
build: {
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
sourcemap: (env.DISABLE_SOURCE_MAP ?? 'false') !== 'true',
|
|
93
|
+
outDir: 'build',
|
|
94
|
+
},
|
|
80
95
|
}
|
|
81
96
|
})
|
|
82
97
|
`,
|
|
83
98
|
{ encoding: 'utf-8' },
|
|
84
99
|
);
|
|
85
100
|
|
|
101
|
+
let tsconfig = readFileSync(resolve(__dirname, '../tsconfig.json'), { encoding: 'utf-8' });
|
|
102
|
+
tsconfig = tsconfig.replace('@pplancq/webpack-config', 'vite/client');
|
|
103
|
+
writeFileSync(resolve(__dirname, '../tsconfig.json'), tsconfig, { encoding: 'utf-8' });
|
|
104
|
+
|
|
86
105
|
const packagesJson = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), { encoding: 'utf-8' }));
|
|
87
|
-
const { start, build, 'migrate:vite':
|
|
88
|
-
packagesJson.scripts = {
|
|
106
|
+
const { start, build, 'migrate:vite': a, 'start:mock': b, ...scripts } = packagesJson.scripts;
|
|
107
|
+
packagesJson.scripts = {
|
|
108
|
+
start: 'vite',
|
|
109
|
+
build: 'vite build',
|
|
110
|
+
preview: 'vite preview',
|
|
111
|
+
'start:mock': 'vite --mode mock',
|
|
112
|
+
...scripts,
|
|
113
|
+
};
|
|
89
114
|
writeFileSync(resolve(__dirname, '../package.json'), JSON.stringify(packagesJson, null, 2), { encoding: 'utf-8' });
|
|
90
115
|
|
|
91
116
|
let indexHTML = readFileSync(resolve(__dirname, '../public/index.html'), { encoding: 'utf-8' });
|
|
92
117
|
indexHTML = indexHTML.replace(' </body>', ' <script type="module" src="/src/main.ts"></script>\n </body>');
|
|
93
|
-
writeFileSync(resolve(__dirname, '../
|
|
118
|
+
writeFileSync(resolve(__dirname, '../index.html'), indexHTML, { encoding: 'utf-8' });
|
|
119
|
+
rmSync(resolve(__dirname, '../public/index.html'));
|
|
120
|
+
|
|
121
|
+
let envFile = readFileSync(resolve(__dirname, '../.env'), { encoding: 'utf-8' });
|
|
122
|
+
envFile = envFile.replace(
|
|
123
|
+
`
|
|
124
|
+
|
|
125
|
+
# Specify the type of configuration to use with ESLint.
|
|
126
|
+
# - 'eslintrc' is the classic configuration format available in most ESLint versions.
|
|
127
|
+
# - 'flat' is the new format introduced in ESLint 8.21.0.
|
|
128
|
+
# Default is 'eslintrc'
|
|
129
|
+
ESLINT_CONFIG_TYPE='flat'`,
|
|
130
|
+
'',
|
|
131
|
+
);
|
|
132
|
+
writeFileSync(resolve(__dirname, '../.env'), envFile, { encoding: 'utf-8' });
|
|
133
|
+
|
|
134
|
+
writeFileSync(
|
|
135
|
+
resolve(__dirname, '../.env.mock'),
|
|
136
|
+
`FRONT_MOCK_ENABLE=true
|
|
137
|
+
`,
|
|
138
|
+
{ encoding: 'utf-8' },
|
|
139
|
+
);
|
|
94
140
|
|
|
95
|
-
rmSync(resolve(__dirname, '../scripts/migrateToVite.
|
|
141
|
+
rmSync(resolve(__dirname, '../scripts/migrateToVite.cjs'));
|
|
96
142
|
|
|
97
143
|
console.info('\nThe application has been migrate to vite');
|
|
@@ -83,6 +83,6 @@ const { 'remove:demo': _, ...scripts } = packagesJson.scripts;
|
|
|
83
83
|
packagesJson.scripts = { ...scripts };
|
|
84
84
|
writeFileSync(resolve(__dirname, '../package.json'), JSON.stringify(packagesJson, null, 2), { encoding: 'utf-8' });
|
|
85
85
|
|
|
86
|
-
rmSync(resolve(__dirname, '../scripts/removeDemo.
|
|
86
|
+
rmSync(resolve(__dirname, '../scripts/removeDemo.cjs'));
|
|
87
87
|
|
|
88
88
|
console.info('\nThe demo application has been removed\n');
|
package/.commitlintrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: ['@pplancq/commitlint-config'] };
|
package/.postcssrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@pplancq/postcss-config');
|
package/.prettierrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@pplancq/prettier-config');
|
package/.stylelintrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: ['@pplancq/stylelint-config/prettier'] };
|
|
File without changes
|