@qlover/create-app 0.7.15 → 0.9.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 +21 -0
- package/dist/configs/_common/.github/workflows/general-check.yml +1 -1
- package/dist/configs/_common/.github/workflows/release.yml +2 -2
- package/dist/configs/_common/.gitignore.template +6 -0
- package/dist/configs/_common/.prettierignore +17 -5
- package/dist/configs/_common/.vscode/settings.json +6 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/next-app/.env.template +1 -1
- package/dist/templates/next-app/README.en.md +0 -1
- package/dist/templates/next-app/README.md +0 -1
- package/dist/templates/next-app/config/Identifier/api.ts +5 -5
- package/dist/templates/next-app/config/Identifier/common/admint.table.ts +69 -0
- package/dist/templates/next-app/config/Identifier/common/common.ts +76 -0
- package/dist/templates/next-app/config/Identifier/common/index.ts +3 -0
- package/dist/templates/next-app/config/Identifier/{validator.ts → common/validators.ts} +5 -5
- package/dist/templates/next-app/config/Identifier/index.ts +2 -12
- package/dist/templates/next-app/config/Identifier/pages/index.ts +6 -0
- package/dist/templates/next-app/config/Identifier/pages/page.admin.home.ts +27 -0
- package/dist/templates/next-app/config/Identifier/pages/page.admin.locales.ts +266 -0
- package/dist/templates/next-app/config/Identifier/pages/page.admin.user.ts +293 -0
- package/dist/templates/{react-app/config/Identifier → next-app/config/Identifier/pages}/page.home.ts +15 -22
- package/dist/templates/next-app/config/Identifier/{page.login.ts → pages/page.login.ts} +28 -34
- package/dist/templates/next-app/config/Identifier/{page.register.ts → pages/page.register.ts} +30 -29
- package/dist/templates/next-app/config/adminNavs.ts +19 -0
- package/dist/templates/next-app/config/common.ts +22 -13
- package/dist/templates/next-app/config/i18n/HomeI18n.ts +5 -5
- package/dist/templates/next-app/config/i18n/admin18n.ts +61 -19
- package/dist/templates/next-app/config/i18n/i18nConfig.ts +2 -0
- package/dist/templates/next-app/config/i18n/i18nKeyScheam.ts +36 -0
- package/dist/templates/next-app/config/i18n/loginI18n.ts +22 -22
- package/dist/templates/next-app/config/i18n/register18n.ts +23 -24
- package/dist/templates/next-app/docs/en/index.md +0 -1
- package/dist/templates/next-app/docs/en/project-structure.md +0 -1
- package/dist/templates/next-app/docs/zh/index.md +0 -1
- package/dist/templates/next-app/docs/zh/project-structure.md +0 -1
- package/dist/templates/next-app/make/generateLocales.ts +19 -12
- package/dist/templates/next-app/migrations/schema/LocalesSchema.ts +15 -0
- package/dist/templates/next-app/migrations/sql/1694244000000.sql +11 -0
- package/dist/templates/next-app/package.json +7 -3
- package/dist/templates/next-app/public/locales/en.json +172 -207
- package/dist/templates/next-app/public/locales/zh.json +172 -207
- package/dist/templates/next-app/src/app/[locale]/admin/locales/page.tsx +153 -0
- package/dist/templates/next-app/src/app/[locale]/admin/users/page.tsx +48 -50
- package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +2 -2
- package/dist/templates/next-app/src/app/api/admin/locales/create/route.ts +34 -0
- package/dist/templates/next-app/src/app/api/admin/locales/import/route.ts +40 -0
- package/dist/templates/next-app/src/app/api/admin/locales/route.ts +42 -0
- package/dist/templates/next-app/src/app/api/admin/locales/update/route.ts +32 -0
- package/dist/templates/next-app/src/app/api/locales/json/route.ts +44 -0
- package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +1 -13
- package/dist/templates/next-app/src/base/cases/Datetime.ts +18 -0
- package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +12 -6
- package/dist/templates/next-app/src/base/cases/ResourceState.ts +17 -0
- package/dist/templates/next-app/src/base/cases/TranslateI18nInterface.ts +25 -0
- package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +200 -0
- package/dist/templates/next-app/src/base/port/ZodBuilderInterface.ts +8 -0
- package/dist/templates/next-app/src/base/services/AdminLocalesService.ts +20 -0
- package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +26 -0
- package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +42 -0
- package/dist/templates/next-app/src/base/services/ResourceService.ts +122 -0
- package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +104 -0
- package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +38 -5
- package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +1 -1
- package/dist/templates/next-app/src/i18n/request.ts +30 -1
- package/dist/templates/next-app/src/server/PageParams.ts +2 -10
- package/dist/templates/next-app/src/server/port/DBBridgeInterface.ts +5 -0
- package/dist/templates/next-app/src/server/port/DBTableInterface.ts +2 -0
- package/dist/templates/next-app/src/server/port/LocalesRepositoryInterface.ts +43 -0
- package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +197 -0
- package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +122 -0
- package/dist/templates/next-app/src/server/sqlBridges/SupabaseBridge.ts +60 -11
- package/dist/templates/next-app/src/server/validators/ExtendedExecutorError.ts +6 -0
- package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +131 -0
- package/dist/templates/next-app/src/server/validators/LoginValidator.ts +2 -5
- package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +32 -16
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/_default.css +2 -1
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/dark.css +28 -29
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/pink.css +2 -1
- package/dist/templates/next-app/src/uikit/components/AdminLayout.tsx +17 -3
- package/dist/templates/next-app/src/uikit/components/BaseHeader.tsx +5 -4
- package/dist/templates/next-app/src/uikit/components/BaseLayout.tsx +5 -4
- package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +3 -2
- package/dist/templates/next-app/src/uikit/components/ComboProvider.tsx +1 -1
- package/dist/templates/next-app/src/uikit/components/EditableCell.tsx +118 -0
- package/dist/templates/next-app/src/uikit/components/LogoutButton.tsx +5 -6
- package/dist/templates/next-app/src/uikit/components/ThemeSwitcher.tsx +1 -1
- package/dist/templates/next-app/src/uikit/components/With.tsx +2 -2
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportButton.tsx +62 -0
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +28 -0
- package/dist/templates/next-app/src/uikit/components/localesImportButton/import.module.css +6 -0
- package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +8 -14
- package/dist/templates/next-app/src/uikit/hook/useWarnTranslations.ts +25 -0
- package/dist/templates/react-app/.prettierignore +17 -0
- package/dist/templates/react-app/README.en.md +71 -54
- package/dist/templates/react-app/README.md +35 -18
- package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +14 -0
- package/dist/templates/react-app/__tests__/__mocks__/MockAppConfit.ts +1 -1
- package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +2 -2
- package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +1 -1
- package/dist/templates/react-app/__tests__/__mocks__/components/TestApp.tsx +45 -0
- package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +34 -0
- package/dist/templates/react-app/__tests__/__mocks__/components/TestRouter.tsx +46 -0
- package/dist/templates/react-app/__tests__/__mocks__/components/index.ts +12 -0
- package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +1 -2
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +51 -0
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +69 -0
- package/dist/templates/react-app/__tests__/setup/index.ts +1 -51
- package/dist/templates/react-app/__tests__/setup/setupGlobal.ts +51 -0
- package/dist/templates/react-app/__tests__/src/App.structure.test.tsx +115 -0
- package/dist/templates/react-app/__tests__/src/base/cases/AppConfig.test.ts +2 -2
- package/dist/templates/react-app/__tests__/src/base/cases/AppError.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/base/cases/DialogHandler.test.ts +3 -5
- package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +13 -2
- package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/base/cases/PublicAssetsPath.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +5 -5
- package/dist/templates/react-app/__tests__/src/base/cases/RequestStatusCatcher.test.ts +1 -2
- package/dist/templates/react-app/__tests__/src/base/cases/RouterLoader.test.ts +25 -15
- package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +29 -15
- package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +19 -9
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +153 -0
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +9 -7
- package/dist/templates/react-app/__tests__/src/main.integration.test.tsx +4 -5
- package/dist/templates/react-app/__tests__/src/main.test.tsx +4 -4
- package/dist/templates/react-app/__tests__/src/uikit/components/BaseHeader.test.tsx +68 -59
- package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +274 -0
- package/dist/templates/react-app/config/IOCIdentifier.ts +11 -8
- package/dist/templates/react-app/config/Identifier/{common.error.ts → common/common.error.ts} +5 -5
- package/dist/templates/react-app/config/Identifier/{common.ts → common/common.ts} +9 -9
- package/dist/templates/react-app/config/Identifier/common/index.ts +2 -0
- package/dist/templates/react-app/config/Identifier/components/component.chatMessage.ts +56 -0
- package/dist/templates/react-app/config/Identifier/components/component.messageBaseList.ts +103 -0
- package/dist/templates/react-app/config/Identifier/index.ts +1 -9
- package/dist/templates/react-app/config/Identifier/pages/index.ts +9 -0
- package/dist/templates/react-app/config/Identifier/{page.about.ts → pages/page.about.ts} +34 -26
- package/dist/templates/react-app/config/Identifier/{page.executor.ts → pages/page.executor.ts} +47 -39
- package/dist/templates/{next-app/config/Identifier → react-app/config/Identifier/pages}/page.home.ts +24 -23
- package/dist/templates/react-app/config/Identifier/pages/page.identifiter.ts +102 -0
- package/dist/templates/react-app/config/Identifier/{page.jsonStorage.ts → pages/page.jsonStorage.ts} +18 -11
- package/dist/templates/react-app/config/Identifier/{page.login.ts → pages/page.login.ts} +37 -27
- package/dist/templates/react-app/config/Identifier/pages/page.message.ts +20 -0
- package/dist/templates/react-app/config/Identifier/{page.register.ts → pages/page.register.ts} +37 -25
- package/dist/templates/react-app/config/Identifier/{page.request.ts → pages/page.request.ts} +34 -44
- package/dist/templates/react-app/config/app.router.ts +81 -61
- package/dist/templates/react-app/config/i18n/PageI18nInterface.ts +51 -0
- package/dist/templates/react-app/config/i18n/aboutI18n.ts +42 -0
- package/dist/templates/react-app/config/i18n/chatMessageI18n.ts +17 -0
- package/dist/templates/react-app/config/i18n/executorI18n.ts +51 -0
- package/dist/templates/react-app/config/i18n/homeI18n.ts +24 -0
- package/dist/templates/react-app/config/i18n/i18nConfig.ts +30 -0
- package/dist/templates/react-app/config/i18n/identifiter18n.ts +30 -0
- package/dist/templates/react-app/config/i18n/jsonStorage18n.ts +27 -0
- package/dist/templates/react-app/config/i18n/login18n.ts +42 -0
- package/dist/templates/react-app/config/i18n/messageBaseListI18n.ts +22 -0
- package/dist/templates/react-app/config/i18n/messageI18n.ts +14 -0
- package/dist/templates/react-app/config/i18n/notFoundI18n.ts +34 -0
- package/dist/templates/react-app/config/i18n/register18n.ts +40 -0
- package/dist/templates/react-app/config/i18n/request18n.ts +41 -0
- package/dist/templates/react-app/config/theme.ts +14 -4
- package/dist/templates/react-app/docs/en/bootstrap.md +1670 -341
- package/dist/templates/react-app/docs/en/components/chat-message-component.md +314 -0
- package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +270 -0
- package/dist/templates/react-app/docs/en/components/message-base-list-component.md +172 -0
- package/dist/templates/react-app/docs/en/development-guide.md +1021 -345
- package/dist/templates/react-app/docs/en/env.md +1132 -278
- package/dist/templates/react-app/docs/en/i18n.md +858 -147
- package/dist/templates/react-app/docs/en/index.md +733 -104
- package/dist/templates/react-app/docs/en/ioc.md +1228 -287
- package/dist/templates/react-app/docs/en/playwright/e2e-tests.md +321 -0
- package/dist/templates/react-app/docs/en/playwright/index.md +19 -0
- package/dist/templates/react-app/docs/en/playwright/installation-summary.md +332 -0
- package/dist/templates/react-app/docs/en/playwright/overview.md +222 -0
- package/dist/templates/react-app/docs/en/playwright/quickstart.md +325 -0
- package/dist/templates/react-app/docs/en/playwright/reorganization-notes.md +340 -0
- package/dist/templates/react-app/docs/en/playwright/setup-complete.md +290 -0
- package/dist/templates/react-app/docs/en/playwright/testing-guide.md +565 -0
- package/dist/templates/react-app/docs/en/store.md +1194 -184
- package/dist/templates/react-app/docs/en/why-no-globals.md +797 -0
- package/dist/templates/react-app/docs/zh/bootstrap.md +1670 -341
- package/dist/templates/react-app/docs/zh/components/chat-message-component.md +314 -0
- package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +270 -0
- package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +172 -0
- package/dist/templates/react-app/docs/zh/development-guide.md +1021 -345
- package/dist/templates/react-app/docs/zh/env.md +1132 -275
- package/dist/templates/react-app/docs/zh/i18n.md +858 -147
- package/dist/templates/react-app/docs/zh/index.md +717 -104
- package/dist/templates/react-app/docs/zh/ioc.md +1229 -287
- package/dist/templates/react-app/docs/zh/playwright/e2e-tests.md +321 -0
- package/dist/templates/react-app/docs/zh/playwright/index.md +19 -0
- package/dist/templates/react-app/docs/zh/playwright/installation-summary.md +332 -0
- package/dist/templates/react-app/docs/zh/playwright/overview.md +222 -0
- package/dist/templates/react-app/docs/zh/playwright/quickstart.md +325 -0
- package/dist/templates/react-app/docs/zh/playwright/reorganization-notes.md +340 -0
- package/dist/templates/react-app/docs/zh/playwright/setup-complete.md +290 -0
- package/dist/templates/react-app/docs/zh/playwright/testing-guide.md +565 -0
- package/dist/templates/react-app/docs/zh/store.md +1192 -184
- package/dist/templates/react-app/docs/zh/why-no-globals.md +797 -0
- package/dist/templates/react-app/e2e/App.spec.ts +319 -0
- package/dist/templates/react-app/e2e/fixtures/base.fixture.ts +40 -0
- package/dist/templates/react-app/e2e/main.spec.ts +20 -0
- package/dist/templates/react-app/e2e/utils/test-helpers.ts +19 -0
- package/dist/templates/react-app/eslint.config.mjs +247 -0
- package/dist/templates/react-app/makes/eslint-utils.mjs +195 -0
- package/dist/templates/react-app/makes/generateTs2LocalesOptions.ts +26 -0
- package/dist/templates/react-app/package.json +31 -3
- package/dist/templates/react-app/playwright.config.ts +79 -0
- package/dist/templates/react-app/public/locales/en/common.json +233 -179
- package/dist/templates/react-app/public/locales/zh/common.json +233 -179
- package/dist/templates/react-app/src/App.tsx +15 -42
- package/dist/templates/react-app/src/base/apis/AiApi.ts +5 -5
- package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +1 -1
- package/dist/templates/react-app/src/base/apis/feApi/FeApiAdapter.ts +1 -1
- package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +8 -8
- package/dist/templates/react-app/src/base/apis/feApi/FeApiType.ts +1 -1
- package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +6 -6
- package/dist/templates/react-app/src/base/apis/userApi/UserApiAdapter.ts +1 -1
- package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +12 -14
- package/dist/templates/react-app/src/base/apis/userApi/UserApiType.ts +1 -1
- package/dist/templates/react-app/src/base/cases/DialogHandler.ts +5 -2
- package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +3 -3
- package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +3 -3
- package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +2 -2
- package/dist/templates/react-app/src/base/cases/RequestLogger.ts +4 -4
- package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +1 -1
- package/dist/templates/react-app/src/base/cases/ResourceState.ts +23 -0
- package/dist/templates/react-app/src/base/cases/RouterLoader.ts +4 -4
- package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +26 -0
- package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +2 -3
- package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +1 -1
- package/dist/templates/react-app/src/base/port/IOCInterface.ts +36 -0
- package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +2 -1
- package/dist/templates/react-app/src/base/port/ProcesserExecutorInterface.ts +1 -1
- package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +2 -2
- package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +9 -5
- package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +1 -1
- package/dist/templates/react-app/src/base/services/I18nService.ts +29 -29
- package/dist/templates/react-app/src/base/services/IdentifierService.ts +143 -0
- package/dist/templates/react-app/src/base/services/ProcesserExecutor.ts +3 -3
- package/dist/templates/react-app/src/base/services/RouteService.ts +27 -8
- package/dist/templates/react-app/src/base/services/UserService.ts +8 -8
- package/dist/templates/react-app/src/base/types/Page.ts +14 -2
- package/dist/templates/react-app/src/base/types/global.d.ts +1 -1
- package/dist/templates/react-app/src/core/IOC.ts +5 -46
- package/dist/templates/react-app/src/core/bootstraps/{BootstrapApp.ts → BootstrapClient.ts} +44 -17
- package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +14 -7
- package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +1 -1
- package/dist/templates/react-app/src/core/bootstraps/PrintBootstrap.ts +1 -1
- package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +40 -0
- package/dist/templates/react-app/src/core/{IocRegisterImpl.ts → clientIoc/ClientIOCRegister.ts} +35 -24
- package/dist/templates/react-app/src/core/globals.ts +9 -9
- package/dist/templates/react-app/src/main.tsx +4 -4
- package/dist/templates/react-app/src/pages/404.tsx +6 -3
- package/dist/templates/react-app/src/pages/500.tsx +5 -2
- package/dist/templates/react-app/src/pages/NoRouteFound.tsx +5 -0
- package/dist/templates/react-app/src/pages/auth/Layout.tsx +9 -6
- package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +46 -56
- package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +46 -58
- package/dist/templates/react-app/src/pages/base/AboutPage.tsx +35 -40
- package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +51 -51
- package/dist/templates/react-app/src/pages/base/HomePage.tsx +14 -15
- package/dist/templates/react-app/src/pages/base/IdentifierPage.tsx +70 -11
- package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +24 -25
- package/dist/templates/react-app/src/pages/base/Layout.tsx +2 -2
- package/dist/templates/react-app/src/pages/base/MessagePage.tsx +40 -0
- package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +3 -2
- package/dist/templates/react-app/src/pages/base/RequestPage.tsx +41 -59
- package/dist/templates/react-app/src/styles/css/antd-themes/{_default.css → _common/_default.css} +85 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/{dark.css → _common/dark.css} +99 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/{pink.css → _common/pink.css} +86 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/index.css +4 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/_default.css +108 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/dark.css +67 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/pink.css +67 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/_default.css +34 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/dark.css +31 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/pink.css +36 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/_default.css +44 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/dark.css +43 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/pink.css +43 -0
- package/dist/templates/react-app/src/styles/css/page.css +4 -3
- package/dist/templates/react-app/src/styles/css/themes/_default.css +1 -0
- package/dist/templates/react-app/src/styles/css/themes/dark.css +1 -0
- package/dist/templates/react-app/src/styles/css/themes/pink.css +1 -0
- package/dist/templates/react-app/src/styles/css/zIndex.css +1 -1
- package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +3 -3
- package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +2 -2
- package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +1 -1
- package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +3 -3
- package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +35 -0
- package/dist/templates/react-app/src/uikit/components/BaseHeader.tsx +15 -11
- package/dist/templates/react-app/src/uikit/components/BaseRouteProvider.tsx +14 -11
- package/dist/templates/react-app/src/uikit/components/BaseRouteSeo.tsx +18 -0
- package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +13 -0
- package/dist/templates/react-app/src/uikit/components/ClientSeo.tsx +62 -0
- package/dist/templates/react-app/src/uikit/components/ComboProvider.tsx +38 -0
- package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +48 -27
- package/dist/templates/react-app/src/uikit/components/Loading.tsx +4 -2
- package/dist/templates/react-app/src/uikit/components/LocaleLink.tsx +4 -5
- package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +34 -11
- package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +240 -0
- package/dist/templates/react-app/src/uikit/components/ProcessExecutorProvider.tsx +9 -5
- package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +6 -3
- package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +97 -40
- package/dist/templates/react-app/src/uikit/components/UserAuthProvider.tsx +5 -5
- package/dist/templates/react-app/src/uikit/components/With.tsx +17 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +176 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatRoot.tsx +21 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/FocusBar.tsx +106 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +271 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageItem.tsx +102 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessagesList.tsx +86 -0
- package/dist/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +17 -11
- package/dist/templates/react-app/src/uikit/contexts/IOCContext.ts +13 -0
- package/dist/templates/react-app/src/uikit/hooks/useAppTranslation.ts +26 -0
- package/dist/templates/react-app/src/uikit/hooks/useI18nGuard.ts +8 -11
- package/dist/templates/react-app/src/uikit/hooks/useI18nInterface.ts +25 -0
- package/dist/templates/react-app/src/uikit/hooks/useIOC.ts +35 -0
- package/dist/templates/react-app/src/uikit/hooks/useNavigateBridge.ts +3 -3
- package/dist/templates/react-app/src/uikit/hooks/useStrictEffect.ts +0 -1
- package/dist/templates/react-app/tsconfig.e2e.json +21 -0
- package/dist/templates/react-app/tsconfig.json +8 -1
- package/dist/templates/react-app/tsconfig.node.json +1 -1
- package/dist/templates/react-app/tsconfig.test.json +3 -1
- package/dist/templates/react-app/vite.config.ts +50 -34
- package/package.json +2 -1
- package/dist/configs/react-app/eslint.config.js +0 -94
- package/dist/templates/next-app/config/Identifier/common.error.ts +0 -41
- package/dist/templates/next-app/config/Identifier/common.ts +0 -69
- package/dist/templates/next-app/config/Identifier/page.about.ts +0 -181
- package/dist/templates/next-app/config/Identifier/page.admin.ts +0 -48
- package/dist/templates/next-app/config/Identifier/page.executor.ts +0 -272
- package/dist/templates/next-app/config/Identifier/page.identifiter.ts +0 -39
- package/dist/templates/next-app/config/Identifier/page.jsonStorage.ts +0 -72
- package/dist/templates/next-app/config/Identifier/page.request.ts +0 -182
- package/dist/templates/next-app/src/base/cases/ChatAction.ts +0 -21
- package/dist/templates/next-app/src/base/cases/FocusBarAction.ts +0 -36
- package/dist/templates/next-app/src/base/cases/RequestState.ts +0 -20
- package/dist/templates/next-app/src/base/port/AdminPageInterface.ts +0 -85
- package/dist/templates/next-app/src/base/port/AsyncStateInterface.ts +0 -7
- package/dist/templates/next-app/src/base/services/AdminUserService.ts +0 -45
- package/dist/templates/next-app/src/uikit/components/ChatRoot.tsx +0 -17
- package/dist/templates/next-app/src/uikit/components/chat/ChatActionInterface.ts +0 -30
- package/dist/templates/next-app/src/uikit/components/chat/ChatFocusBar.tsx +0 -65
- package/dist/templates/next-app/src/uikit/components/chat/ChatMessages.tsx +0 -59
- package/dist/templates/next-app/src/uikit/components/chat/ChatWrap.tsx +0 -28
- package/dist/templates/next-app/src/uikit/components/chat/FocusBarActionInterface.ts +0 -19
- package/dist/templates/next-app/src/uikit/hook/useMountedClient.ts +0 -17
- package/dist/templates/next-app/src/uikit/hook/useStore.ts +0 -15
- package/dist/templates/react-app/__tests__/__mocks__/I18nService.ts +0 -13
- package/dist/templates/react-app/__tests__/src/App.test.tsx +0 -139
- package/dist/templates/react-app/config/Identifier/page.identifiter.ts +0 -39
- package/dist/templates/react-app/config/i18n.ts +0 -15
- package/dist/templates/react-app/docs/en/project-structure.md +0 -434
- package/dist/templates/react-app/docs/zh/project-structure.md +0 -434
- package/dist/templates/react-app/src/base/cases/RequestState.ts +0 -20
- package/dist/templates/react-app/src/base/port/AsyncStateInterface.ts +0 -7
- package/dist/templates/react-app/src/uikit/hooks/useDocumentTitle.ts +0 -15
- package/dist/templates/react-app/src/uikit/hooks/useStore.ts +0 -15
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import App from '@/App';
|
|
3
|
-
import { routerPrefix } from '@config/common';
|
|
4
|
-
|
|
5
|
-
// Mock the dependencies
|
|
6
|
-
vi.mock('react-router-dom', async () => {
|
|
7
|
-
const actual = await vi.importActual('react-router-dom');
|
|
8
|
-
return {
|
|
9
|
-
...actual,
|
|
10
|
-
createBrowserRouter: vi.fn(() => ({
|
|
11
|
-
routes: [],
|
|
12
|
-
basename: routerPrefix
|
|
13
|
-
})),
|
|
14
|
-
RouterProvider: vi.fn(({ router }) => (
|
|
15
|
-
<div data-testid="router-provider">
|
|
16
|
-
<div data-testid="router-basename">{router.basename}</div>
|
|
17
|
-
<div data-testid="router-routes-count">
|
|
18
|
-
{router.routes?.length || 0}
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
))
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
vi.mock('@brain-toolkit/antd-theme-override/react', () => ({
|
|
26
|
-
AntdThemeProvider: vi.fn(({ children, theme }) => (
|
|
27
|
-
<div data-testid="antd-theme-provider">
|
|
28
|
-
<div data-testid="theme-key">{theme?.cssVar?.key}</div>
|
|
29
|
-
<div data-testid="theme-prefix">{theme?.cssVar?.prefix}</div>
|
|
30
|
-
{children}
|
|
31
|
-
</div>
|
|
32
|
-
))
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
vi.mock('@/core/IOC', () => ({
|
|
36
|
-
IOC: vi.fn((service) => {
|
|
37
|
-
if (service === 'RouteService') {
|
|
38
|
-
return {
|
|
39
|
-
routes: [
|
|
40
|
-
{ path: '/', component: 'HomePage' },
|
|
41
|
-
{ path: '/about', component: 'AboutPage' }
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (service === 'DialogHandler') {
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
48
|
-
return {};
|
|
49
|
-
})
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
vi.mock('@/uikit/hooks/useStore', () => ({
|
|
53
|
-
useStore: vi.fn((service, selector) => {
|
|
54
|
-
if (service && selector) {
|
|
55
|
-
return [
|
|
56
|
-
{ path: '/', component: 'HomePage' },
|
|
57
|
-
{ path: '/about', component: 'AboutPage' }
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
return [];
|
|
61
|
-
})
|
|
62
|
-
}));
|
|
63
|
-
|
|
64
|
-
vi.mock('@/base/cases/RouterLoader', () => ({
|
|
65
|
-
RouterLoader: vi.fn().mockImplementation(() => ({
|
|
66
|
-
toRoute: vi.fn((route) => ({
|
|
67
|
-
path: route.path,
|
|
68
|
-
element: <div data-testid={`route-${route.path}`}>{route.component}</div>
|
|
69
|
-
}))
|
|
70
|
-
}))
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
// Mock the CSS import
|
|
74
|
-
vi.mock('@/styles/css/index.css', () => ({}));
|
|
75
|
-
|
|
76
|
-
describe('App Component', () => {
|
|
77
|
-
beforeEach(() => {
|
|
78
|
-
vi.clearAllMocks();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should render without crashing', () => {
|
|
82
|
-
render(<App />);
|
|
83
|
-
|
|
84
|
-
// Check if the main app structure is rendered
|
|
85
|
-
expect(screen.getByTestId('antd-theme-provider')).toBeDefined();
|
|
86
|
-
expect(screen.getByTestId('router-provider')).toBeDefined();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should configure theme provider correctly', () => {
|
|
90
|
-
render(<App />);
|
|
91
|
-
|
|
92
|
-
// Check theme configuration
|
|
93
|
-
expect(screen.getByTestId('theme-key').textContent).toBe('fe-theme');
|
|
94
|
-
expect(screen.getByTestId('theme-prefix').textContent).toBe('fe');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should configure router with correct basename', () => {
|
|
98
|
-
render(<App />);
|
|
99
|
-
|
|
100
|
-
// Check router configuration
|
|
101
|
-
expect(screen.getByTestId('router-basename')).toBeDefined();
|
|
102
|
-
expect(screen.getByTestId('router-basename').textContent).toBe(
|
|
103
|
-
routerPrefix
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should render router provider with routes', () => {
|
|
108
|
-
render(<App />);
|
|
109
|
-
|
|
110
|
-
// Check that router provider is rendered
|
|
111
|
-
expect(screen.getByTestId('router-provider')).toBeDefined();
|
|
112
|
-
expect(screen.getByTestId('router-routes-count')).toBeDefined();
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('should have proper component structure', () => {
|
|
116
|
-
const { container } = render(<App />);
|
|
117
|
-
|
|
118
|
-
// Check the overall structure
|
|
119
|
-
expect(container.firstChild).toBeDefined();
|
|
120
|
-
|
|
121
|
-
// Check that theme provider wraps router provider
|
|
122
|
-
const themeProvider = screen.getByTestId('antd-theme-provider');
|
|
123
|
-
const routerProvider = screen.getByTestId('router-provider');
|
|
124
|
-
|
|
125
|
-
expect(themeProvider.contains(routerProvider)).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should handle empty routes gracefully', async () => {
|
|
129
|
-
// Mock useStore to return empty routes
|
|
130
|
-
const { useStore } = await import('@/uikit/hooks/useStore');
|
|
131
|
-
vi.mocked(useStore).mockReturnValueOnce([]);
|
|
132
|
-
|
|
133
|
-
render(<App />);
|
|
134
|
-
|
|
135
|
-
// Should still render without crashing
|
|
136
|
-
expect(screen.getByTestId('antd-theme-provider')).toBeDefined();
|
|
137
|
-
expect(screen.getByTestId('router-provider')).toBeDefined();
|
|
138
|
-
});
|
|
139
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description ErrorIdentifier page main title
|
|
3
|
-
* @localZh 错误标识符
|
|
4
|
-
* @localEn Error Identifier
|
|
5
|
-
*/
|
|
6
|
-
export const PAGE_ERROR_IDENTIFIER_MAIN_TITLE =
|
|
7
|
-
'page.error.identifier.main_title';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @description ErrorIdentifier page description
|
|
11
|
-
* @localZh 来自 '@config/Identifier/error' 的标识符
|
|
12
|
-
* @localEn Identifier From: '@config/Identifier/error'
|
|
13
|
-
*/
|
|
14
|
-
export const PAGE_ERROR_IDENTIFIER_SOURCE_DESCRIPTION =
|
|
15
|
-
'page.error.identifier.source_description';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @description ErrorIdentifier help section title
|
|
19
|
-
* @localZh 需要帮助?
|
|
20
|
-
* @localEn Need Help?
|
|
21
|
-
*/
|
|
22
|
-
export const PAGE_ERROR_IDENTIFIER_HELP_TITLE =
|
|
23
|
-
'page.error.identifier.help.title';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @description ErrorIdentifier help section description
|
|
27
|
-
* @localZh 如果您在使用错误标识符时遇到问题,请联系我们的支持团队
|
|
28
|
-
* @localEn If you encounter any issues while using error identifiers, please contact our support team
|
|
29
|
-
*/
|
|
30
|
-
export const PAGE_ERROR_IDENTIFIER_HELP_DESCRIPTION =
|
|
31
|
-
'page.error.identifier.help.description';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @description ErrorIdentifier contact support button
|
|
35
|
-
* @localZh 联系支持
|
|
36
|
-
* @localEn Contact Support
|
|
37
|
-
*/
|
|
38
|
-
export const PAGE_ERROR_IDENTIFIER_CONTACT_SUPPORT =
|
|
39
|
-
'page.error.identifier.contact_support';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { routerPrefix } from './common';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
fallbackLng: 'en',
|
|
5
|
-
debug: false,
|
|
6
|
-
interpolation: {
|
|
7
|
-
escapeValue: false
|
|
8
|
-
},
|
|
9
|
-
ns: ['common'],
|
|
10
|
-
defaultNS: 'common',
|
|
11
|
-
backend: {
|
|
12
|
-
loadPath: routerPrefix + '/locales/{{lng}}/{{ns}}.json'
|
|
13
|
-
},
|
|
14
|
-
supportedLngs: ['en', 'zh']
|
|
15
|
-
} as const;
|
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
# Project Structure Documentation
|
|
2
|
-
|
|
3
|
-
## Directory Structure
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
src/
|
|
7
|
-
├── base/ # Base functionality implementation
|
|
8
|
-
│ ├── apis/ # API interface definitions and implementations
|
|
9
|
-
│ │ └── userApi/ # User-related APIs
|
|
10
|
-
│ ├── cases/ # Business scenario implementations
|
|
11
|
-
│ │ ├── AppConfig.ts # Application configuration
|
|
12
|
-
│ │ ├── RouterLoader.ts # Router loader
|
|
13
|
-
│ │ └── I18nKeyErrorPlugin.ts # Internationalization error handling
|
|
14
|
-
│ ├── services/ # Core service implementations
|
|
15
|
-
│ │ ├── UserService.ts # User service
|
|
16
|
-
│ │ ├── RouteService.ts # Route service
|
|
17
|
-
│ │ └── I18nService.ts # Internationalization service
|
|
18
|
-
│ └── types/ # Type definitions
|
|
19
|
-
├── core/ # Core functionality
|
|
20
|
-
│ ├── bootstraps/ # Startup related
|
|
21
|
-
│ │ └── BootstrapApp.ts # Application bootstrapper
|
|
22
|
-
│ ├── registers/ # Registries
|
|
23
|
-
│ │ ├── RegisterCommon.ts # Common service registration
|
|
24
|
-
│ │ └── RegisterGlobals.ts # Global variable registration
|
|
25
|
-
│ └── IOC.ts # IOC container
|
|
26
|
-
├── pages/ # Page components
|
|
27
|
-
│ ├── auth/ # Authentication related pages
|
|
28
|
-
│ │ ├── LoginPage.tsx # Login page
|
|
29
|
-
│ │ └── RegisterPage.tsx # Registration page
|
|
30
|
-
│ └── base/ # Base pages
|
|
31
|
-
│ ├── HomePage.tsx # Home page
|
|
32
|
-
│ └── ErrorPage.tsx # Error page
|
|
33
|
-
├── styles/ # Style files
|
|
34
|
-
│ └── css/
|
|
35
|
-
│ ├── themes/ # Theme related
|
|
36
|
-
│ └── antd-themes/ # Ant Design themes
|
|
37
|
-
├── uikit/ # UI component library
|
|
38
|
-
│ ├── components/ # Common components
|
|
39
|
-
│ ├── contexts/ # React Contexts
|
|
40
|
-
│ ├── hooks/ # Custom Hooks
|
|
41
|
-
│ └── providers/ # Provider components
|
|
42
|
-
└── App.tsx # Application entry
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Implemented Features
|
|
46
|
-
|
|
47
|
-
### 1. User Authentication System
|
|
48
|
-
|
|
49
|
-
#### Login Functionality
|
|
50
|
-
|
|
51
|
-
- Supports email and password login
|
|
52
|
-
- Remember login state
|
|
53
|
-
- Login state persistence
|
|
54
|
-
- Login error handling
|
|
55
|
-
- Supports third-party login (interface reserved)
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
// Login service example
|
|
59
|
-
class UserService extends UserAuthService<UserInfo> {
|
|
60
|
-
async login(credentials: LoginFormData) {
|
|
61
|
-
// Login implementation
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async logout() {
|
|
65
|
-
// Logout implementation
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
#### Registration Functionality
|
|
71
|
-
|
|
72
|
-
- User registration form
|
|
73
|
-
- Form validation
|
|
74
|
-
- Password strength check
|
|
75
|
-
- Terms of service agreement
|
|
76
|
-
- Registration success redirect
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
// Registration functionality example
|
|
80
|
-
async register(params: RegisterFormData) {
|
|
81
|
-
const response = await this.api.register(params);
|
|
82
|
-
// Handle registration logic
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### 2. Routing System
|
|
87
|
-
|
|
88
|
-
#### Features
|
|
89
|
-
|
|
90
|
-
- Configuration-based routing
|
|
91
|
-
- Route-level code splitting
|
|
92
|
-
- Route guards
|
|
93
|
-
- Route meta information
|
|
94
|
-
- Multi-language route support
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
// Route configuration example
|
|
98
|
-
export const baseRoutes: RouteConfigValue[] = [
|
|
99
|
-
{
|
|
100
|
-
path: '/:lng',
|
|
101
|
-
element: 'base/Layout',
|
|
102
|
-
meta: {
|
|
103
|
-
category: 'main'
|
|
104
|
-
},
|
|
105
|
-
children: [...]
|
|
106
|
-
}
|
|
107
|
-
];
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 3. Internationalization System
|
|
111
|
-
|
|
112
|
-
#### Features
|
|
113
|
-
|
|
114
|
-
- Supports Chinese and English switching
|
|
115
|
-
- Route-level language switching
|
|
116
|
-
- Translation generation based on TypeScript comments
|
|
117
|
-
- Dynamic language pack loading
|
|
118
|
-
- Complete type support
|
|
119
|
-
|
|
120
|
-
### 4. Theme System
|
|
121
|
-
|
|
122
|
-
#### Features
|
|
123
|
-
|
|
124
|
-
- Supports multiple theme switching
|
|
125
|
-
- CSS variable driven
|
|
126
|
-
- Tailwind CSS integration
|
|
127
|
-
- Ant Design theme customization
|
|
128
|
-
- Responsive design
|
|
129
|
-
|
|
130
|
-
### 5. State Management
|
|
131
|
-
|
|
132
|
-
#### Features
|
|
133
|
-
|
|
134
|
-
- Store-based state management
|
|
135
|
-
- Reactive data flow
|
|
136
|
-
- State persistence
|
|
137
|
-
- State slicing
|
|
138
|
-
- Complete type support
|
|
139
|
-
|
|
140
|
-
### 6. UI Component Library
|
|
141
|
-
|
|
142
|
-
#### Implemented Components
|
|
143
|
-
|
|
144
|
-
- Layout Components
|
|
145
|
-
- BaseLayout: Basic layout
|
|
146
|
-
- AuthLayout: Authentication page layout
|
|
147
|
-
- Common Components
|
|
148
|
-
- ThemeSwitcher: Theme switcher
|
|
149
|
-
- LanguageSwitcher: Language switcher
|
|
150
|
-
- Loading: Loading state
|
|
151
|
-
- Form Components
|
|
152
|
-
- LoginForm: Login form
|
|
153
|
-
- RegisterForm: Registration form
|
|
154
|
-
|
|
155
|
-
### 7. Tool Integration
|
|
156
|
-
|
|
157
|
-
#### Development Tools
|
|
158
|
-
|
|
159
|
-
- TypeScript support
|
|
160
|
-
- ESLint configuration
|
|
161
|
-
- Prettier formatting
|
|
162
|
-
- Jest testing framework
|
|
163
|
-
- Vite build tool
|
|
164
|
-
|
|
165
|
-
#### Auxiliary Functions
|
|
166
|
-
|
|
167
|
-
- Automatic route generation
|
|
168
|
-
- API request encapsulation
|
|
169
|
-
- Error handling
|
|
170
|
-
- Logging system
|
|
171
|
-
- Cache management
|
|
172
|
-
|
|
173
|
-
### 8. Security Features
|
|
174
|
-
|
|
175
|
-
#### Implemented
|
|
176
|
-
|
|
177
|
-
- CSRF protection
|
|
178
|
-
- XSS protection
|
|
179
|
-
- Request encryption
|
|
180
|
-
- Data masking
|
|
181
|
-
- Permission control
|
|
182
|
-
|
|
183
|
-
## Extension Points
|
|
184
|
-
|
|
185
|
-
### 1. Authentication System Extensions
|
|
186
|
-
|
|
187
|
-
- Add more third-party logins
|
|
188
|
-
- Implement phone number login
|
|
189
|
-
- Add two-factor authentication
|
|
190
|
-
- Implement password reset
|
|
191
|
-
|
|
192
|
-
### 2. UI Component Extensions
|
|
193
|
-
|
|
194
|
-
- Add more business components
|
|
195
|
-
- Extend theme system
|
|
196
|
-
- Add animation effects
|
|
197
|
-
- Optimize mobile adaptation
|
|
198
|
-
|
|
199
|
-
### 3. Feature Extensions
|
|
200
|
-
|
|
201
|
-
- Add file upload
|
|
202
|
-
- Implement real-time communication
|
|
203
|
-
- Add data visualization
|
|
204
|
-
- Implement offline support
|
|
205
|
-
|
|
206
|
-
## Project Dependencies
|
|
207
|
-
|
|
208
|
-
### Core Dependencies
|
|
209
|
-
|
|
210
|
-
#### React Related
|
|
211
|
-
|
|
212
|
-
- **react** (^18.3.1)
|
|
213
|
-
- Core framework
|
|
214
|
-
- Uses latest React 18 features
|
|
215
|
-
- Supports concurrent mode and Suspense
|
|
216
|
-
|
|
217
|
-
- **react-dom** (^18.3.1)
|
|
218
|
-
- React DOM renderer
|
|
219
|
-
- For Web platform rendering
|
|
220
|
-
|
|
221
|
-
- **react-router-dom** (^7.1.5)
|
|
222
|
-
- Route management
|
|
223
|
-
- Uses latest data router features
|
|
224
|
-
- Supports nested routes and route guards
|
|
225
|
-
|
|
226
|
-
#### State Management
|
|
227
|
-
|
|
228
|
-
- **@qlover/slice-store-react** (^1.0.8)
|
|
229
|
-
- State management solution
|
|
230
|
-
- Based on publish-subscribe pattern
|
|
231
|
-
- Supports state slicing and reactive updates
|
|
232
|
-
|
|
233
|
-
- **@qlover/corekit-bridge**
|
|
234
|
-
- Core functionality bridge layer
|
|
235
|
-
- Provides state management and UI connection
|
|
236
|
-
- Implements dependency injection and service management
|
|
237
|
-
|
|
238
|
-
#### UI Framework
|
|
239
|
-
|
|
240
|
-
- **antd** (^5.25.3)
|
|
241
|
-
- UI component library
|
|
242
|
-
- Uses v5 version
|
|
243
|
-
- Supports theme customization and CSS-in-JS
|
|
244
|
-
|
|
245
|
-
- **@brain-toolkit/antd-theme-override** (^0.0.3)
|
|
246
|
-
- Ant Design theme override tool
|
|
247
|
-
- Implements dynamic theme variable switching
|
|
248
|
-
- Supports custom theme configuration
|
|
249
|
-
|
|
250
|
-
#### Style Tools
|
|
251
|
-
|
|
252
|
-
- **tailwindcss** (^4.1.8)
|
|
253
|
-
- Atomic CSS framework
|
|
254
|
-
- For quickly building responsive interfaces
|
|
255
|
-
- Integrates with theme system
|
|
256
|
-
|
|
257
|
-
- **clsx** (^2.1.1)
|
|
258
|
-
- Class name management tool
|
|
259
|
-
- For conditional class name concatenation
|
|
260
|
-
- Provides type-safe API
|
|
261
|
-
|
|
262
|
-
#### Internationalization
|
|
263
|
-
|
|
264
|
-
- **i18next** (^24.2.0)
|
|
265
|
-
- Internationalization framework
|
|
266
|
-
- Supports dynamic language switching
|
|
267
|
-
- Provides complete translation management
|
|
268
|
-
|
|
269
|
-
- **i18next-browser-languagedetector** (^8.0.2)
|
|
270
|
-
- Browser language detection
|
|
271
|
-
- Automatically detects user language preferences
|
|
272
|
-
- Supports multiple detection strategies
|
|
273
|
-
|
|
274
|
-
- **i18next-http-backend** (^3.0.1)
|
|
275
|
-
- Translation resource loader
|
|
276
|
-
- Supports dynamic loading of translation files
|
|
277
|
-
- Implements on-demand loading
|
|
278
|
-
|
|
279
|
-
#### Dependency Injection
|
|
280
|
-
|
|
281
|
-
- **inversify** (^7.1.0)
|
|
282
|
-
- IoC container implementation
|
|
283
|
-
- For dependency injection
|
|
284
|
-
- Provides service management and registration
|
|
285
|
-
|
|
286
|
-
- **reflect-metadata** (^0.2.2)
|
|
287
|
-
- Metadata reflection support
|
|
288
|
-
- For decorator implementation
|
|
289
|
-
- Supports dependency injection type information
|
|
290
|
-
|
|
291
|
-
### Development Dependencies
|
|
292
|
-
|
|
293
|
-
#### Build Tools
|
|
294
|
-
|
|
295
|
-
- **vite** (^6.3.5)
|
|
296
|
-
- Modern build tool
|
|
297
|
-
- Provides fast development server
|
|
298
|
-
- Supports ESM and resource optimization
|
|
299
|
-
|
|
300
|
-
- **@vitejs/plugin-react** (^4.4.1)
|
|
301
|
-
- React plugin
|
|
302
|
-
- Provides React-specific optimizations
|
|
303
|
-
- Supports Fast Refresh
|
|
304
|
-
|
|
305
|
-
#### Type Support
|
|
306
|
-
|
|
307
|
-
- **typescript** (^5.6.3)
|
|
308
|
-
- JavaScript superset
|
|
309
|
-
- Provides type checking
|
|
310
|
-
- Enhances development experience
|
|
311
|
-
|
|
312
|
-
#### Code Quality
|
|
313
|
-
|
|
314
|
-
- **eslint** (^9.15.0)
|
|
315
|
-
- Code checking tool
|
|
316
|
-
- Ensures code quality
|
|
317
|
-
- Supports custom rules
|
|
318
|
-
|
|
319
|
-
- **prettier** (^3.5.3)
|
|
320
|
-
- Code formatting tool
|
|
321
|
-
- Unifies code style
|
|
322
|
-
- Integrates with ESLint
|
|
323
|
-
|
|
324
|
-
#### Testing Tools
|
|
325
|
-
|
|
326
|
-
- **vitest** (^3.0.5)
|
|
327
|
-
- Unit testing framework
|
|
328
|
-
- Deeply integrates with Vite
|
|
329
|
-
- Provides fast test execution
|
|
330
|
-
|
|
331
|
-
### Custom Tool Packages
|
|
332
|
-
|
|
333
|
-
#### Logging System
|
|
334
|
-
|
|
335
|
-
- **@qlover/logger** (^0.1.1)
|
|
336
|
-
- Unified log management
|
|
337
|
-
- Supports different log levels
|
|
338
|
-
- Provides formatted output
|
|
339
|
-
|
|
340
|
-
#### Environment Configuration
|
|
341
|
-
|
|
342
|
-
- **@qlover/env-loader**
|
|
343
|
-
- Environment variable loading
|
|
344
|
-
- Supports multi-environment configuration
|
|
345
|
-
- Type-safe configuration access
|
|
346
|
-
|
|
347
|
-
#### Development Tools
|
|
348
|
-
|
|
349
|
-
- **@qlover/fe-scripts**
|
|
350
|
-
- Development script collection
|
|
351
|
-
- Provides common development commands
|
|
352
|
-
- Simplifies development process
|
|
353
|
-
|
|
354
|
-
#### Code Standards
|
|
355
|
-
|
|
356
|
-
- **@qlover/fe-standard** (^0.0.4)
|
|
357
|
-
- Unified code standards
|
|
358
|
-
- ESLint rule set
|
|
359
|
-
- TypeScript configuration
|
|
360
|
-
|
|
361
|
-
## Dependency Version Management
|
|
362
|
-
|
|
363
|
-
### Version Update Strategy
|
|
364
|
-
|
|
365
|
-
- Core dependencies: Careful updates, requires complete testing
|
|
366
|
-
- UI framework: Follow official LTS versions
|
|
367
|
-
- Tool dependencies: Regular updates to latest versions
|
|
368
|
-
- Custom packages: Use latest tag to track newest versions
|
|
369
|
-
|
|
370
|
-
### Dependency Check
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
# Check outdated dependencies
|
|
374
|
-
npm outdated
|
|
375
|
-
|
|
376
|
-
# Update dependencies
|
|
377
|
-
npm update
|
|
378
|
-
|
|
379
|
-
# Install specific version
|
|
380
|
-
npm install package@version
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
## Development Guide
|
|
384
|
-
|
|
385
|
-
### 1. Getting Started
|
|
386
|
-
|
|
387
|
-
```bash
|
|
388
|
-
# Install dependencies
|
|
389
|
-
npm install
|
|
390
|
-
|
|
391
|
-
# Start development server
|
|
392
|
-
npm run dev
|
|
393
|
-
|
|
394
|
-
# Build production version
|
|
395
|
-
npm run build
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### 2. Adding New Features
|
|
399
|
-
|
|
400
|
-
1. Add service in `src/base/services`
|
|
401
|
-
2. Add API in `src/base/apis`
|
|
402
|
-
3. Add page component in `src/pages`
|
|
403
|
-
4. Add route configuration in `config/app.router.ts`
|
|
404
|
-
5. Add common component in `src/uikit/components`
|
|
405
|
-
|
|
406
|
-
### 3. Testing
|
|
407
|
-
|
|
408
|
-
```bash
|
|
409
|
-
# Run all tests
|
|
410
|
-
npm test
|
|
411
|
-
|
|
412
|
-
# Run specific test
|
|
413
|
-
npm test <test-file>
|
|
414
|
-
|
|
415
|
-
# Update snapshots
|
|
416
|
-
npm test -- -u
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
## Important Notes
|
|
420
|
-
|
|
421
|
-
1. **Code Organization**
|
|
422
|
-
- Follow directory structure standards
|
|
423
|
-
- Use appropriate file naming
|
|
424
|
-
- Keep code modular
|
|
425
|
-
|
|
426
|
-
2. **Performance Considerations**
|
|
427
|
-
- Use code splitting appropriately
|
|
428
|
-
- Optimize component rendering
|
|
429
|
-
- Control dependency size
|
|
430
|
-
|
|
431
|
-
3. **Security**
|
|
432
|
-
- Follow security best practices
|
|
433
|
-
- Handle user data correctly
|
|
434
|
-
- Protect sensitive information
|