@pplancq/react-template 2.10.0 → 2.10.2
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/.env.mock +1 -1
- package/.prettierignore +8 -0
- package/.stylelintignore +4 -0
- package/CHANGELOG.md +41 -0
- package/_README.md +2 -2
- package/bin/template-install.js +8 -8
- package/commitlint.config.mjs +1 -1
- package/eslint.config.mjs +12 -9
- package/lint-staged.config.mjs +5 -5
- package/mise.toml +2 -2
- package/mocks/handlers/userHandlers.ts +1 -3
- package/mrc.playwright.config.ts +14 -14
- package/package.json +20 -22
- package/playwright.config.ts +21 -21
- package/prettier.config.mjs +1 -1
- package/rsbuild.config.ts +23 -23
- package/scripts/lint.js +4 -4
- package/scripts/playwright.js +19 -19
- package/scripts/removeDemo.cjs +115 -89
- package/scripts/test.js +6 -6
- package/src/app/App.tsx +5 -7
- package/src/app/assets/css/reset.css +3 -3
- package/src/app/providers/Providers/Providers.tsx +5 -7
- package/src/app/providers/QueryClientProvider/QueryClientProvider.tsx +6 -8
- package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCase.ts +1 -3
- package/src/demo/application/use-cases/GetDemoUsersUseCase.ts +1 -3
- package/src/demo/infrastructure/repositories/StaticArchitecturePrincipleRepository.ts +1 -3
- package/src/demo/ui/components/DemoFooter/DemoFooter.tsx +8 -10
- package/src/demo/ui/components/DemoHeader/DemoHeader.module.css +2 -2
- package/src/demo/ui/components/DemoHeader/DemoHeader.tsx +15 -17
- package/src/demo/ui/components/DemoNavigation/DemoNavigation.module.css +2 -2
- package/src/demo/ui/components/Input/Input.module.scss +2 -2
- package/src/demo/ui/components/Logo/Logo.tsx +3 -3
- package/src/demo/ui/forms/ProfileForm/ProfileForm.module.scss +1 -1
- package/src/demo/ui/layouts/DemoLayout/DemoLayout.tsx +5 -7
- package/src/demo/ui/layouts/MainTemplate/MainTemplate.module.css +3 -3
- package/src/demo/ui/layouts/MainTemplate/MainTemplate.tsx +10 -12
- package/src/demo/ui/pages/DemoHome/DemoHome.module.scss +23 -23
- package/src/demo/ui/pages/DemoHome/DemoHome.tsx +96 -98
- package/src/demo/ui/pages/DependencyInjectionDemo/DependencyInjectionDemo.module.scss +5 -5
- package/src/demo/ui/pages/ReactHookFormDemo/ReactHookFormDemo.module.scss +4 -4
- package/src/demo/ui/pages/ReactQueryDemo/ReactQueryDemo.module.scss +5 -5
- package/stylelint.config.mjs +1 -1
- package/vitest.config.mts +22 -22
- package/vitest.setup.ts +5 -5
- package/playwright-report/html/index.html +0 -90
- package/playwright-report/sonar-results.xml +0 -20
- package/test-results/.last-run.json +0 -4
package/.env.mock
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
FRONT_MOCK_ENABLE=true
|
|
1
|
+
FRONT_MOCK_ENABLE=true
|
package/.prettierignore
ADDED
package/.stylelintignore
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
## 2.10.2 (2026-08-14)
|
|
2
|
+
|
|
3
|
+
### 🐞 Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **react-template:** remove demo tests and format generated files after remove:demo ([#1851](https://github.com/pplancq/dev-tools/pull/1851))
|
|
6
|
+
- **react-template:** remove deprecated prettier integration ([c3522b56](https://github.com/pplancq/dev-tools/commit/c3522b56))
|
|
7
|
+
|
|
8
|
+
### 📦 Dependencies
|
|
9
|
+
|
|
10
|
+
- Updated @pplancq/commitlint-config to 4.0.5
|
|
11
|
+
- Updated @pplancq/stylelint-config to 6.1.0
|
|
12
|
+
- Updated @pplancq/prettier-config to 4.0.1
|
|
13
|
+
- Updated @pplancq/eslint-config to 6.1.0
|
|
14
|
+
- **deps:** update testing-library monorepo ([#1853](https://github.com/pplancq/dev-tools/pull/1853))
|
|
15
|
+
- **deps:** update dependency react-hook-form to ^7.85.0 ([#1860](https://github.com/pplancq/dev-tools/pull/1860))
|
|
16
|
+
- **deps:** update dependency @hookform/resolvers to ^5.7.1 ([#1857](https://github.com/pplancq/dev-tools/pull/1857))
|
|
17
|
+
|
|
18
|
+
### ❤️ Thank You
|
|
19
|
+
|
|
20
|
+
- Paul PLANCQ
|
|
21
|
+
|
|
22
|
+
## 2.10.1 (2026-08-03)
|
|
23
|
+
|
|
24
|
+
### ♻️ Code Refactoring
|
|
25
|
+
|
|
26
|
+
- **dev-tools:** update arrow function parentheses for consistency ([0104ebf](https://github.com/pplancq/dev-tools/commit/0104ebf))
|
|
27
|
+
- **dev-tools:** update quotes to double quotes for consistency ([6b2d557](https://github.com/pplancq/dev-tools/commit/6b2d557))
|
|
28
|
+
|
|
29
|
+
### 📦 Dependencies
|
|
30
|
+
|
|
31
|
+
- Updated @pplancq/commitlint-config to 4.0.4
|
|
32
|
+
- Updated @pplancq/stylelint-config to 6.0.0
|
|
33
|
+
- Updated @pplancq/prettier-config to 4.0.0
|
|
34
|
+
- Updated @pplancq/eslint-config to 6.0.19
|
|
35
|
+
- **deps:** update dependency @playwright/test to ^1.62.1 ([#1841](https://github.com/pplancq/dev-tools/pull/1841))
|
|
36
|
+
- **deps:** update dependency @hookform/resolvers to ^5.5.7 ([#1842](https://github.com/pplancq/dev-tools/pull/1842))
|
|
37
|
+
|
|
38
|
+
### ❤️ Thank You
|
|
39
|
+
|
|
40
|
+
- Paul PLANCQ
|
|
41
|
+
|
|
1
42
|
## 2.10.0 (2026-07-28)
|
|
2
43
|
|
|
3
44
|
### 🎉 Features
|
package/_README.md
CHANGED
|
@@ -170,13 +170,13 @@ The tests folder may contain unit tests specific to the package. The idea is to
|
|
|
170
170
|
This file allows exposing the component and avoids having to redo imports if the file implementing the component changes its name.
|
|
171
171
|
|
|
172
172
|
```typescript
|
|
173
|
-
export { ComponentName } from
|
|
173
|
+
export { ComponentName } from "./ComponentName";
|
|
174
174
|
```
|
|
175
175
|
|
|
176
176
|
This will allow importing a component like this:
|
|
177
177
|
|
|
178
178
|
```typescript
|
|
179
|
-
import { ComponentName } from
|
|
179
|
+
import { ComponentName } from "@Demo/ui/components/ComponentName";
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
#### 📄 ComponentName.tsx
|
package/bin/template-install.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync, renameSync, rmSync, writeFileSync } from
|
|
3
|
-
import { resolve } from
|
|
4
|
-
import { fileURLToPath } from
|
|
2
|
+
import { readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
|
-
const repoDir = resolve(fileURLToPath(import.meta.url),
|
|
7
|
-
const projectName = process.argv[2] ||
|
|
6
|
+
const repoDir = resolve(fileURLToPath(import.meta.url), "../..");
|
|
7
|
+
const projectName = process.argv[2] || "react-app";
|
|
8
8
|
|
|
9
|
-
const repoPackageJson = JSON.parse(readFileSync(resolve(repoDir,
|
|
9
|
+
const repoPackageJson = JSON.parse(readFileSync(resolve(repoDir, "package.json"), { encoding: "utf-8" }));
|
|
10
10
|
|
|
11
11
|
repoPackageJson.name = projectName;
|
|
12
12
|
repoPackageJson.description = projectName;
|
|
13
13
|
const { _prepare, _postinstall, ...scripts } = repoPackageJson.scripts;
|
|
14
14
|
repoPackageJson.scripts = { ...scripts, prepare: _prepare, postinstall: _postinstall };
|
|
15
|
-
repoPackageJson.version =
|
|
15
|
+
repoPackageJson.version = "0.1.0";
|
|
16
16
|
delete repoPackageJson.author;
|
|
17
17
|
delete repoPackageJson.repository;
|
|
18
18
|
delete repoPackageJson.bugs;
|
|
@@ -20,7 +20,7 @@ delete repoPackageJson.keywords;
|
|
|
20
20
|
delete repoPackageJson.engines;
|
|
21
21
|
delete repoPackageJson.bin;
|
|
22
22
|
|
|
23
|
-
writeFileSync(resolve(repoDir,
|
|
23
|
+
writeFileSync(resolve(repoDir, "package.json"), JSON.stringify(repoPackageJson, null, 2), { encoding: "utf-8" });
|
|
24
24
|
|
|
25
25
|
renameSync(`${repoDir}/_gitignore`, `${repoDir}/.gitignore`);
|
|
26
26
|
renameSync(`${repoDir}/_README.md`, `${repoDir}/README.md`);
|
package/commitlint.config.mjs
CHANGED
package/eslint.config.mjs
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
1
|
+
import { defineConfig } from "@pplancq/eslint-config";
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
enableReact: true,
|
|
5
|
-
enablePrettier: 'on',
|
|
6
5
|
enableVitest: true,
|
|
7
|
-
unitTestFiles: [
|
|
6
|
+
unitTestFiles: ["src/**/*.{test,spec,steps}.{js,jsx,ts,tsx}"],
|
|
8
7
|
enablePlaywright: true,
|
|
9
|
-
unitE2eFiles: [
|
|
8
|
+
unitE2eFiles: ["tests/**/*.{test,spec}.{js,jsx,ts,tsx}"],
|
|
9
|
+
enablePrettier: "disableStyleOnly",
|
|
10
10
|
extendConfig: [
|
|
11
11
|
{
|
|
12
|
-
|
|
12
|
+
ignores: ["build"],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
files: ["mocks/**/*"],
|
|
13
16
|
rules: {
|
|
14
|
-
|
|
17
|
+
"import/no-extraneous-dependencies": "off",
|
|
15
18
|
},
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
|
-
files: [
|
|
21
|
+
files: ["**/*.config.{js,cjs,mjs,ts,cts,mts}"],
|
|
19
22
|
rules: {
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
"import/no-default-export": "off",
|
|
24
|
+
"import/no-extraneous-dependencies": "off",
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
],
|
package/lint-staged.config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"*.{js,jsx,mjs,ts,tsx}": "eslint --fix",
|
|
3
|
+
"*.{ts,tsx}": "tsc-files --noEmit",
|
|
4
|
+
"*.{scss,css}": "stylelint --fix",
|
|
5
|
+
"*": "prettier --write --ignore-unknown",
|
|
6
|
+
"(package|package-lock).json": "npm run package:check",
|
|
7
7
|
};
|
package/mise.toml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
[tools]
|
|
2
|
-
node = "24.
|
|
3
|
-
npm = "12.0.
|
|
2
|
+
node = "24.19.0"
|
|
3
|
+
npm = "12.0.2"
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { users } from "@Mocks/fixtures/user";
|
|
2
2
|
import { http, HttpResponse } from "msw";
|
|
3
3
|
|
|
4
|
-
export const getUsers200 = http.get("*/users", () =>
|
|
5
|
-
return HttpResponse.json(users);
|
|
6
|
-
});
|
|
4
|
+
export const getUsers200 = http.get("*/users", () => HttpResponse.json(users));
|
package/mrc.playwright.config.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { CoverageReportOptions } from
|
|
1
|
+
import { CoverageReportOptions } from "monocart-coverage-reports";
|
|
2
2
|
|
|
3
3
|
export const coverageOptions: CoverageReportOptions = {
|
|
4
4
|
enabled: process.env.CI ?? process.env.ENABLED_COVERAGE,
|
|
5
|
-
name:
|
|
6
|
-
outputDir:
|
|
7
|
-
baseDir:
|
|
5
|
+
name: "Playwright Coverage Report",
|
|
6
|
+
outputDir: "./playwright-report/coverage",
|
|
7
|
+
baseDir: "./src/",
|
|
8
8
|
reports: [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
9
|
+
"text",
|
|
10
|
+
"text-summary",
|
|
11
|
+
["html", { subdir: "html-coverage" }],
|
|
12
|
+
["lcovonly", { file: "lcov-coverage.info" }],
|
|
13
|
+
["cobertura", { file: "cobertura-coverage.xml" }],
|
|
14
14
|
],
|
|
15
15
|
sourceFilter: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
"**/node_modules/**": false,
|
|
17
|
+
"**/mocks/**": false,
|
|
18
|
+
"**/*.{test,spec,steps}.{js,jsx,ts,tsx}": false,
|
|
19
|
+
"vitest.setup.ts": false,
|
|
20
|
+
"**/*.{js,jsx,ts,tsx}": true,
|
|
21
21
|
},
|
|
22
22
|
watermarks: {
|
|
23
23
|
statements: [80, 90],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pplancq/react-template",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "react template",
|
|
6
6
|
"author": "pplancq <paul.plancq@outlook.fr>",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"bin": {
|
|
14
14
|
"template-install": "bin/template-install.js"
|
|
15
15
|
},
|
|
16
|
-
"packageManager": "npm@12.0.
|
|
16
|
+
"packageManager": "npm@12.0.2",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "rsbuild dev",
|
|
19
19
|
"start:mock": "rsbuild dev --env-mode mock",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"test:e2e:watch": "node scripts/playwright.js test --watch",
|
|
27
27
|
"test:e2e:ui": "node scripts/playwright.js test --ui",
|
|
28
28
|
"lint": "node scripts/lint.js",
|
|
29
|
-
"lint:eslint": "eslint \"{
|
|
30
|
-
"lint:eslint:fix": "eslint \"{
|
|
31
|
-
"lint:stylelint": "stylelint \"
|
|
32
|
-
"lint:stylelint:fix": "stylelint \"
|
|
33
|
-
"lint:prettier": "prettier
|
|
34
|
-
"lint:prettier:fix": "prettier
|
|
29
|
+
"lint:eslint": "eslint \"**/*.{js,jsx,mjs,ts,tsx}\"",
|
|
30
|
+
"lint:eslint:fix": "eslint \"**/*.{js,jsx,mjs,ts,tsx}\" --fix",
|
|
31
|
+
"lint:stylelint": "stylelint \"**/*.{scss,css}\"",
|
|
32
|
+
"lint:stylelint:fix": "stylelint \"**/*.{scss,css}\" --fix",
|
|
33
|
+
"lint:prettier": "prettier . --check --ignore-unknown",
|
|
34
|
+
"lint:prettier:fix": "prettier . --write --ignore-unknown",
|
|
35
35
|
"lint:tsc": "tsc --noEmit",
|
|
36
36
|
"playwright:install": "playwright install",
|
|
37
37
|
"playwright:show-report": "playwright show-report",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"template"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@hookform/resolvers": "^5.
|
|
52
|
+
"@hookform/resolvers": "^5.7.1",
|
|
53
53
|
"@tanstack/react-query": "^5.101.4",
|
|
54
54
|
"@tanstack/react-query-devtools": "^5.101.4",
|
|
55
55
|
"inversify": "^8.2.3",
|
|
56
56
|
"react": "^19.2.8",
|
|
57
57
|
"react-dom": "^19.2.8",
|
|
58
|
-
"react-hook-form": "^7.
|
|
58
|
+
"react-hook-form": "^7.85.0",
|
|
59
59
|
"react-router": "^8.3.0",
|
|
60
60
|
"yup": "^1.7.1"
|
|
61
61
|
},
|
|
@@ -63,35 +63,33 @@
|
|
|
63
63
|
"@bdellegrazie/playwright-sonar-reporter": "^0.5.2",
|
|
64
64
|
"@commitlint/cli": "^21.2.1",
|
|
65
65
|
"@msw/playwright": "^0.6.7",
|
|
66
|
-
"@playwright/test": "^1.
|
|
66
|
+
"@playwright/test": "^1.62.1",
|
|
67
67
|
"@pplancq/commitlint-config": "*",
|
|
68
68
|
"@pplancq/eslint-config": "*",
|
|
69
69
|
"@pplancq/prettier-config": "*",
|
|
70
70
|
"@pplancq/stylelint-config": "*",
|
|
71
|
-
"@rsbuild/core": "^2.1.
|
|
71
|
+
"@rsbuild/core": "^2.1.10",
|
|
72
72
|
"@rsbuild/plugin-eslint": "^2.0.2",
|
|
73
73
|
"@rsbuild/plugin-react": "^2.1.0",
|
|
74
74
|
"@rsbuild/plugin-sass": "^2.0.1",
|
|
75
|
-
"@testing-library/jest-dom": "^7.0.
|
|
75
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
76
76
|
"@testing-library/react": "^16.3.2",
|
|
77
|
-
"@testing-library/user-event": "^14.6.
|
|
78
|
-
"@types/react": "^19.2.
|
|
79
|
-
"@types/react-dom": "^19.2.
|
|
80
|
-
"@vitejs/plugin-react": "^6.0.
|
|
77
|
+
"@testing-library/user-event": "^14.6.3",
|
|
78
|
+
"@types/react": "^19.2.18",
|
|
79
|
+
"@types/react-dom": "^19.2.4",
|
|
80
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
81
81
|
"@vitest/coverage-v8": "^4.1.10",
|
|
82
|
-
"concurrently": "^10.0.
|
|
82
|
+
"concurrently": "^10.0.4",
|
|
83
83
|
"eslint": "^9.39.5",
|
|
84
|
-
"eslint-plugin-prettier": "^5.5.6",
|
|
85
84
|
"husky": "^9.1.7",
|
|
86
|
-
"jsdom": "^
|
|
87
|
-
"lint-staged": "^17.
|
|
85
|
+
"jsdom": "^30.0.1",
|
|
86
|
+
"lint-staged": "^17.3.0",
|
|
88
87
|
"monocart-coverage-reports": "^2.12.12",
|
|
89
88
|
"msw": "^2.15.0",
|
|
90
89
|
"nodemon": "^3.1.14",
|
|
91
90
|
"prettier": "^3.9.6",
|
|
92
91
|
"rsbuild-plugin-stylelint": "^1.2.0",
|
|
93
92
|
"stylelint": "^17.14.1",
|
|
94
|
-
"stylelint-prettier": "^5.0.3",
|
|
95
93
|
"tsc-files": "^1.1.4",
|
|
96
94
|
"typescript": "^6.0.3",
|
|
97
95
|
"vite-plugin-svgr": "^5.2.0",
|
package/playwright.config.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { defineConfig, devices } from
|
|
1
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
2
2
|
|
|
3
|
-
const appUrl =
|
|
3
|
+
const appUrl = "http://localhost:3000";
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
testDir:
|
|
7
|
-
outputDir:
|
|
6
|
+
testDir: "tests/e2e",
|
|
7
|
+
outputDir: "test-results",
|
|
8
8
|
fullyParallel: true,
|
|
9
9
|
forbidOnly: Boolean(process.env.CI),
|
|
10
10
|
retries: process.env.CI ? 2 : 0,
|
|
11
11
|
workers: process.env.CI ? 1 : undefined,
|
|
12
12
|
reporter: [
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
13
|
+
["list"],
|
|
14
|
+
["html", { open: "never", outputFolder: "playwright-report/html" }],
|
|
15
|
+
["junit", { outputFile: "playwright-report/junit-report.xml" }],
|
|
16
16
|
[
|
|
17
|
-
|
|
18
|
-
{ outputFile:
|
|
17
|
+
"@bdellegrazie/playwright-sonar-reporter",
|
|
18
|
+
{ outputFile: "playwright-report/sonar-results.xml", sonarcloud: true },
|
|
19
19
|
],
|
|
20
20
|
],
|
|
21
|
-
globalSetup:
|
|
22
|
-
globalTeardown:
|
|
21
|
+
globalSetup: "tests/e2e/utils/playwright.globalSetup.ts",
|
|
22
|
+
globalTeardown: "tests/e2e/utils/playwright.globalTeardown.ts",
|
|
23
23
|
use: {
|
|
24
24
|
baseURL: appUrl,
|
|
25
|
-
trace:
|
|
26
|
-
screenshot:
|
|
25
|
+
trace: "retain-on-failure",
|
|
26
|
+
screenshot: "only-on-failure",
|
|
27
27
|
},
|
|
28
28
|
projects: [
|
|
29
29
|
{
|
|
30
|
-
name:
|
|
31
|
-
use: { ...devices[
|
|
30
|
+
name: "chromium",
|
|
31
|
+
use: { ...devices["Desktop Chrome"] },
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
name:
|
|
35
|
-
use: { ...devices[
|
|
34
|
+
name: "firefox",
|
|
35
|
+
use: { ...devices["Firefox Desktop"] },
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
name:
|
|
39
|
-
use: { ...devices[
|
|
38
|
+
name: "webkit",
|
|
39
|
+
use: { ...devices["Desktop Safari"] },
|
|
40
40
|
},
|
|
41
41
|
],
|
|
42
42
|
webServer: {
|
|
43
|
-
command:
|
|
43
|
+
command: "npm run build -- --env-mode test && npm run preview",
|
|
44
44
|
url: appUrl,
|
|
45
|
-
stdout:
|
|
45
|
+
stdout: "pipe",
|
|
46
46
|
reuseExistingServer: !process.env.CI,
|
|
47
47
|
},
|
|
48
48
|
});
|
package/prettier.config.mjs
CHANGED
package/rsbuild.config.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineConfig, loadEnv } from
|
|
2
|
-
import { pluginEslint } from
|
|
3
|
-
import { pluginReact } from
|
|
4
|
-
import { pluginSass } from
|
|
5
|
-
import { pluginStylelint } from
|
|
6
|
-
import packageJson from
|
|
1
|
+
import { defineConfig, loadEnv } from "@rsbuild/core";
|
|
2
|
+
import { pluginEslint } from "@rsbuild/plugin-eslint";
|
|
3
|
+
import { pluginReact } from "@rsbuild/plugin-react";
|
|
4
|
+
import { pluginSass } from "@rsbuild/plugin-sass";
|
|
5
|
+
import { pluginStylelint } from "rsbuild-plugin-stylelint";
|
|
6
|
+
import packageJson from "./package.json";
|
|
7
7
|
|
|
8
8
|
const resolveModule = (module: string) => {
|
|
9
9
|
try {
|
|
@@ -14,14 +14,14 @@ const resolveModule = (module: string) => {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const { publicVars } = loadEnv({ prefixes: [process.env.ENV_PREFIX ??
|
|
17
|
+
const { publicVars } = loadEnv({ prefixes: [process.env.ENV_PREFIX ?? "FRONT_"] });
|
|
18
18
|
|
|
19
|
-
const publicUrl = process.env.PUBLIC_URL ?? (packageJson as { homepage?: string }).homepage ??
|
|
20
|
-
const publicPath = new URL(publicUrl.endsWith(
|
|
21
|
-
const disableSourceMap = (process.env.DISABLE_SOURCE_MAP ??
|
|
19
|
+
const publicUrl = process.env.PUBLIC_URL ?? (packageJson as { homepage?: string }).homepage ?? "/";
|
|
20
|
+
const publicPath = new URL(publicUrl.endsWith("/") ? publicUrl : `${publicUrl}/`, "http://localhost").pathname;
|
|
21
|
+
const disableSourceMap = (process.env.DISABLE_SOURCE_MAP ?? "false") === "true" ? false : "source-map";
|
|
22
22
|
|
|
23
23
|
export default defineConfig(({ env }) => {
|
|
24
|
-
const isProduction = env ===
|
|
24
|
+
const isProduction = env === "production";
|
|
25
25
|
|
|
26
26
|
return {
|
|
27
27
|
plugins: [
|
|
@@ -29,44 +29,44 @@ export default defineConfig(({ env }) => {
|
|
|
29
29
|
pluginSass(),
|
|
30
30
|
!isProduction &&
|
|
31
31
|
pluginEslint({
|
|
32
|
-
enable: (process.env.DISABLE_ESLINT_PLUGIN ??
|
|
32
|
+
enable: (process.env.DISABLE_ESLINT_PLUGIN ?? "false") === "false" && resolveModule("eslint"),
|
|
33
33
|
eslintPluginOptions: {
|
|
34
|
-
configType:
|
|
34
|
+
configType: "flat",
|
|
35
35
|
},
|
|
36
36
|
}),
|
|
37
37
|
!isProduction &&
|
|
38
38
|
pluginStylelint({
|
|
39
|
-
enable: (process.env.DISABLE_STYLELINT_PLUGIN ??
|
|
39
|
+
enable: (process.env.DISABLE_STYLELINT_PLUGIN ?? "false") === "false" && resolveModule("stylelint"),
|
|
40
40
|
}),
|
|
41
41
|
].filter(Boolean),
|
|
42
42
|
source: {
|
|
43
43
|
entry: {
|
|
44
|
-
index:
|
|
44
|
+
index: "./src/main.ts",
|
|
45
45
|
},
|
|
46
46
|
define: publicVars,
|
|
47
47
|
},
|
|
48
48
|
output: {
|
|
49
49
|
assetPrefix: publicPath,
|
|
50
50
|
sourceMap: {
|
|
51
|
-
js: isProduction ? disableSourceMap :
|
|
52
|
-
css: (process.env.DISABLE_SOURCE_MAP ??
|
|
51
|
+
js: isProduction ? disableSourceMap : "cheap-module-source-map",
|
|
52
|
+
css: (process.env.DISABLE_SOURCE_MAP ?? "false") !== "true",
|
|
53
53
|
},
|
|
54
54
|
distPath: {
|
|
55
|
-
root:
|
|
55
|
+
root: "build",
|
|
56
56
|
},
|
|
57
57
|
copy: [
|
|
58
58
|
{
|
|
59
|
-
from:
|
|
60
|
-
to:
|
|
59
|
+
from: "public",
|
|
60
|
+
to: ".",
|
|
61
61
|
},
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
64
|
server: {
|
|
65
|
-
port: Number.parseInt(process.env.PORT ??
|
|
66
|
-
open: (process.env.BROWSER ??
|
|
65
|
+
port: Number.parseInt(process.env.PORT ?? "3000", 10),
|
|
66
|
+
open: (process.env.BROWSER ?? "false") === "true",
|
|
67
67
|
},
|
|
68
68
|
html: {
|
|
69
|
-
template:
|
|
69
|
+
template: "./index.html",
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
});
|
package/scripts/lint.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-
|
|
2
|
-
import concurrently from
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
2
|
+
import concurrently from "concurrently";
|
|
3
3
|
|
|
4
|
-
const { result } = concurrently([
|
|
5
|
-
prefixColors:
|
|
4
|
+
const { result } = concurrently(["npm:lint:*(!fix)"], {
|
|
5
|
+
prefixColors: "auto",
|
|
6
6
|
maxProcesses: process.env.CI ? 1 : undefined,
|
|
7
7
|
});
|
|
8
8
|
|
package/scripts/playwright.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { spawnSync } from
|
|
2
|
-
import { platform } from
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { platform } from "node:process";
|
|
3
3
|
|
|
4
4
|
const runCommand = (cmd, args = []) => {
|
|
5
|
-
console.info(`> ${cmd} ${args.join(
|
|
6
|
-
const result = spawnSync(cmd, args, { shell: platform ===
|
|
5
|
+
console.info(`> ${cmd} ${args.join(" ")}`);
|
|
6
|
+
const result = spawnSync(cmd, args, { shell: platform === "win32", cwd: process.cwd(), stdio: "inherit" });
|
|
7
7
|
if (result.status !== 0) {
|
|
8
8
|
throw result;
|
|
9
9
|
}
|
|
@@ -14,33 +14,33 @@ const main = async () => {
|
|
|
14
14
|
|
|
15
15
|
let playwrightArgs = [...args];
|
|
16
16
|
|
|
17
|
-
if (args.includes(
|
|
18
|
-
const filteredArgs = args.filter(a => a !==
|
|
19
|
-
runCommand(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[
|
|
17
|
+
if (args.includes("--watch")) {
|
|
18
|
+
const filteredArgs = args.filter((a) => a !== "--watch");
|
|
19
|
+
runCommand("npx", [
|
|
20
|
+
"nodemon",
|
|
21
|
+
"--watch",
|
|
22
|
+
"./tests/",
|
|
23
|
+
"--ext",
|
|
24
|
+
"js,jx,ts,tsx",
|
|
25
|
+
"--exec",
|
|
26
|
+
["node", "scripts/playwright.js", ...filteredArgs].join(" "),
|
|
27
27
|
]);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
if (playwrightArgs.includes(
|
|
32
|
-
process.env.ENABLED_COVERAGE =
|
|
33
|
-
playwrightArgs = playwrightArgs.filter(p => p !==
|
|
31
|
+
if (playwrightArgs.includes("--coverage")) {
|
|
32
|
+
process.env.ENABLED_COVERAGE = "true";
|
|
33
|
+
playwrightArgs = playwrightArgs.filter((p) => p !== "--coverage");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
runCommand(
|
|
36
|
+
runCommand("npx", ["playwright", ...playwrightArgs]);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
40
|
await main();
|
|
41
41
|
} catch (e) {
|
|
42
42
|
const status =
|
|
43
|
-
e && typeof e ===
|
|
43
|
+
e && typeof e === "object" && "status" in e && typeof e.status === "number" && Number.isFinite(e.status)
|
|
44
44
|
? e.status
|
|
45
45
|
: 1;
|
|
46
46
|
process.exit(status);
|