@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,9 +1,8 @@
|
|
|
1
|
-
import { I18nServiceLocale } from '@/base/services/I18nService';
|
|
2
|
-
import { IOC } from '@/core/IOC';
|
|
3
1
|
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
4
2
|
import { useEffect } from 'react';
|
|
5
|
-
import { useNavigate } from 'react-router-dom';
|
|
6
|
-
import {
|
|
3
|
+
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
4
|
+
import type { LocaleType } from '@config/i18n/i18nConfig';
|
|
5
|
+
import { useIOC } from './useIOC';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Language Guard
|
|
@@ -13,13 +12,11 @@ import { useParams } from 'react-router-dom';
|
|
|
13
12
|
* TODO: if language not found, use default language
|
|
14
13
|
*/
|
|
15
14
|
export function useI18nGuard() {
|
|
16
|
-
const { lng } = useParams<{ lng:
|
|
15
|
+
const { lng } = useParams<{ lng: LocaleType }>();
|
|
16
|
+
const { pathname } = useLocation();
|
|
17
17
|
const navigate = useNavigate();
|
|
18
|
-
|
|
18
|
+
const routeService = useIOC(IOCIdentifier.RouteServiceInterface);
|
|
19
19
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
navigate
|
|
23
|
-
);
|
|
24
|
-
}, [lng, navigate]);
|
|
20
|
+
routeService.i18nGuard(pathname, lng as LocaleType, navigate);
|
|
21
|
+
}, [lng, navigate, pathname]);
|
|
25
22
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { TranslateI18nInterface } from '@/base/cases/TranslateI18nInterface';
|
|
3
|
+
import { useAppTranslation } from './useAppTranslation';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook to get the i18n interface
|
|
7
|
+
*
|
|
8
|
+
* @param i18nInterface - The i18n interface to get
|
|
9
|
+
* @returns The i18n interface
|
|
10
|
+
*/
|
|
11
|
+
export function useI18nInterface<T extends Record<string, string>>(
|
|
12
|
+
i18nInterface: T
|
|
13
|
+
): T {
|
|
14
|
+
const { t } = useAppTranslation('common');
|
|
15
|
+
|
|
16
|
+
const i18n = useMemo(() => {
|
|
17
|
+
if (Object.keys(i18nInterface).length > 0) {
|
|
18
|
+
return TranslateI18nInterface.translate(i18nInterface, t);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {} as T;
|
|
22
|
+
}, [i18nInterface, t]);
|
|
23
|
+
|
|
24
|
+
return i18n;
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import type { IOCIdentifierMap } from '@config/IOCIdentifier';
|
|
3
|
+
import { IOCContext } from './../contexts/IOCContext';
|
|
4
|
+
import type {
|
|
5
|
+
IOCContainerInterface,
|
|
6
|
+
IOCFunctionInterface
|
|
7
|
+
} from '@qlover/corekit-bridge';
|
|
8
|
+
|
|
9
|
+
type IOCIdentifier = keyof IOCIdentifierMap | (new (...args: any[]) => any);
|
|
10
|
+
|
|
11
|
+
export function useIOC(): IOCFunctionInterface<
|
|
12
|
+
IOCIdentifierMap,
|
|
13
|
+
IOCContainerInterface
|
|
14
|
+
>;
|
|
15
|
+
export function useIOC<T extends IOCIdentifier>(
|
|
16
|
+
identifier: T
|
|
17
|
+
): T extends keyof IOCIdentifierMap
|
|
18
|
+
? IOCIdentifierMap[T]
|
|
19
|
+
: T extends new (...args: any[]) => any
|
|
20
|
+
? InstanceType<T>
|
|
21
|
+
: never;
|
|
22
|
+
|
|
23
|
+
export function useIOC<T extends IOCIdentifier>(identifier?: T) {
|
|
24
|
+
const IOC = useContext(IOCContext);
|
|
25
|
+
|
|
26
|
+
if (!IOC) {
|
|
27
|
+
throw new Error('IOC is not found');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (identifier === undefined) {
|
|
31
|
+
return IOC;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return IOC(identifier);
|
|
35
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IOC } from '@/core/IOC';
|
|
2
1
|
import { useEffect } from 'react';
|
|
3
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useIOC } from './useIOC';
|
|
4
4
|
import { NavigateBridge } from '../bridges/NavigateBridge';
|
|
5
5
|
|
|
6
6
|
export function useNavigateBridge() {
|
|
7
7
|
const navigate = useNavigate();
|
|
8
|
-
|
|
8
|
+
const navigateBridge = useIOC(NavigateBridge);
|
|
9
9
|
useEffect(() => {
|
|
10
|
-
|
|
10
|
+
navigateBridge.setUIBridge(navigate);
|
|
11
11
|
}, [navigate]);
|
|
12
12
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2023"],
|
|
7
|
+
"types": ["node", "@playwright/test"],
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"allowImportingTsExtensions": false,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"baseUrl": ".",
|
|
15
|
+
"paths": {
|
|
16
|
+
"@config/*": ["./config/*"]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"include": ["e2e/**/*.ts", "playwright.config.ts"],
|
|
20
|
+
"exclude": ["node_modules", "dist"]
|
|
21
|
+
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"paths": {
|
|
6
|
+
"@config/*": ["./config/*"]
|
|
7
|
+
}
|
|
8
|
+
},
|
|
3
9
|
"references": [
|
|
4
10
|
{ "path": "./tsconfig.app.json" },
|
|
5
11
|
{ "path": "./tsconfig.node.json" },
|
|
6
|
-
{ "path": "./tsconfig.test.json" }
|
|
12
|
+
{ "path": "./tsconfig.test.json" },
|
|
13
|
+
{ "path": "./tsconfig.e2e.json" }
|
|
7
14
|
]
|
|
8
15
|
}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
"types": ["vitest/globals", "vite/client"],
|
|
6
6
|
"paths": {
|
|
7
7
|
"@/*": ["./src/*"],
|
|
8
|
-
"@config/*": ["./config/*"]
|
|
8
|
+
"@config/*": ["./config/*"],
|
|
9
|
+
"@__tests__/*": ["./__tests__/*"],
|
|
10
|
+
"@__mocks__/*": ["./__tests__/__mocks__/*"]
|
|
9
11
|
}
|
|
10
12
|
},
|
|
11
13
|
"include": ["__tests__/**/*"],
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import viteDeprecatedAntd from '@brain-toolkit/antd-theme-override/vite';
|
|
2
|
+
import ts2Locales from '@brain-toolkit/ts2locales/vite';
|
|
3
|
+
import envConfig from '@qlover/corekit-bridge/build/vite-env-config';
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
5
|
+
import react from '@vitejs/plugin-react-swc';
|
|
6
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
7
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
2
8
|
import { defineConfig } from 'vitest/config';
|
|
3
|
-
import react from '@vitejs/plugin-react';
|
|
4
9
|
import {
|
|
5
10
|
envPrefix,
|
|
6
11
|
overrideAntdThemeMode,
|
|
7
12
|
routerPrefix
|
|
8
13
|
} from './config/common';
|
|
14
|
+
import { i18nConfig } from './config/i18n/i18nConfig';
|
|
15
|
+
import { generateTs2LocalesOptions } from './makes/generateTs2LocalesOptions';
|
|
9
16
|
import { name, version } from './package.json';
|
|
10
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
11
|
-
import envConfig from '@qlover/corekit-bridge/build/vite-env-config';
|
|
12
|
-
import ts2Locales from '@brain-toolkit/ts2locales/vite';
|
|
13
|
-
import i18nConfig from './config/i18n';
|
|
14
|
-
import tailwindcss from '@tailwindcss/vite';
|
|
15
|
-
import viteDeprecatedAntd from '@brain-toolkit/antd-theme-override/vite';
|
|
16
|
-
import vitePluginImp from 'vite-plugin-imp';
|
|
17
|
-
import { readdirSync } from 'fs';
|
|
18
|
-
import { join } from 'path';
|
|
19
17
|
|
|
20
18
|
// https://vite.dev/config/
|
|
21
19
|
export default defineConfig({
|
|
@@ -73,15 +71,6 @@ export default defineConfig({
|
|
|
73
71
|
},
|
|
74
72
|
plugins: [
|
|
75
73
|
tailwindcss(),
|
|
76
|
-
vitePluginImp({
|
|
77
|
-
libList: [
|
|
78
|
-
{
|
|
79
|
-
libName: 'antd',
|
|
80
|
-
style: (name) => `antd/es/${name}/style/index`,
|
|
81
|
-
libDirectory: 'es'
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}),
|
|
85
74
|
envConfig({
|
|
86
75
|
envPops: true,
|
|
87
76
|
envPrefix,
|
|
@@ -90,39 +79,66 @@ export default defineConfig({
|
|
|
90
79
|
['APP_VERSION', version]
|
|
91
80
|
]
|
|
92
81
|
}),
|
|
93
|
-
react(
|
|
82
|
+
react({
|
|
83
|
+
tsDecorators: true
|
|
84
|
+
}),
|
|
94
85
|
tsconfigPaths(),
|
|
95
86
|
ts2Locales({
|
|
96
87
|
locales: i18nConfig.supportedLngs as unknown as string[],
|
|
97
|
-
options:
|
|
98
|
-
.map((file) => ({
|
|
99
|
-
file,
|
|
100
|
-
name: file.replace('.ts', ''),
|
|
101
|
-
path: join('./config/Identifier', file)
|
|
102
|
-
}))
|
|
103
|
-
.map(({ path }) => ({
|
|
104
|
-
source: path,
|
|
105
|
-
// You can use namespace
|
|
106
|
-
// target: `./public/locales/{{lng}}/{{${name}}}.json`
|
|
107
|
-
target: `./public/locales/{{lng}}/common.json`
|
|
108
|
-
}))
|
|
88
|
+
options: generateTs2LocalesOptions()
|
|
109
89
|
}),
|
|
110
90
|
viteDeprecatedAntd({
|
|
111
91
|
mode: overrideAntdThemeMode,
|
|
112
92
|
overriedCssFilePath: './src/styles/css/antd-themes/no-context.css',
|
|
113
93
|
targetPath: './src/base/types/deprecated-antd.d.ts'
|
|
94
|
+
}),
|
|
95
|
+
// Bundle size analysis tool
|
|
96
|
+
visualizer({
|
|
97
|
+
filename: './dist/stats.html',
|
|
98
|
+
open: false,
|
|
99
|
+
gzipSize: true,
|
|
100
|
+
brotliSize: true,
|
|
101
|
+
template: 'treemap' // 'sunburst' | 'treemap' | 'network'
|
|
114
102
|
})
|
|
115
103
|
] as any[],
|
|
116
104
|
base: routerPrefix,
|
|
117
105
|
envPrefix: envPrefix,
|
|
118
106
|
publicDir: 'public',
|
|
119
107
|
server: {
|
|
120
|
-
port: Number(process.env.VITE_SERVER_PORT || 3200)
|
|
108
|
+
port: Number(process.env.VITE_SERVER_PORT || 3200),
|
|
109
|
+
fs: {
|
|
110
|
+
deny: ['**/playwright-report/**']
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
optimizeDeps: {
|
|
114
|
+
// exclude: ['playwright-report'],
|
|
115
|
+
esbuildOptions: {
|
|
116
|
+
tsconfigRaw: {
|
|
117
|
+
compilerOptions: {
|
|
118
|
+
/**
|
|
119
|
+
* Solve the problem, tsconfig.json has already configured experimentalDecorators: true,
|
|
120
|
+
* esbuild uses a separate configuration when compiling?
|
|
121
|
+
*
|
|
122
|
+
* X [ERROR] Parameter decorators only work when experimental decorators are enabled
|
|
123
|
+
* You can enable experimental decorators by adding "experimentalDecorators": true to your "tsconfig.json" file.
|
|
124
|
+
*/
|
|
125
|
+
experimentalDecorators: true
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* If current project has other html files, it will automatically scan all html files,
|
|
131
|
+
* like some automatically generated html files, like: playwright-report/index.html,
|
|
132
|
+
* so we need to exclude them.
|
|
133
|
+
*/
|
|
134
|
+
entries: ['index.html']
|
|
121
135
|
},
|
|
122
136
|
test: {
|
|
123
137
|
watch: false,
|
|
124
138
|
environment: 'jsdom',
|
|
125
139
|
globals: true,
|
|
140
|
+
include: ['__tests__/**/*.test.ts', '__tests__/**/*.test.tsx'],
|
|
141
|
+
exclude: ['__tests__/**/*.e2e.ts', '__tests__/**/*.e2e.tsx'],
|
|
126
142
|
setupFiles: ['./__tests__/setup/index.ts']
|
|
127
143
|
}
|
|
128
144
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlover/create-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Create a new app with a single command",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@qlover/scripts-context": "1.1.4"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
+
"lint": "eslint src --fix",
|
|
44
45
|
"build": "tsup",
|
|
45
46
|
"create:app": "node ./dist/index.js"
|
|
46
47
|
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import globals from 'globals';
|
|
3
|
-
import vitest from 'eslint-plugin-vitest';
|
|
4
|
-
import * as eslintChain from '@qlover/fe-standard/eslint/index.js';
|
|
5
|
-
import qloverEslint from '@qlover/eslint-plugin';
|
|
6
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
7
|
-
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
8
|
-
import tseslint from 'typescript-eslint';
|
|
9
|
-
import prettier from 'eslint-plugin-prettier';
|
|
10
|
-
import prettierConfig from './.prettierrc.js';
|
|
11
|
-
|
|
12
|
-
const { createCommon, chainEnv } = eslintChain;
|
|
13
|
-
const allGlobals = {
|
|
14
|
-
...globals.browser,
|
|
15
|
-
...globals.vitest,
|
|
16
|
-
...vitest.environments.env.globals
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function createVitestConfig() {
|
|
20
|
-
const config = chainEnv({
|
|
21
|
-
allGlobals,
|
|
22
|
-
files: [
|
|
23
|
-
'packages/**/__tests__/**/*.test.ts',
|
|
24
|
-
'packages/**/__tests__/**/*.test.tsx'
|
|
25
|
-
],
|
|
26
|
-
plugins: {
|
|
27
|
-
vitest
|
|
28
|
-
},
|
|
29
|
-
languageOptions: {
|
|
30
|
-
globals: {
|
|
31
|
-
...globals.browser,
|
|
32
|
-
...globals.node,
|
|
33
|
-
...vitest.environments.env.globals
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return config;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const commonConfig = createCommon();
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @type {import('eslint').Linter.Config[]}
|
|
44
|
-
*/
|
|
45
|
-
export default tseslint.config([
|
|
46
|
-
{
|
|
47
|
-
ignores: ['**/dist/**', '**/build/**', '**/node_modules/**']
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
files: ['**/*.{js,jsx}'],
|
|
52
|
-
extends: [js.configs.recommended, commonConfig],
|
|
53
|
-
plugins: {
|
|
54
|
-
prettier: prettier
|
|
55
|
-
},
|
|
56
|
-
rules: {
|
|
57
|
-
...js.configs.recommended.rules,
|
|
58
|
-
'prettier/prettier': ['error', prettierConfig],
|
|
59
|
-
'spaced-comment': 'error'
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
files: ['**/*.{ts,tsx}'],
|
|
65
|
-
extends: [...tseslint.configs.recommended],
|
|
66
|
-
|
|
67
|
-
languageOptions: {
|
|
68
|
-
ecmaVersion: 2020,
|
|
69
|
-
globals: globals.browser
|
|
70
|
-
},
|
|
71
|
-
plugins: {
|
|
72
|
-
'react-hooks': reactHooks,
|
|
73
|
-
'react-refresh': reactRefresh,
|
|
74
|
-
'@qlover-eslint': qloverEslint
|
|
75
|
-
},
|
|
76
|
-
rules: {
|
|
77
|
-
'@qlover-eslint/ts-class-method-return': 'error',
|
|
78
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
79
|
-
'@typescript-eslint/no-empty-object-type': 'off',
|
|
80
|
-
'@typescript-eslint/no-unused-vars': [
|
|
81
|
-
'error',
|
|
82
|
-
{ argsIgnorePattern: '^_' }
|
|
83
|
-
],
|
|
84
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
85
|
-
...reactHooks.configs.recommended.rules,
|
|
86
|
-
'react-refresh/only-export-components': [
|
|
87
|
-
'warn',
|
|
88
|
-
{ allowConstantExport: true }
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
createVitestConfig()
|
|
94
|
-
]);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 本地未找到 user token
|
|
3
|
-
* @localZh 本地未找到 user token
|
|
4
|
-
* @localEn Local no user token
|
|
5
|
-
*/
|
|
6
|
-
export const LOCAL_NO_USER_TOKEN = 'err__local__no__user__token';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @description 全局未找到 window
|
|
10
|
-
* @localZh 全局未找到 window
|
|
11
|
-
* @localEn Global no window
|
|
12
|
-
*/
|
|
13
|
-
export const GLOBAL_NO_WINDOW = 'err__global__no__window';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @description 必须在 PageProvider 中使用
|
|
17
|
-
* @localZh 必须在 PageProvider 中使用
|
|
18
|
-
* @localEn Must be used in PageProvider
|
|
19
|
-
*/
|
|
20
|
-
export const WITHIN_PAGE_PROVIDER = 'err__within__page__provider';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @description 响应内容没有 token 值
|
|
24
|
-
* @localZh 响应内容没有 token 值
|
|
25
|
-
* @localEn Response not token value
|
|
26
|
-
*/
|
|
27
|
-
export const RES_NO_TOKEN = 'err__response__no__token';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @description 未找到组件
|
|
31
|
-
* @localZh 未找到组件
|
|
32
|
-
* @localEn Not found component
|
|
33
|
-
*/
|
|
34
|
-
export const NOT_FOUND_COMPONENT = 'err__not__found__component';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @description 服务器认证错误
|
|
38
|
-
* @localZh 服务器认证错误
|
|
39
|
-
* @localEn Server auth error
|
|
40
|
-
*/
|
|
41
|
-
export const SERVER_AUTH_ERROR = 'err__server__auth__error';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Theme switcher default theme label
|
|
3
|
-
* @localZh 默认主题
|
|
4
|
-
* @localEn Default Theme
|
|
5
|
-
*/
|
|
6
|
-
export const HEADER_THEME_DEFAULT = 'header__theme__default';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @description Theme switcher dark theme label
|
|
10
|
-
* @localZh 暗色主题
|
|
11
|
-
* @localEn Dark Theme
|
|
12
|
-
*/
|
|
13
|
-
export const HEADER_THEME_DARK = 'header__theme__dark';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @description Theme switcher pink theme label
|
|
17
|
-
* @localZh 粉色主题
|
|
18
|
-
* @localEn Pink Theme
|
|
19
|
-
*/
|
|
20
|
-
export const HEADER_THEME_PINK = 'header__theme__pink';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @description logout dialog title
|
|
24
|
-
* @localZh 登出
|
|
25
|
-
* @localEn Logout
|
|
26
|
-
*/
|
|
27
|
-
export const AUTH_LOGOUT_DIALOG_TITLE = 'auth__logout__dialog__title';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @description logout dialog content
|
|
31
|
-
* @localZh 确定要登出吗?
|
|
32
|
-
* @localEn Are you sure you want to logout?
|
|
33
|
-
*/
|
|
34
|
-
export const AUTH_LOGOUT_DIALOG_CONTENT = 'auth__logout__dialog__content';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @description 404 page title
|
|
38
|
-
* @localZh 404 页面未找到
|
|
39
|
-
* @localEn 404 Page Not Found
|
|
40
|
-
*/
|
|
41
|
-
export const PAGE_404_TITLE = 'page__404__title';
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @description 404 page description
|
|
45
|
-
* @localZh 404 页面描述
|
|
46
|
-
* @localEn 404 Page Description
|
|
47
|
-
*/
|
|
48
|
-
export const PAGE_404_DESCRIPTION = 'page__404__description';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @description 500 page title
|
|
52
|
-
* @localZh 500 页面错误
|
|
53
|
-
* @localEn 500 Page Error
|
|
54
|
-
*/
|
|
55
|
-
export const PAGE_500_TITLE = 'page__500__title';
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @description 500 page description
|
|
59
|
-
* @localZh 500 页面描述
|
|
60
|
-
* @localEn 500 Page Description
|
|
61
|
-
*/
|
|
62
|
-
export const PAGE_500_DESCRIPTION = 'page__500__description';
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @description Admin page title
|
|
66
|
-
* @localZh 管理后台
|
|
67
|
-
* @localEn Admin Backend
|
|
68
|
-
*/
|
|
69
|
-
export const PAGE_HEAD_ADMIN_TITLE = 'page__head__admin__title';
|