@pplancq/react-template 2.9.0 → 2.10.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 +59 -0
- package/mise.toml +2 -2
- package/mocks/browser.ts +1 -1
- package/mocks/fixtures/user.ts +14 -14
- package/mocks/handlers/userHandlers.ts +3 -3
- package/mocks/server.ts +1 -1
- package/package.json +29 -30
- package/playwright.config.ts +3 -3
- package/src/app/App.tsx +5 -5
- package/src/app/AppHTMLElement.tsx +4 -4
- package/src/app/README.md +2 -2
- package/src/app/assets/css/index.ts +2 -2
- package/src/app/assets/css/reset.css +6 -6
- package/src/app/config/queryClientConfig.ts +1 -1
- package/src/app/config/serviceContainer.ts +2 -2
- package/src/app/providers/Providers/Providers.tsx +5 -5
- package/src/app/providers/QueryClientProvider/QueryClientProvider.tsx +3 -3
- package/src/app/providers/ServiceProvider/ServiceContext.ts +2 -2
- package/src/app/providers/ServiceProvider/ServiceProvider.tsx +4 -4
- package/src/app/routing/Router.tsx +2 -2
- package/src/app/routing/appRoutes.ts +1 -1
- package/src/app/routing/routes.tsx +3 -3
- package/src/demo/README.md +5 -4
- package/src/demo/application/dtos/ArchitecturePrinciple.ts +1 -1
- package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCase.ts +3 -3
- package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCaseInterface.ts +1 -1
- package/src/demo/application/use-cases/GetDemoUsersUseCase.ts +3 -3
- package/src/demo/application/use-cases/GetDemoUsersUseCaseInterface.ts +1 -1
- package/src/demo/domain/repositories/ArchitecturePrincipleRepositoryInterface.d.ts +1 -1
- package/src/demo/domain/repositories/DemoUserRepositoryInterface.d.ts +1 -1
- package/src/demo/infrastructure/repositories/HttpDemoUserRepository.ts +5 -5
- package/src/demo/infrastructure/repositories/StaticArchitecturePrincipleRepository.ts +14 -14
- package/src/demo/serviceDemo.ts +14 -13
- package/src/demo/serviceIdentifiers.ts +4 -4
- package/src/demo/ui/components/DemoFooter/DemoFooter.tsx +5 -5
- package/src/demo/ui/components/DemoFooter/index.ts +1 -1
- package/src/demo/ui/components/DemoHeader/DemoHeader.module.css +2 -2
- package/src/demo/ui/components/DemoHeader/DemoHeader.tsx +10 -10
- package/src/demo/ui/components/DemoHeader/index.ts +1 -1
- package/src/demo/ui/components/DemoNavigation/DemoNavigation.module.css +2 -2
- package/src/demo/ui/components/DemoNavigation/DemoNavigation.tsx +4 -4
- package/src/demo/ui/components/DemoNavigation/index.ts +1 -1
- package/src/demo/ui/components/Input/Input.module.scss +2 -2
- package/src/demo/ui/components/Input/Input.tsx +3 -3
- package/src/demo/ui/components/Input/index.ts +1 -1
- package/src/demo/ui/components/Logo/Logo.tsx +2 -2
- package/src/demo/ui/components/Logo/index.ts +1 -1
- package/src/demo/ui/components/NavLink/NavLink.tsx +3 -3
- package/src/demo/ui/components/NavLink/index.ts +1 -1
- package/src/demo/ui/components/TextInput/TextInput.tsx +3 -3
- package/src/demo/ui/components/TextInput/index.ts +1 -1
- package/src/demo/ui/forms/ProfileForm/ProfileForm.module.scss +1 -1
- package/src/demo/ui/forms/ProfileForm/ProfileForm.tsx +9 -9
- package/src/demo/ui/forms/ProfileForm/index.ts +1 -1
- package/src/demo/ui/hooks/useDemoUsersQuery/useDemoUsersQuery.ts +5 -5
- package/src/demo/ui/layouts/DemoLayout/DemoLayout.tsx +4 -4
- package/src/demo/ui/layouts/MainTemplate/MainTemplate.module.css +3 -3
- package/src/demo/ui/layouts/MainTemplate/MainTemplate.tsx +2 -2
- package/src/demo/ui/layouts/MainTemplate/index.ts +1 -1
- package/src/demo/ui/pages/DemoHome/DemoHome.module.scss +24 -24
- package/src/demo/ui/pages/DemoHome/DemoHome.tsx +6 -6
- package/src/demo/ui/pages/DependencyInjectionDemo/DependencyInjectionDemo.module.scss +5 -5
- package/src/demo/ui/pages/DependencyInjectionDemo/DependencyInjectionDemo.tsx +5 -5
- package/src/demo/ui/pages/ReactHookFormDemo/ReactHookFormDemo.module.scss +4 -4
- package/src/demo/ui/pages/ReactHookFormDemo/ReactHookFormDemo.tsx +4 -4
- package/src/demo/ui/pages/ReactQueryDemo/ReactQueryDemo.module.scss +5 -5
- package/src/demo/ui/pages/ReactQueryDemo/ReactQueryDemo.tsx +3 -3
- package/src/demo/ui/routing/demoAppRoutes.ts +4 -4
- package/src/demo/ui/routing/demoRoutes.tsx +8 -8
- package/src/main.ts +5 -5
- package/src/react-app-env.d.ts +1 -1
- package/src/shared/infrastructure/http/constant.ts +8 -8
- package/src/shared/infrastructure/http/fetchApi.ts +3 -3
- package/src/shared/ui/hooks/useService/useService.ts +4 -4
- package/tests/e2e/demo.test.ts +17 -0
- package/tests/e2e/fixture/playwright.fixture.ts +15 -0
- package/tests/{utils → e2e/utils}/createNetworkFixture.ts +2 -2
- package/tests/{utils → e2e/utils}/createTestWithCoverageFixture.ts +8 -8
- package/tests/{utils → e2e/utils}/playwright.globalSetup.ts +4 -4
- package/tests/{utils → e2e/utils}/playwright.globalTeardown.ts +3 -3
- package/{src/app/__tests__ → tests/unit/app}/AppHTMLElement.test.tsx +14 -14
- package/tests/unit/demo/ui/components/DemoFooter/Footer.test.tsx +15 -0
- package/tests/unit/demo/ui/components/DemoHeader/Header.test.tsx +15 -0
- package/tests/unit/demo/ui/components/Logo/Logo.test.tsx +12 -0
- package/tsconfig.json +1 -1
- package/vitest.config.mts +1 -1
- package/postcss.config.mjs +0 -5
- package/src/demo/ui/components/DemoFooter/__tests__/Footer.test.tsx +0 -15
- package/src/demo/ui/components/DemoHeader/__tests__/Header.test.tsx +0 -15
- package/src/demo/ui/components/Logo/__tests__/Logo.test.tsx +0 -12
- package/tests/demo.test.ts +0 -17
- package/tests/fixture/playwright.fixture.ts +0 -15
- /package/{src/demo/ui/components/DemoFooter/__tests__ → tests/unit/demo/ui/components/DemoFooter}/__snapshots__/Footer.test.tsx.snap +0 -0
- /package/{src/demo/ui/components/DemoHeader/__tests__ → tests/unit/demo/ui/components/DemoHeader}/__snapshots__/Header.test.tsx.snap +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
+
## 2.10.1 (2026-08-03)
|
|
2
|
+
|
|
3
|
+
### ♻️ Code Refactoring
|
|
4
|
+
|
|
5
|
+
- **dev-tools:** update arrow function parentheses for consistency ([0104ebf](https://github.com/pplancq/dev-tools/commit/0104ebf))
|
|
6
|
+
- **dev-tools:** update quotes to double quotes for consistency ([6b2d557](https://github.com/pplancq/dev-tools/commit/6b2d557))
|
|
7
|
+
|
|
8
|
+
### 📦 Dependencies
|
|
9
|
+
|
|
10
|
+
- Updated @pplancq/commitlint-config to 4.0.4
|
|
11
|
+
- Updated @pplancq/stylelint-config to 6.0.0
|
|
12
|
+
- Updated @pplancq/prettier-config to 4.0.0
|
|
13
|
+
- Updated @pplancq/eslint-config to 6.0.19
|
|
14
|
+
- **deps:** update dependency @playwright/test to ^1.62.1 ([#1841](https://github.com/pplancq/dev-tools/pull/1841))
|
|
15
|
+
- **deps:** update dependency @hookform/resolvers to ^5.5.7 ([#1842](https://github.com/pplancq/dev-tools/pull/1842))
|
|
16
|
+
|
|
17
|
+
### ❤️ Thank You
|
|
18
|
+
|
|
19
|
+
- Paul PLANCQ
|
|
20
|
+
|
|
21
|
+
## 2.10.0 (2026-07-28)
|
|
22
|
+
|
|
23
|
+
### 🎉 Features
|
|
24
|
+
|
|
25
|
+
- **react-template:** remove postcss-config dependency ([3b57e0e](https://github.com/pplancq/dev-tools/commit/3b57e0e))
|
|
26
|
+
- **react-template:** restructure test directories ([4762120](https://github.com/pplancq/dev-tools/commit/4762120))
|
|
27
|
+
|
|
28
|
+
### 📦 Dependencies
|
|
29
|
+
|
|
30
|
+
- Updated @pplancq/commitlint-config to 4.0.3
|
|
31
|
+
- Updated @pplancq/stylelint-config to 5.0.4
|
|
32
|
+
- Updated @pplancq/prettier-config to 3.0.1
|
|
33
|
+
- Updated @pplancq/eslint-config to 6.0.18
|
|
34
|
+
- **deps:** update dependency @bdellegrazie/playwright-sonar-reporter to ^0.5.2 ([#1821](https://github.com/pplancq/dev-tools/pull/1821))
|
|
35
|
+
- **deps:** update dependency react-hook-form to ^7.83.0 ([#1828](https://github.com/pplancq/dev-tools/pull/1828))
|
|
36
|
+
- **deps:** update dependency inversify to ^8.2.3 ([#1817](https://github.com/pplancq/dev-tools/pull/1817))
|
|
37
|
+
- **deps:** update dependency @rsbuild/core to ^2.1.8 ([#1816](https://github.com/pplancq/dev-tools/pull/1816))
|
|
38
|
+
- **deps:** update dependency @testing-library/jest-dom to v7 ([#1831](https://github.com/pplancq/dev-tools/pull/1831))
|
|
39
|
+
- **deps:** update dependency react-router to ^8.3.0 ([#1829](https://github.com/pplancq/dev-tools/pull/1829))
|
|
40
|
+
- **deps:** update react-query mono repo to ^5.101.4 ([#1826](https://github.com/pplancq/dev-tools/pull/1826))
|
|
41
|
+
- **deps:** update react monorepo to ^19.2.8 ([#1825](https://github.com/pplancq/dev-tools/pull/1825))
|
|
42
|
+
- **deps:** update dependency @vitejs/plugin-react to ^6.0.4 ([#1822](https://github.com/pplancq/dev-tools/pull/1822))
|
|
43
|
+
- **deps:** update dependency inversify to ^8.1.3 ([#1782](https://github.com/pplancq/dev-tools/pull/1782))
|
|
44
|
+
- **deps:** update dependency react-hook-form to ^7.81.0 ([#1789](https://github.com/pplancq/dev-tools/pull/1789))
|
|
45
|
+
- **deps:** update commitlint monorepo ([#1799](https://github.com/pplancq/dev-tools/pull/1799))
|
|
46
|
+
- **deps:** update dependency @rsbuild/plugin-react to ^2.1.0 ([#1785](https://github.com/pplancq/dev-tools/pull/1785))
|
|
47
|
+
- **deps:** update dependency @vitejs/plugin-react to ^6.0.3 ([#1794](https://github.com/pplancq/dev-tools/pull/1794))
|
|
48
|
+
- **deps:** update react-query mono repo to ^5.101.2 ([#1796](https://github.com/pplancq/dev-tools/pull/1796))
|
|
49
|
+
- **deps:** update dependency @playwright/test to ^1.61.1 ([#1788](https://github.com/pplancq/dev-tools/pull/1788))
|
|
50
|
+
- **deps:** update dependency msw to ^2.15.0 ([#1809](https://github.com/pplancq/dev-tools/pull/1809))
|
|
51
|
+
- **deps:** update dependency @rsbuild/core to ^2.1.5 ([#1780](https://github.com/pplancq/dev-tools/pull/1780))
|
|
52
|
+
- **deps:** update dependency stylelint to ^17.14.0 ([#1798](https://github.com/pplancq/dev-tools/pull/1798))
|
|
53
|
+
- **deps:** update dependency react-router to v8 ([#1792](https://github.com/pplancq/dev-tools/pull/1792))
|
|
54
|
+
- **deps:** update dependency @rsbuild/plugin-sass to v2 ([#1801](https://github.com/pplancq/dev-tools/pull/1801))
|
|
55
|
+
|
|
56
|
+
### ❤️ Thank You
|
|
57
|
+
|
|
58
|
+
- Paul PLANCQ
|
|
59
|
+
|
|
1
60
|
## @pplancq/react-template [2.9.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.8.17...@pplancq/react-template@2.9.0) (2026-06-15)
|
|
2
61
|
|
|
3
62
|
### Features
|
package/mise.toml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
[tools]
|
|
2
|
-
node = "24.
|
|
3
|
-
npm = "
|
|
2
|
+
node = "24.18.1"
|
|
3
|
+
npm = "12.0.2"
|
package/mocks/browser.ts
CHANGED
package/mocks/fixtures/user.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export const users = [
|
|
2
2
|
{
|
|
3
3
|
id: 1,
|
|
4
|
-
name:
|
|
5
|
-
username:
|
|
6
|
-
email:
|
|
4
|
+
name: "Demo user",
|
|
5
|
+
username: "@demoUser",
|
|
6
|
+
email: "demo@user.test",
|
|
7
7
|
address: {
|
|
8
|
-
street:
|
|
9
|
-
suite:
|
|
10
|
-
city:
|
|
11
|
-
zipcode:
|
|
8
|
+
street: "Kulas Light",
|
|
9
|
+
suite: "Apt. 556",
|
|
10
|
+
city: "Gwenborough",
|
|
11
|
+
zipcode: "92998-3874",
|
|
12
12
|
geo: {
|
|
13
|
-
lat:
|
|
14
|
-
lng:
|
|
13
|
+
lat: "-37.3159",
|
|
14
|
+
lng: "81.1496",
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
phone:
|
|
18
|
-
website:
|
|
17
|
+
phone: "1-770-736-8031 x56442",
|
|
18
|
+
website: "hildegard.org",
|
|
19
19
|
company: {
|
|
20
|
-
name:
|
|
21
|
-
catchPhrase:
|
|
22
|
-
bs:
|
|
20
|
+
name: "Romaguera-Crona",
|
|
21
|
+
catchPhrase: "Multi-layered client-server neural-net",
|
|
22
|
+
bs: "harness real-time e-markets",
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { users } from
|
|
2
|
-
import { http, HttpResponse } from
|
|
1
|
+
import { users } from "@Mocks/fixtures/user";
|
|
2
|
+
import { http, HttpResponse } from "msw";
|
|
3
3
|
|
|
4
|
-
export const getUsers200 = http.get(
|
|
4
|
+
export const getUsers200 = http.get("*/users", () => {
|
|
5
5
|
return HttpResponse.json(users);
|
|
6
6
|
});
|
package/mocks/server.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pplancq/react-template",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
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@
|
|
16
|
+
"packageManager": "npm@12.0.2",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "rsbuild dev",
|
|
19
19
|
"start:mock": "rsbuild dev --env-mode mock",
|
|
@@ -49,54 +49,53 @@
|
|
|
49
49
|
"template"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@hookform/resolvers": "^5.
|
|
53
|
-
"@tanstack/react-query": "^5.101.
|
|
54
|
-
"@tanstack/react-query-devtools": "^5.101.
|
|
55
|
-
"inversify": "^8.
|
|
56
|
-
"react": "^19.2.
|
|
57
|
-
"react-dom": "^19.2.
|
|
58
|
-
"react-hook-form": "^7.
|
|
59
|
-
"react-router": "^
|
|
52
|
+
"@hookform/resolvers": "^5.5.7",
|
|
53
|
+
"@tanstack/react-query": "^5.101.4",
|
|
54
|
+
"@tanstack/react-query-devtools": "^5.101.4",
|
|
55
|
+
"inversify": "^8.2.3",
|
|
56
|
+
"react": "^19.2.8",
|
|
57
|
+
"react-dom": "^19.2.8",
|
|
58
|
+
"react-hook-form": "^7.83.0",
|
|
59
|
+
"react-router": "^8.3.0",
|
|
60
60
|
"yup": "^1.7.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@bdellegrazie/playwright-sonar-reporter": "^0.5.
|
|
64
|
-
"@commitlint/cli": "^21.
|
|
63
|
+
"@bdellegrazie/playwright-sonar-reporter": "^0.5.2",
|
|
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
|
-
"@pplancq/postcss-config": "*",
|
|
70
69
|
"@pplancq/prettier-config": "*",
|
|
71
70
|
"@pplancq/stylelint-config": "*",
|
|
72
|
-
"@rsbuild/core": "^2.
|
|
71
|
+
"@rsbuild/core": "^2.1.9",
|
|
73
72
|
"@rsbuild/plugin-eslint": "^2.0.2",
|
|
74
|
-
"@rsbuild/plugin-react": "^2.0
|
|
75
|
-
"@rsbuild/plugin-sass": "^
|
|
76
|
-
"@testing-library/jest-dom": "^
|
|
73
|
+
"@rsbuild/plugin-react": "^2.1.0",
|
|
74
|
+
"@rsbuild/plugin-sass": "^2.0.1",
|
|
75
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
77
76
|
"@testing-library/react": "^16.3.2",
|
|
78
77
|
"@testing-library/user-event": "^14.6.1",
|
|
79
|
-
"@types/react": "^19.2.
|
|
80
|
-
"@types/react-dom": "^19.2.
|
|
81
|
-
"@vitejs/plugin-react": "^6.0.
|
|
82
|
-
"@vitest/coverage-v8": "^4.1.
|
|
83
|
-
"concurrently": "^10.0.
|
|
84
|
-
"eslint": "^9.39.
|
|
78
|
+
"@types/react": "^19.2.18",
|
|
79
|
+
"@types/react-dom": "^19.2.4",
|
|
80
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
81
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
82
|
+
"concurrently": "^10.0.4",
|
|
83
|
+
"eslint": "^9.39.5",
|
|
85
84
|
"eslint-plugin-prettier": "^5.5.6",
|
|
86
85
|
"husky": "^9.1.7",
|
|
87
|
-
"jsdom": "^
|
|
88
|
-
"lint-staged": "^17.0
|
|
86
|
+
"jsdom": "^30.0.1",
|
|
87
|
+
"lint-staged": "^17.2.0",
|
|
89
88
|
"monocart-coverage-reports": "^2.12.12",
|
|
90
|
-
"msw": "^2.
|
|
89
|
+
"msw": "^2.15.0",
|
|
91
90
|
"nodemon": "^3.1.14",
|
|
92
|
-
"prettier": "^3.
|
|
91
|
+
"prettier": "^3.9.6",
|
|
93
92
|
"rsbuild-plugin-stylelint": "^1.2.0",
|
|
94
|
-
"stylelint": "^17.
|
|
93
|
+
"stylelint": "^17.14.1",
|
|
95
94
|
"stylelint-prettier": "^5.0.3",
|
|
96
95
|
"tsc-files": "^1.1.4",
|
|
97
96
|
"typescript": "^6.0.3",
|
|
98
97
|
"vite-plugin-svgr": "^5.2.0",
|
|
99
|
-
"vitest": "^4.1.
|
|
98
|
+
"vitest": "^4.1.10",
|
|
100
99
|
"vitest-axe": "^1.0.0-pre.5",
|
|
101
100
|
"vitest-sonar-reporter": "^3.0.0"
|
|
102
101
|
},
|
package/playwright.config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { defineConfig, devices } from '@playwright/test';
|
|
|
3
3
|
const appUrl = 'http://localhost:3000';
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
testDir: 'tests',
|
|
6
|
+
testDir: 'tests/e2e',
|
|
7
7
|
outputDir: 'test-results',
|
|
8
8
|
fullyParallel: true,
|
|
9
9
|
forbidOnly: Boolean(process.env.CI),
|
|
@@ -18,8 +18,8 @@ export default defineConfig({
|
|
|
18
18
|
{ outputFile: 'playwright-report/sonar-results.xml', sonarcloud: true },
|
|
19
19
|
],
|
|
20
20
|
],
|
|
21
|
-
globalSetup: 'tests/utils/playwright.globalSetup.ts',
|
|
22
|
-
globalTeardown: 'tests/utils/playwright.globalTeardown.ts',
|
|
21
|
+
globalSetup: 'tests/e2e/utils/playwright.globalSetup.ts',
|
|
22
|
+
globalTeardown: 'tests/e2e/utils/playwright.globalTeardown.ts',
|
|
23
23
|
use: {
|
|
24
24
|
baseURL: appUrl,
|
|
25
25
|
trace: 'retain-on-failure',
|
package/src/app/App.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { queryClient } from
|
|
2
|
-
import { serviceContainer } from
|
|
3
|
-
import { Providers } from
|
|
4
|
-
import { Router } from
|
|
1
|
+
import { queryClient } from "@App/config/queryClientConfig";
|
|
2
|
+
import { serviceContainer } from "@App/config/serviceContainer";
|
|
3
|
+
import { Providers } from "@App/providers/Providers/Providers";
|
|
4
|
+
import { Router } from "@App/routing/Router";
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import "@App/assets/css";
|
|
7
7
|
|
|
8
8
|
type AppProps = {
|
|
9
9
|
basename?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { App } from
|
|
2
|
-
import { StrictMode } from
|
|
3
|
-
import { createRoot, type Root } from
|
|
1
|
+
import { App } from "@App/App";
|
|
2
|
+
import { StrictMode } from "react";
|
|
3
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line import/no-default-export
|
|
6
6
|
export default class AppHTMLElement extends HTMLElement {
|
|
@@ -18,7 +18,7 @@ export default class AppHTMLElement extends HTMLElement {
|
|
|
18
18
|
this.isMounted = true;
|
|
19
19
|
this.root.render(
|
|
20
20
|
<StrictMode>
|
|
21
|
-
<App basename={this.getAttribute(
|
|
21
|
+
<App basename={this.getAttribute("basename") ?? ""} />
|
|
22
22
|
</StrictMode>,
|
|
23
23
|
);
|
|
24
24
|
}
|
package/src/app/README.md
CHANGED
|
@@ -24,8 +24,8 @@ place in the application where the Inversify container is created and all bounde
|
|
|
24
24
|
are loaded:
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
import { serviceDemo } from
|
|
28
|
-
import { Container } from
|
|
27
|
+
import { serviceDemo } from "@Demo/serviceDemo";
|
|
28
|
+
import { Container } from "inversify";
|
|
29
29
|
|
|
30
30
|
export const serviceContainer = new Container();
|
|
31
31
|
serviceContainer.load(serviceDemo);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "./reset.css";
|
|
2
|
+
import "./mainBody.css";
|
|
@@ -77,15 +77,15 @@ time,
|
|
|
77
77
|
mark,
|
|
78
78
|
audio,
|
|
79
79
|
video {
|
|
80
|
-
margin: 0;
|
|
81
80
|
padding: 0;
|
|
82
|
-
|
|
83
|
-
vertical-align: baseline;
|
|
81
|
+
margin: 0;
|
|
84
82
|
font: inherit;
|
|
85
83
|
font-family:
|
|
86
|
-
-apple-system, BlinkMacSystemFont,
|
|
87
|
-
|
|
84
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans",
|
|
85
|
+
"Helvetica Neue", sans-serif;
|
|
88
86
|
font-size: 100%;
|
|
87
|
+
vertical-align: baseline;
|
|
88
|
+
border: 0;
|
|
89
89
|
-webkit-font-smoothing: antialiased;
|
|
90
90
|
-moz-osx-font-smoothing: grayscale;
|
|
91
91
|
}
|
|
@@ -128,5 +128,5 @@ table {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
code {
|
|
131
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas,
|
|
131
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
132
132
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QueryClientProvider } from
|
|
2
|
-
import { ServiceProvider } from
|
|
3
|
-
import type { QueryClient } from
|
|
4
|
-
import type { Container } from
|
|
5
|
-
import type { PropsWithChildren } from
|
|
1
|
+
import { QueryClientProvider } from "@App/providers/QueryClientProvider/QueryClientProvider";
|
|
2
|
+
import { ServiceProvider } from "@App/providers/ServiceProvider/ServiceProvider";
|
|
3
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import type { Container } from "inversify";
|
|
5
|
+
import type { PropsWithChildren } from "react";
|
|
6
6
|
|
|
7
7
|
type ProvidersProps = PropsWithChildren<{
|
|
8
8
|
queryClient: QueryClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type QueryClient, QueryClientProvider as ReactQueryClientProvider } from
|
|
2
|
-
import { ReactQueryDevtools } from
|
|
3
|
-
import type { PropsWithChildren } from
|
|
1
|
+
import { type QueryClient, QueryClientProvider as ReactQueryClientProvider } from "@tanstack/react-query";
|
|
2
|
+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
4
|
|
|
5
5
|
type ClientProviderProps = {
|
|
6
6
|
queryClient: QueryClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ServiceContext } from
|
|
2
|
-
import type { Container } from
|
|
3
|
-
import type { PropsWithChildren } from
|
|
4
|
-
import { useRef } from
|
|
1
|
+
import { ServiceContext } from "@App/providers/ServiceProvider/ServiceContext";
|
|
2
|
+
import type { Container } from "inversify";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
|
+
import { useRef } from "react";
|
|
5
5
|
|
|
6
6
|
export type ServiceProviderProps = PropsWithChildren<{
|
|
7
7
|
container: Container;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { demoRoutes } from
|
|
2
|
-
import type { RouteObject } from
|
|
1
|
+
import { demoRoutes } from "@Demo/ui/routing/demoRoutes";
|
|
2
|
+
import type { RouteObject } from "react-router";
|
|
3
3
|
|
|
4
4
|
export const routeObject: RouteObject[] = [
|
|
5
5
|
{
|
|
6
|
-
path:
|
|
6
|
+
path: "/",
|
|
7
7
|
children: [demoRoutes],
|
|
8
8
|
},
|
|
9
9
|
];
|
package/src/demo/README.md
CHANGED
|
@@ -96,8 +96,8 @@ Declares unique `Symbol` identifiers for every service in the context:
|
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
98
|
export const DEMO_SERVICES = Object.freeze({
|
|
99
|
-
DemoUserRepository: Symbol.for(
|
|
100
|
-
GetDemoUsersUseCase: Symbol.for(
|
|
99
|
+
DemoUserRepository: Symbol.for("Demo.DemoUserRepository"),
|
|
100
|
+
GetDemoUsersUseCase: Symbol.for("Demo.GetDemoUsersUseCase"),
|
|
101
101
|
// ...
|
|
102
102
|
});
|
|
103
103
|
```
|
|
@@ -111,7 +111,7 @@ A `ContainerModule` that binds each service identifier to its concrete implement
|
|
|
111
111
|
free of framework metadata:
|
|
112
112
|
|
|
113
113
|
```ts
|
|
114
|
-
export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
114
|
+
export const serviceDemo: ContainerModule = new ContainerModule((options) => {
|
|
115
115
|
options
|
|
116
116
|
.bind<DemoUserRepositoryInterface>(DEMO_SERVICES.DemoUserRepository)
|
|
117
117
|
.toDynamicValue(() => new HttpDemoUserRepository())
|
|
@@ -120,7 +120,8 @@ export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
|
120
120
|
options
|
|
121
121
|
.bind<GetDemoUsersUseCaseInterface>(DEMO_SERVICES.GetDemoUsersUseCase)
|
|
122
122
|
.toDynamicValue(
|
|
123
|
-
services =>
|
|
123
|
+
(services) =>
|
|
124
|
+
new GetDemoUsersUseCase(services.get<DemoUserRepositoryInterface>(DEMO_SERVICES.DemoUserRepository)),
|
|
124
125
|
)
|
|
125
126
|
.inSingletonScope();
|
|
126
127
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
2
|
-
import type { GetArchitecturePrinciplesUseCaseInterface } from
|
|
3
|
-
import type { ArchitecturePrincipleRepositoryInterface } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
|
+
import type { GetArchitecturePrinciplesUseCaseInterface } from "@Demo/application/use-cases/GetArchitecturePrinciplesUseCaseInterface";
|
|
3
|
+
import type { ArchitecturePrincipleRepositoryInterface } from "@Demo/domain/repositories/ArchitecturePrincipleRepositoryInterface";
|
|
4
4
|
|
|
5
5
|
export class GetArchitecturePrinciplesUseCase implements GetArchitecturePrinciplesUseCaseInterface {
|
|
6
6
|
public constructor(private readonly architecturePrincipleRepository: ArchitecturePrincipleRepositoryInterface) {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
2
|
|
|
3
3
|
export interface GetArchitecturePrinciplesUseCaseInterface {
|
|
4
4
|
execute: () => ArchitecturePrinciple[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GetDemoUsersUseCaseInterface } from
|
|
2
|
-
import type { DemoUser } from
|
|
3
|
-
import type { DemoUserRepositoryInterface } from
|
|
1
|
+
import type { GetDemoUsersUseCaseInterface } from "@Demo/application/use-cases/GetDemoUsersUseCaseInterface";
|
|
2
|
+
import type { DemoUser } from "@Demo/domain/entities/DemoUser";
|
|
3
|
+
import type { DemoUserRepositoryInterface } from "@Demo/domain/repositories/DemoUserRepositoryInterface";
|
|
4
4
|
|
|
5
5
|
export class GetDemoUsersUseCase implements GetDemoUsersUseCaseInterface {
|
|
6
6
|
public constructor(private readonly demoUserRepository: DemoUserRepositoryInterface) {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
2
|
|
|
3
3
|
export interface ArchitecturePrincipleRepositoryInterface {
|
|
4
4
|
getAll: () => ArchitecturePrinciple[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DemoUser } from
|
|
2
|
-
import type { DemoUserRepositoryInterface } from
|
|
3
|
-
import { fetchApi } from
|
|
1
|
+
import type { DemoUser } from "@Demo/domain/entities/DemoUser";
|
|
2
|
+
import type { DemoUserRepositoryInterface } from "@Demo/domain/repositories/DemoUserRepositoryInterface";
|
|
3
|
+
import { fetchApi } from "@Shared/infrastructure/http/fetchApi";
|
|
4
4
|
|
|
5
5
|
type DemoUserApiResponse = {
|
|
6
6
|
id: number;
|
|
@@ -11,14 +11,14 @@ type DemoUserApiResponse = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export class HttpDemoUserRepository implements DemoUserRepositoryInterface {
|
|
14
|
-
private readonly apiPath =
|
|
14
|
+
private readonly apiPath = "https://jsonplaceholder.typicode.com/users";
|
|
15
15
|
|
|
16
16
|
public readonly getAll = async (): Promise<DemoUser[]> => {
|
|
17
17
|
const users = await fetchApi<DemoUserApiResponse[]>({
|
|
18
18
|
path: this.apiPath,
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
return users.map(user => ({
|
|
21
|
+
return users.map((user) => ({
|
|
22
22
|
id: user.id,
|
|
23
23
|
name: user.name,
|
|
24
24
|
username: user.username.toUpperCase(),
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
2
|
-
import type { ArchitecturePrincipleRepositoryInterface } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
|
+
import type { ArchitecturePrincipleRepositoryInterface } from "@Demo/domain/repositories/ArchitecturePrincipleRepositoryInterface";
|
|
3
3
|
|
|
4
4
|
export class StaticArchitecturePrincipleRepository implements ArchitecturePrincipleRepositoryInterface {
|
|
5
5
|
private readonly architecturePrinciples: ArchitecturePrinciple[] = [
|
|
6
6
|
{
|
|
7
|
-
title:
|
|
8
|
-
description:
|
|
9
|
-
layer:
|
|
7
|
+
title: "Domain stays framework-free",
|
|
8
|
+
description: "The demo domain only defines contracts and pure data structures. React and Inversify stay outside.",
|
|
9
|
+
layer: "domain",
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
title:
|
|
13
|
-
description:
|
|
14
|
-
layer:
|
|
12
|
+
title: "Application orchestrates use cases",
|
|
13
|
+
description: "Use cases expose intent-driven APIs such as GetDemoUsersUseCase instead of leaking infrastructure.",
|
|
14
|
+
layer: "application",
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
title:
|
|
17
|
+
title: "Infrastructure implements contracts",
|
|
18
18
|
description:
|
|
19
|
-
|
|
20
|
-
layer:
|
|
19
|
+
"Concrete adapters, such as the HTTP repository, live in infrastructure and are selected by the container.",
|
|
20
|
+
layer: "infrastructure",
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
title:
|
|
23
|
+
title: "UI depends on abstractions",
|
|
24
24
|
description:
|
|
25
|
-
|
|
26
|
-
layer:
|
|
25
|
+
"React pages use hooks and useService to resolve use cases without importing infrastructure directly.",
|
|
26
|
+
layer: "ui",
|
|
27
27
|
},
|
|
28
28
|
];
|
|
29
29
|
|