@qlover/create-app 1.1.0 → 2.0.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 +28 -0
- package/dist/index.cjs +9 -9
- package/dist/index.js +9 -9
- package/package.json +3 -2
- package/dist/configs/_common/.editorconfig +0 -23
- package/dist/configs/_common/.env.template +0 -13
- package/dist/configs/_common/.gitattributes +0 -2
- package/dist/configs/_common/.github/workflows/general-check.yml +0 -41
- package/dist/configs/_common/.github/workflows/release.yml +0 -81
- package/dist/configs/_common/.gitignore.template +0 -64
- package/dist/configs/_common/.husky/commit-msg +0 -3
- package/dist/configs/_common/.husky/pre-commit +0 -3
- package/dist/configs/_common/.prettierignore +0 -17
- package/dist/configs/_common/.prettierrc.js +0 -7
- package/dist/configs/_common/.vscode/extensions.json +0 -9
- package/dist/configs/_common/.vscode/react.code-snippets +0 -19
- package/dist/configs/_common/.vscode/settings.json +0 -16
- package/dist/configs/_common/commitlint.config.js +0 -10
- package/dist/configs/_common/package.json.template +0 -75
- package/dist/configs/node-lib/eslint.config.js +0 -50
- package/dist/templates/next-app/.env.template +0 -25
- package/dist/templates/next-app/.prettierignore +0 -58
- package/dist/templates/next-app/README.en.md +0 -130
- package/dist/templates/next-app/README.md +0 -130
- package/dist/templates/next-app/config/IOCIdentifier.ts +0 -74
- package/dist/templates/next-app/config/Identifier/api.ts +0 -41
- package/dist/templates/next-app/config/Identifier/common/admint.table.ts +0 -69
- package/dist/templates/next-app/config/Identifier/common/common.ts +0 -90
- package/dist/templates/next-app/config/Identifier/common/index.ts +0 -3
- package/dist/templates/next-app/config/Identifier/common/validators.ts +0 -34
- package/dist/templates/next-app/config/Identifier/index.ts +0 -3
- package/dist/templates/next-app/config/Identifier/pages/index.ts +0 -7
- package/dist/templates/next-app/config/Identifier/pages/page.about.ts +0 -20
- package/dist/templates/next-app/config/Identifier/pages/page.admin.home.ts +0 -27
- package/dist/templates/next-app/config/Identifier/pages/page.admin.locales.ts +0 -266
- package/dist/templates/next-app/config/Identifier/pages/page.admin.user.ts +0 -293
- package/dist/templates/next-app/config/Identifier/pages/page.home.ts +0 -56
- package/dist/templates/next-app/config/Identifier/pages/page.login.ts +0 -159
- package/dist/templates/next-app/config/Identifier/pages/page.register.ts +0 -177
- package/dist/templates/next-app/config/adminNavs.ts +0 -19
- package/dist/templates/next-app/config/common.ts +0 -43
- package/dist/templates/next-app/config/cookies.ts +0 -23
- package/dist/templates/next-app/config/i18n/AboutI18n.ts +0 -14
- package/dist/templates/next-app/config/i18n/HomeI18n.ts +0 -24
- package/dist/templates/next-app/config/i18n/PageI18nInterface.ts +0 -51
- package/dist/templates/next-app/config/i18n/admin18n.ts +0 -75
- package/dist/templates/next-app/config/i18n/i18nConfig.ts +0 -16
- package/dist/templates/next-app/config/i18n/i18nKeyScheam.ts +0 -36
- package/dist/templates/next-app/config/i18n/index.ts +0 -7
- package/dist/templates/next-app/config/i18n/loginI18n.ts +0 -50
- package/dist/templates/next-app/config/i18n/register18n.ts +0 -44
- package/dist/templates/next-app/config/route.ts +0 -9
- package/dist/templates/next-app/config/theme.ts +0 -28
- package/dist/templates/next-app/docs/en/api.md +0 -387
- package/dist/templates/next-app/docs/en/component.md +0 -544
- package/dist/templates/next-app/docs/en/database.md +0 -496
- package/dist/templates/next-app/docs/en/development-guide.md +0 -727
- package/dist/templates/next-app/docs/en/env.md +0 -563
- package/dist/templates/next-app/docs/en/i18n.md +0 -287
- package/dist/templates/next-app/docs/en/index.md +0 -165
- package/dist/templates/next-app/docs/en/page.md +0 -457
- package/dist/templates/next-app/docs/en/project-structure.md +0 -176
- package/dist/templates/next-app/docs/en/router.md +0 -427
- package/dist/templates/next-app/docs/en/theme.md +0 -532
- package/dist/templates/next-app/docs/en/validator.md +0 -478
- package/dist/templates/next-app/docs/zh/api.md +0 -387
- package/dist/templates/next-app/docs/zh/component.md +0 -544
- package/dist/templates/next-app/docs/zh/database.md +0 -496
- package/dist/templates/next-app/docs/zh/development-guide.md +0 -727
- package/dist/templates/next-app/docs/zh/env.md +0 -563
- package/dist/templates/next-app/docs/zh/i18n.md +0 -287
- package/dist/templates/next-app/docs/zh/index.md +0 -165
- package/dist/templates/next-app/docs/zh/page.md +0 -457
- package/dist/templates/next-app/docs/zh/project-structure.md +0 -176
- package/dist/templates/next-app/docs/zh/router.md +0 -427
- package/dist/templates/next-app/docs/zh/theme.md +0 -532
- package/dist/templates/next-app/docs/zh/validator.md +0 -476
- package/dist/templates/next-app/eslint.config.mjs +0 -285
- package/dist/templates/next-app/make/generateLocales.ts +0 -32
- package/dist/templates/next-app/migrations/schema/LocalesSchema.ts +0 -15
- package/dist/templates/next-app/migrations/schema/UserSchema.ts +0 -38
- package/dist/templates/next-app/migrations/sql/1694244000000.sql +0 -21
- package/dist/templates/next-app/next.config.ts +0 -25
- package/dist/templates/next-app/package.json +0 -87
- package/dist/templates/next-app/postcss.config.mjs +0 -5
- package/dist/templates/next-app/public/favicon.ico +0 -0
- package/dist/templates/next-app/public/file.svg +0 -1
- package/dist/templates/next-app/public/globe.svg +0 -1
- package/dist/templates/next-app/public/locales/en.json +0 -182
- package/dist/templates/next-app/public/locales/zh.json +0 -182
- package/dist/templates/next-app/public/next.svg +0 -1
- package/dist/templates/next-app/public/vercel.svg +0 -1
- package/dist/templates/next-app/public/window.svg +0 -1
- package/dist/templates/next-app/src/app/[locale]/admin/AdminI18nProvider.tsx +0 -37
- package/dist/templates/next-app/src/app/[locale]/admin/layout.tsx +0 -42
- package/dist/templates/next-app/src/app/[locale]/admin/locales/page.tsx +0 -153
- package/dist/templates/next-app/src/app/[locale]/admin/page.tsx +0 -20
- package/dist/templates/next-app/src/app/[locale]/admin/users/page.tsx +0 -67
- package/dist/templates/next-app/src/app/[locale]/auth/layout.tsx +0 -18
- package/dist/templates/next-app/src/app/[locale]/auth/login/LoginForm.tsx +0 -126
- package/dist/templates/next-app/src/app/[locale]/auth/login/page.tsx +0 -90
- package/dist/templates/next-app/src/app/[locale]/auth/page.tsx +0 -8
- package/dist/templates/next-app/src/app/[locale]/auth/register/RegisterForm.tsx +0 -197
- package/dist/templates/next-app/src/app/[locale]/auth/register/page.tsx +0 -90
- package/dist/templates/next-app/src/app/[locale]/layout.tsx +0 -63
- package/dist/templates/next-app/src/app/[locale]/not-found.tsx +0 -24
- package/dist/templates/next-app/src/app/[locale]/page.tsx +0 -98
- package/dist/templates/next-app/src/app/api/admin/locales/create/route.ts +0 -13
- package/dist/templates/next-app/src/app/api/admin/locales/import/route.ts +0 -13
- package/dist/templates/next-app/src/app/api/admin/locales/route.ts +0 -20
- package/dist/templates/next-app/src/app/api/admin/locales/update/route.ts +0 -13
- package/dist/templates/next-app/src/app/api/admin/users/route.ts +0 -20
- package/dist/templates/next-app/src/app/api/ai/completions/route.ts +0 -32
- package/dist/templates/next-app/src/app/api/auth/callback/route.ts +0 -11
- package/dist/templates/next-app/src/app/api/callback/route.ts +0 -49
- package/dist/templates/next-app/src/app/api/locales/json/route.ts +0 -33
- package/dist/templates/next-app/src/app/api/user/login/route.ts +0 -10
- package/dist/templates/next-app/src/app/api/user/logout/route.ts +0 -8
- package/dist/templates/next-app/src/app/api/user/register/route.ts +0 -11
- package/dist/templates/next-app/src/app/manifest.ts +0 -16
- package/dist/templates/next-app/src/app/robots.txt +0 -2
- package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +0 -28
- package/dist/templates/next-app/src/base/cases/AppConfig.ts +0 -40
- package/dist/templates/next-app/src/base/cases/Datetime.ts +0 -18
- package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +0 -57
- package/dist/templates/next-app/src/base/cases/DialogHandler.ts +0 -116
- package/dist/templates/next-app/src/base/cases/InversifyContainer.ts +0 -45
- package/dist/templates/next-app/src/base/cases/NavigateBridge.ts +0 -32
- package/dist/templates/next-app/src/base/cases/RequestEncryptPlugin.ts +0 -77
- package/dist/templates/next-app/src/base/cases/ResourceState.ts +0 -17
- package/dist/templates/next-app/src/base/cases/RouterService.ts +0 -52
- package/dist/templates/next-app/src/base/cases/StringEncryptor.ts +0 -73
- package/dist/templates/next-app/src/base/cases/TranslateI18nUtil.ts +0 -53
- package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +0 -212
- package/dist/templates/next-app/src/base/port/AdminLayoutInterface.ts +0 -26
- package/dist/templates/next-app/src/base/port/AppApiInterface.ts +0 -36
- package/dist/templates/next-app/src/base/port/AppUserApiInterface.ts +0 -27
- package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +0 -25
- package/dist/templates/next-app/src/base/port/IOCInterface.ts +0 -33
- package/dist/templates/next-app/src/base/port/RouterInterface.ts +0 -11
- package/dist/templates/next-app/src/base/port/UserServiceInterface.ts +0 -25
- package/dist/templates/next-app/src/base/port/ZodBuilderInterface.ts +0 -8
- package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +0 -26
- package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +0 -42
- package/dist/templates/next-app/src/base/services/AppApiRequester.ts +0 -67
- package/dist/templates/next-app/src/base/services/AppUserGateway.ts +0 -110
- package/dist/templates/next-app/src/base/services/I18nService.ts +0 -87
- package/dist/templates/next-app/src/base/services/ResourceService.ts +0 -139
- package/dist/templates/next-app/src/base/services/UserService.ts +0 -68
- package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +0 -106
- package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +0 -87
- package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +0 -110
- package/dist/templates/next-app/src/base/services/appApi/AppUserApiBootstrap.ts +0 -52
- package/dist/templates/next-app/src/base/types/AppPageRouter.ts +0 -12
- package/dist/templates/next-app/src/base/types/PagesRouter.ts +0 -9
- package/dist/templates/next-app/src/core/bootstraps/BootstrapClient.ts +0 -76
- package/dist/templates/next-app/src/core/bootstraps/BootstrapServer.ts +0 -125
- package/dist/templates/next-app/src/core/bootstraps/BootstrapsRegistry.ts +0 -50
- package/dist/templates/next-app/src/core/bootstraps/IocIdentifierTest.ts +0 -26
- package/dist/templates/next-app/src/core/bootstraps/PrintBootstrap.ts +0 -18
- package/dist/templates/next-app/src/core/clientIoc/ClientIOC.ts +0 -68
- package/dist/templates/next-app/src/core/clientIoc/ClientIOCRegister.ts +0 -100
- package/dist/templates/next-app/src/core/globals.ts +0 -28
- package/dist/templates/next-app/src/core/serverIoc/ServerIOC.ts +0 -80
- package/dist/templates/next-app/src/core/serverIoc/ServerIOCRegister.ts +0 -66
- package/dist/templates/next-app/src/i18n/loadMessages.ts +0 -103
- package/dist/templates/next-app/src/i18n/request.ts +0 -31
- package/dist/templates/next-app/src/i18n/routing.ts +0 -35
- package/dist/templates/next-app/src/lib/supabase/client.ts +0 -8
- package/dist/templates/next-app/src/lib/supabase/conts.ts +0 -2
- package/dist/templates/next-app/src/lib/supabase/proxy.ts +0 -84
- package/dist/templates/next-app/src/lib/supabase/server.ts +0 -38
- package/dist/templates/next-app/src/pages/[locale]/about.tsx +0 -61
- package/dist/templates/next-app/src/pages/_app.tsx +0 -50
- package/dist/templates/next-app/src/pages/_document.tsx +0 -13
- package/dist/templates/next-app/src/proxy.ts +0 -33
- package/dist/templates/next-app/src/server/AppErrorApi.ts +0 -10
- package/dist/templates/next-app/src/server/AppPageRouteParams.ts +0 -110
- package/dist/templates/next-app/src/server/AppSuccessApi.ts +0 -7
- package/dist/templates/next-app/src/server/NextApiServer.ts +0 -61
- package/dist/templates/next-app/src/server/PagesRouteParams.ts +0 -145
- package/dist/templates/next-app/src/server/PasswordEncrypt.ts +0 -18
- package/dist/templates/next-app/src/server/ServerAuth.ts +0 -81
- package/dist/templates/next-app/src/server/SupabaseBridge.ts +0 -262
- package/dist/templates/next-app/src/server/UserCredentialToken.ts +0 -53
- package/dist/templates/next-app/src/server/controllers/AdminLocalesController.ts +0 -86
- package/dist/templates/next-app/src/server/controllers/AdminUserController.ts +0 -42
- package/dist/templates/next-app/src/server/controllers/LocalesController.ts +0 -36
- package/dist/templates/next-app/src/server/controllers/UserController.ts +0 -91
- package/dist/templates/next-app/src/server/port/AIControllerInterface.ts +0 -8
- package/dist/templates/next-app/src/server/port/AdminLocalesControllerInterface.ts +0 -21
- package/dist/templates/next-app/src/server/port/AdminUserControllerInterface.ts +0 -11
- package/dist/templates/next-app/src/server/port/CrentialTokenInterface.ts +0 -5
- package/dist/templates/next-app/src/server/port/DBBridgeInterface.ts +0 -36
- package/dist/templates/next-app/src/server/port/DBTableInterface.ts +0 -12
- package/dist/templates/next-app/src/server/port/LocalesControllerInterface.ts +0 -10
- package/dist/templates/next-app/src/server/port/LocalesRepositoryInterface.ts +0 -43
- package/dist/templates/next-app/src/server/port/PaginationInterface.ts +0 -6
- package/dist/templates/next-app/src/server/port/RouteParamsnHandlerInterface.ts +0 -18
- package/dist/templates/next-app/src/server/port/ServerAuthInterface.ts +0 -15
- package/dist/templates/next-app/src/server/port/ServerInterface.ts +0 -23
- package/dist/templates/next-app/src/server/port/UserRepositoryInterface.ts +0 -15
- package/dist/templates/next-app/src/server/port/UserServiceInterface.ts +0 -14
- package/dist/templates/next-app/src/server/port/ValidatorInterface.ts +0 -23
- package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +0 -216
- package/dist/templates/next-app/src/server/repositorys/UserRepository.ts +0 -102
- package/dist/templates/next-app/src/server/services/AIService.ts +0 -45
- package/dist/templates/next-app/src/server/services/AdminAuthPlugin.ts +0 -21
- package/dist/templates/next-app/src/server/services/AdminLocalesService.ts +0 -20
- package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +0 -137
- package/dist/templates/next-app/src/server/services/ApiUserService.ts +0 -29
- package/dist/templates/next-app/src/server/services/UserService.ts +0 -134
- package/dist/templates/next-app/src/server/validators/ExtendedExecutorError.ts +0 -6
- package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +0 -145
- package/dist/templates/next-app/src/server/validators/LoginValidator.ts +0 -82
- package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +0 -70
- package/dist/templates/next-app/src/server/validators/SignupVerifyValidator.ts +0 -68
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/_default.css +0 -280
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/dark.css +0 -233
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/pink.css +0 -246
- package/dist/templates/next-app/src/styles/css/antd-themes/index.css +0 -4
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/_default.css +0 -108
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/dark.css +0 -67
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/pink.css +0 -67
- package/dist/templates/next-app/src/styles/css/antd-themes/no-context.css +0 -34
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/_default.css +0 -34
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/dark.css +0 -31
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/pink.css +0 -36
- package/dist/templates/next-app/src/styles/css/antd-themes/table/_default.css +0 -44
- package/dist/templates/next-app/src/styles/css/antd-themes/table/dark.css +0 -43
- package/dist/templates/next-app/src/styles/css/antd-themes/table/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/table/pink.css +0 -43
- package/dist/templates/next-app/src/styles/css/index.css +0 -6
- package/dist/templates/next-app/src/styles/css/page.css +0 -20
- package/dist/templates/next-app/src/styles/css/scrollbar.css +0 -34
- package/dist/templates/next-app/src/styles/css/tailwind.css +0 -5
- package/dist/templates/next-app/src/styles/css/themes/_default.css +0 -30
- package/dist/templates/next-app/src/styles/css/themes/dark.css +0 -30
- package/dist/templates/next-app/src/styles/css/themes/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/themes/pink.css +0 -30
- package/dist/templates/next-app/src/styles/css/zIndex.css +0 -9
- package/dist/templates/next-app/src/uikit/components/AdminLayout.tsx +0 -150
- package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +0 -39
- package/dist/templates/next-app/src/uikit/components/ClientRootProvider.tsx +0 -64
- package/dist/templates/next-app/src/uikit/components/ClientSeo.tsx +0 -36
- package/dist/templates/next-app/src/uikit/components/ClinetRenderProvider.tsx +0 -42
- package/dist/templates/next-app/src/uikit/components/EditableCell.tsx +0 -118
- package/dist/templates/next-app/src/uikit/components/FeatureItem.tsx +0 -13
- package/dist/templates/next-app/src/uikit/components/IOCProvider.tsx +0 -34
- package/dist/templates/next-app/src/uikit/components/LocaleLink.tsx +0 -50
- package/dist/templates/next-app/src/uikit/components/With.tsx +0 -17
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportButton.tsx +0 -62
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +0 -28
- package/dist/templates/next-app/src/uikit/components/localesImportButton/import.module.css +0 -6
- package/dist/templates/next-app/src/uikit/components-app/AdminButton.tsx +0 -29
- package/dist/templates/next-app/src/uikit/components-app/AppBridge.tsx +0 -17
- package/dist/templates/next-app/src/uikit/components-app/AppRoutePage.tsx +0 -105
- package/dist/templates/next-app/src/uikit/components-app/AuthButton.tsx +0 -20
- package/dist/templates/next-app/src/uikit/components-app/LanguageSwitcher.tsx +0 -75
- package/dist/templates/next-app/src/uikit/components-app/LogoutButton.tsx +0 -45
- package/dist/templates/next-app/src/uikit/components-app/ThemeSwitcher.tsx +0 -144
- package/dist/templates/next-app/src/uikit/components-pages/LanguageSwitcher.tsx +0 -98
- package/dist/templates/next-app/src/uikit/components-pages/PagesRoutePage.tsx +0 -93
- package/dist/templates/next-app/src/uikit/context/IOCContext.ts +0 -25
- package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +0 -22
- package/dist/templates/next-app/src/uikit/hook/useIOC.ts +0 -37
- package/dist/templates/next-app/src/uikit/hook/useStrictEffect.ts +0 -32
- package/dist/templates/next-app/src/uikit/hook/useWarnTranslations.ts +0 -11
- package/dist/templates/next-app/src/uikit/utils/getHashParams.ts +0 -8
- package/dist/templates/next-app/src/uikit/utils/getHashVerifyEmailParams.ts +0 -42
- package/dist/templates/next-app/tailwind.config.ts +0 -8
- package/dist/templates/next-app/tsconfig.json +0 -39
- package/dist/templates/node-lib/__tests__/readJson.test.ts +0 -26
- package/dist/templates/node-lib/bin/test.js +0 -30
- package/dist/templates/node-lib/package.json +0 -66
- package/dist/templates/node-lib/rollup.config.js +0 -79
- package/dist/templates/node-lib/src/index.ts +0 -7
- package/dist/templates/node-lib/src/readJson.ts +0 -12
- package/dist/templates/node-lib/tsconfig.json +0 -23
- package/dist/templates/pack-app/README.md +0 -108
- package/dist/templates/pack-app/eslint.config.js +0 -97
- package/dist/templates/pack-app/fe-config.json +0 -35
- package/dist/templates/pack-app/package.json +0 -86
- package/dist/templates/pack-app/pnpm-workspace.yaml +0 -2
- package/dist/templates/pack-app/tsconfig.json +0 -9
- package/dist/templates/pack-app/tsconfig.test.json +0 -10
- package/dist/templates/pack-app/vite.config.ts +0 -14
- package/dist/templates/react-app/.env.template +0 -22
- package/dist/templates/react-app/.prettierignore +0 -17
- package/dist/templates/react-app/README.en.md +0 -274
- package/dist/templates/react-app/README.md +0 -273
- package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +0 -16
- package/dist/templates/react-app/__tests__/__mocks__/MockAppConfig.ts +0 -48
- package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +0 -17
- package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +0 -14
- package/dist/templates/react-app/__tests__/__mocks__/components/TestApp.tsx +0 -38
- package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +0 -53
- package/dist/templates/react-app/__tests__/__mocks__/components/TestRouter.tsx +0 -46
- package/dist/templates/react-app/__tests__/__mocks__/components/index.ts +0 -12
- package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +0 -96
- package/dist/templates/react-app/__tests__/__mocks__/i18nextHttpBackend.ts +0 -110
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +0 -55
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +0 -74
- package/dist/templates/react-app/__tests__/setup/index.ts +0 -1
- package/dist/templates/react-app/__tests__/setup/setupGlobal.ts +0 -64
- package/dist/templates/react-app/__tests__/src/App.structure.test.tsx +0 -115
- package/dist/templates/react-app/__tests__/src/base/cases/AppConfig.test.ts +0 -288
- package/dist/templates/react-app/__tests__/src/base/cases/DialogHandler.test.ts +0 -226
- package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +0 -178
- package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +0 -181
- package/dist/templates/react-app/__tests__/src/base/cases/PublicAssetsPath.test.ts +0 -61
- package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +0 -177
- package/dist/templates/react-app/__tests__/src/base/cases/RequestStatusCatcher.test.ts +0 -191
- package/dist/templates/react-app/__tests__/src/base/cases/RouterLoader.test.ts +0 -245
- package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +0 -240
- package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +0 -242
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +0 -135
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +0 -74
- package/dist/templates/react-app/__tests__/src/main.test.tsx +0 -46
- package/dist/templates/react-app/__tests__/src/uikit/components/BaseHeader.test.tsx +0 -97
- package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +0 -274
- package/dist/templates/react-app/config/IOCIdentifier.ts +0 -91
- package/dist/templates/react-app/config/Identifier/common/common.error.ts +0 -34
- package/dist/templates/react-app/config/Identifier/common/common.ts +0 -62
- package/dist/templates/react-app/config/Identifier/common/index.ts +0 -2
- package/dist/templates/react-app/config/Identifier/components/component.chatMessage.ts +0 -56
- package/dist/templates/react-app/config/Identifier/components/component.messageBaseList.ts +0 -103
- package/dist/templates/react-app/config/Identifier/index.ts +0 -2
- package/dist/templates/react-app/config/Identifier/pages/index.ts +0 -9
- package/dist/templates/react-app/config/Identifier/pages/page.about.ts +0 -189
- package/dist/templates/react-app/config/Identifier/pages/page.executor.ts +0 -275
- package/dist/templates/react-app/config/Identifier/pages/page.home.ts +0 -71
- package/dist/templates/react-app/config/Identifier/pages/page.identifiter.ts +0 -102
- package/dist/templates/react-app/config/Identifier/pages/page.jsonStorage.ts +0 -77
- package/dist/templates/react-app/config/Identifier/pages/page.login.ts +0 -162
- package/dist/templates/react-app/config/Identifier/pages/page.message.ts +0 -20
- package/dist/templates/react-app/config/Identifier/pages/page.register.ts +0 -159
- package/dist/templates/react-app/config/Identifier/pages/page.request.ts +0 -169
- package/dist/templates/react-app/config/app.router.ts +0 -338
- package/dist/templates/react-app/config/common.ts +0 -85
- package/dist/templates/react-app/config/feapi.mock.json +0 -34
- package/dist/templates/react-app/config/i18n/PageI18nInterface.ts +0 -53
- package/dist/templates/react-app/config/i18n/aboutI18n.ts +0 -42
- package/dist/templates/react-app/config/i18n/chatMessageI18n.ts +0 -17
- package/dist/templates/react-app/config/i18n/executorI18n.ts +0 -51
- package/dist/templates/react-app/config/i18n/homeI18n.ts +0 -24
- package/dist/templates/react-app/config/i18n/i18nConfig.ts +0 -30
- package/dist/templates/react-app/config/i18n/identifiter18n.ts +0 -30
- package/dist/templates/react-app/config/i18n/jsonStorage18n.ts +0 -27
- package/dist/templates/react-app/config/i18n/login18n.ts +0 -42
- package/dist/templates/react-app/config/i18n/messageBaseListI18n.ts +0 -22
- package/dist/templates/react-app/config/i18n/messageI18n.ts +0 -14
- package/dist/templates/react-app/config/i18n/notFoundI18n.ts +0 -34
- package/dist/templates/react-app/config/i18n/register18n.ts +0 -40
- package/dist/templates/react-app/config/i18n/request18n.ts +0 -41
- package/dist/templates/react-app/config/theme.ts +0 -21
- package/dist/templates/react-app/docs/en/bootstrap.md +0 -1891
- package/dist/templates/react-app/docs/en/components/chat-message-component.md +0 -320
- package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +0 -283
- package/dist/templates/react-app/docs/en/components/message-base-list-component.md +0 -171
- package/dist/templates/react-app/docs/en/development-guide.md +0 -1199
- package/dist/templates/react-app/docs/en/env.md +0 -1336
- package/dist/templates/react-app/docs/en/global.md +0 -509
- package/dist/templates/react-app/docs/en/i18n.md +0 -979
- package/dist/templates/react-app/docs/en/index.md +0 -802
- package/dist/templates/react-app/docs/en/ioc.md +0 -1365
- package/dist/templates/react-app/docs/en/playwright/e2e-tests.md +0 -321
- package/dist/templates/react-app/docs/en/playwright/index.md +0 -19
- package/dist/templates/react-app/docs/en/playwright/installation-summary.md +0 -332
- package/dist/templates/react-app/docs/en/playwright/overview.md +0 -222
- package/dist/templates/react-app/docs/en/playwright/quickstart.md +0 -325
- package/dist/templates/react-app/docs/en/playwright/reorganization-notes.md +0 -340
- package/dist/templates/react-app/docs/en/playwright/setup-complete.md +0 -290
- package/dist/templates/react-app/docs/en/playwright/testing-guide.md +0 -565
- package/dist/templates/react-app/docs/en/request.md +0 -423
- package/dist/templates/react-app/docs/en/router.md +0 -404
- package/dist/templates/react-app/docs/en/store.md +0 -1331
- package/dist/templates/react-app/docs/en/test-guide.md +0 -976
- package/dist/templates/react-app/docs/en/theme.md +0 -424
- package/dist/templates/react-app/docs/en/typescript-guide.md +0 -473
- package/dist/templates/react-app/docs/en/why-no-globals.md +0 -797
- package/dist/templates/react-app/docs/zh/bootstrap.md +0 -1891
- package/dist/templates/react-app/docs/zh/components/chat-message-component.md +0 -320
- package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +0 -283
- package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +0 -171
- package/dist/templates/react-app/docs/zh/development-guide.md +0 -1199
- package/dist/templates/react-app/docs/zh/env.md +0 -1336
- package/dist/templates/react-app/docs/zh/global.md +0 -511
- package/dist/templates/react-app/docs/zh/i18n.md +0 -979
- package/dist/templates/react-app/docs/zh/index.md +0 -786
- package/dist/templates/react-app/docs/zh/ioc.md +0 -1364
- package/dist/templates/react-app/docs/zh/playwright/e2e-tests.md +0 -321
- package/dist/templates/react-app/docs/zh/playwright/index.md +0 -19
- package/dist/templates/react-app/docs/zh/playwright/installation-summary.md +0 -332
- package/dist/templates/react-app/docs/zh/playwright/overview.md +0 -222
- package/dist/templates/react-app/docs/zh/playwright/quickstart.md +0 -325
- package/dist/templates/react-app/docs/zh/playwright/reorganization-notes.md +0 -340
- package/dist/templates/react-app/docs/zh/playwright/setup-complete.md +0 -290
- package/dist/templates/react-app/docs/zh/playwright/testing-guide.md +0 -565
- package/dist/templates/react-app/docs/zh/request.md +0 -427
- package/dist/templates/react-app/docs/zh/router.md +0 -408
- package/dist/templates/react-app/docs/zh/store.md +0 -1329
- package/dist/templates/react-app/docs/zh/test-guide.md +0 -976
- package/dist/templates/react-app/docs/zh/theme.md +0 -424
- package/dist/templates/react-app/docs/zh/typescript-guide.md +0 -473
- package/dist/templates/react-app/docs/zh/why-no-globals.md +0 -797
- package/dist/templates/react-app/e2e/App.spec.ts +0 -319
- package/dist/templates/react-app/e2e/fixtures/base.fixture.ts +0 -40
- package/dist/templates/react-app/e2e/main.spec.ts +0 -20
- package/dist/templates/react-app/e2e/utils/test-helpers.ts +0 -19
- package/dist/templates/react-app/eslint.config.mjs +0 -325
- package/dist/templates/react-app/index.html +0 -13
- package/dist/templates/react-app/makes/generateTs2LocalesOptions.ts +0 -26
- package/dist/templates/react-app/package.json +0 -125
- package/dist/templates/react-app/playwright.config.ts +0 -79
- package/dist/templates/react-app/postcss.config.js +0 -5
- package/dist/templates/react-app/public/locales/en/common.json +0 -235
- package/dist/templates/react-app/public/locales/zh/common.json +0 -235
- package/dist/templates/react-app/public/logo.svg +0 -1
- package/dist/templates/react-app/public/router-root/logo.svg +0 -1
- package/dist/templates/react-app/src/App.tsx +0 -35
- package/dist/templates/react-app/src/assets/react.svg +0 -1
- package/dist/templates/react-app/src/base/apis/AiApi.ts +0 -68
- package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +0 -29
- package/dist/templates/react-app/src/base/apis/feApi/FeApiAdapter.ts +0 -14
- package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +0 -86
- package/dist/templates/react-app/src/base/apis/feApi/FeApiType.ts +0 -21
- package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +0 -142
- package/dist/templates/react-app/src/base/apis/userApi/UserApiAdapter.ts +0 -14
- package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +0 -86
- package/dist/templates/react-app/src/base/apis/userApi/UserApiType.ts +0 -70
- package/dist/templates/react-app/src/base/cases/AppConfig.ts +0 -123
- package/dist/templates/react-app/src/base/cases/DialogHandler.ts +0 -115
- package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +0 -64
- package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +0 -45
- package/dist/templates/react-app/src/base/cases/PublicAssetsPath.ts +0 -23
- package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +0 -55
- package/dist/templates/react-app/src/base/cases/RequestLogger.ts +0 -80
- package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +0 -40
- package/dist/templates/react-app/src/base/cases/ResourceState.ts +0 -23
- package/dist/templates/react-app/src/base/cases/RouterLoader.ts +0 -173
- package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +0 -26
- package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +0 -23
- package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +0 -10
- package/dist/templates/react-app/src/base/port/IOCInterface.ts +0 -38
- package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +0 -21
- package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +0 -23
- package/dist/templates/react-app/src/base/port/RequestStatusInterface.ts +0 -5
- package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +0 -29
- package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +0 -20
- package/dist/templates/react-app/src/base/services/BaseLayoutService.ts +0 -61
- package/dist/templates/react-app/src/base/services/I18nService.ts +0 -146
- package/dist/templates/react-app/src/base/services/IdentifierService.ts +0 -162
- package/dist/templates/react-app/src/base/services/RouteService.ts +0 -115
- package/dist/templates/react-app/src/base/services/UserBootstrap.ts +0 -45
- package/dist/templates/react-app/src/base/services/UserService.ts +0 -88
- package/dist/templates/react-app/src/base/types/Page.ts +0 -47
- package/dist/templates/react-app/src/base/types/deprecated-antd.d.ts +0 -60
- package/dist/templates/react-app/src/base/types/global.d.ts +0 -8
- package/dist/templates/react-app/src/core/IOC.ts +0 -28
- package/dist/templates/react-app/src/core/bootstraps/BootstrapClient.ts +0 -108
- package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +0 -54
- package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +0 -26
- package/dist/templates/react-app/src/core/bootstraps/PrintBootstrap.ts +0 -14
- package/dist/templates/react-app/src/core/bootstraps/SaveAppInfo.ts +0 -28
- package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +0 -47
- package/dist/templates/react-app/src/core/clientIoc/ClientIOCRegister.ts +0 -142
- package/dist/templates/react-app/src/core/globals.ts +0 -47
- package/dist/templates/react-app/src/main.tsx +0 -19
- package/dist/templates/react-app/src/pages/404.tsx +0 -19
- package/dist/templates/react-app/src/pages/500.tsx +0 -18
- package/dist/templates/react-app/src/pages/NoRouteFound.tsx +0 -5
- package/dist/templates/react-app/src/pages/auth/Layout.tsx +0 -27
- package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +0 -166
- package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +0 -226
- package/dist/templates/react-app/src/pages/base/AboutPage.tsx +0 -123
- package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +0 -467
- package/dist/templates/react-app/src/pages/base/HomePage.tsx +0 -81
- package/dist/templates/react-app/src/pages/base/IdentifierPage.tsx +0 -117
- package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +0 -132
- package/dist/templates/react-app/src/pages/base/Layout.tsx +0 -20
- package/dist/templates/react-app/src/pages/base/MessagePage.tsx +0 -71
- package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +0 -18
- package/dist/templates/react-app/src/pages/base/RequestPage.tsx +0 -193
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/_default.css +0 -280
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/dark.css +0 -233
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/pink.css +0 -246
- package/dist/templates/react-app/src/styles/css/antd-themes/index.css +0 -4
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/_default.css +0 -108
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/dark.css +0 -67
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/pink.css +0 -67
- package/dist/templates/react-app/src/styles/css/antd-themes/no-context.css +0 -34
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/_default.css +0 -34
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/dark.css +0 -31
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/pink.css +0 -36
- package/dist/templates/react-app/src/styles/css/antd-themes/table/_default.css +0 -44
- package/dist/templates/react-app/src/styles/css/antd-themes/table/dark.css +0 -43
- package/dist/templates/react-app/src/styles/css/antd-themes/table/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/table/pink.css +0 -43
- package/dist/templates/react-app/src/styles/css/index.css +0 -6
- package/dist/templates/react-app/src/styles/css/page.css +0 -20
- package/dist/templates/react-app/src/styles/css/scrollbar.css +0 -34
- package/dist/templates/react-app/src/styles/css/tailwind.css +0 -5
- package/dist/templates/react-app/src/styles/css/themes/_default.css +0 -30
- package/dist/templates/react-app/src/styles/css/themes/dark.css +0 -30
- package/dist/templates/react-app/src/styles/css/themes/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/themes/pink.css +0 -30
- package/dist/templates/react-app/src/styles/css/zIndex.css +0 -9
- package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +0 -72
- package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +0 -41
- package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +0 -22
- package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +0 -136
- package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +0 -35
- package/dist/templates/react-app/src/uikit/components/BaseHeader.tsx +0 -51
- package/dist/templates/react-app/src/uikit/components/BaseLayoutProvider.tsx +0 -44
- package/dist/templates/react-app/src/uikit/components/BaseRouteProvider.tsx +0 -21
- package/dist/templates/react-app/src/uikit/components/BaseRouteSeo.tsx +0 -18
- package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +0 -11
- package/dist/templates/react-app/src/uikit/components/ClientSeo.tsx +0 -62
- package/dist/templates/react-app/src/uikit/components/ComboProvider.tsx +0 -38
- package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +0 -78
- package/dist/templates/react-app/src/uikit/components/Loading.tsx +0 -49
- package/dist/templates/react-app/src/uikit/components/LocaleLink.tsx +0 -43
- package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +0 -58
- package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +0 -258
- package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +0 -19
- package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +0 -137
- package/dist/templates/react-app/src/uikit/components/With.tsx +0 -17
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +0 -205
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatRoot.tsx +0 -21
- package/dist/templates/react-app/src/uikit/components/chatMessage/FocusBar.tsx +0 -108
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +0 -282
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageItem.tsx +0 -102
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessagesList.tsx +0 -86
- package/dist/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +0 -42
- package/dist/templates/react-app/src/uikit/contexts/IOCContext.ts +0 -13
- package/dist/templates/react-app/src/uikit/hooks/useAppTranslation.ts +0 -26
- package/dist/templates/react-app/src/uikit/hooks/useI18nInterface.ts +0 -25
- package/dist/templates/react-app/src/uikit/hooks/useIOC.ts +0 -35
- package/dist/templates/react-app/src/uikit/hooks/useNavigateBridge.ts +0 -21
- package/dist/templates/react-app/src/uikit/hooks/useRouterI18nGuard.ts +0 -25
- package/dist/templates/react-app/src/uikit/hooks/useStrictEffect.ts +0 -31
- package/dist/templates/react-app/src/vite-env.d.ts +0 -1
- package/dist/templates/react-app/tailwind.config.js +0 -4
- package/dist/templates/react-app/tsconfig.app.json +0 -36
- package/dist/templates/react-app/tsconfig.e2e.json +0 -24
- package/dist/templates/react-app/tsconfig.json +0 -22
- package/dist/templates/react-app/tsconfig.node.json +0 -27
- package/dist/templates/react-app/tsconfig.test.json +0 -18
- package/dist/templates/react-app/vite.config.ts +0 -144
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
# 国际化 (i18n) 指南
|
|
2
|
-
|
|
3
|
-
本文档将详细介绍项目中的国际化实现,包括 API 错误信息、页面内容以及所有需要多语言支持的文本内容。
|
|
4
|
-
|
|
5
|
-
## 目录
|
|
6
|
-
|
|
7
|
-
- [基础配置](#基础配置)
|
|
8
|
-
- [API 错误信息处理](#api-错误信息处理)
|
|
9
|
-
- [页面内容国际化](#页面内容国际化)
|
|
10
|
-
- [使用规范](#使用规范)
|
|
11
|
-
|
|
12
|
-
## 基础配置
|
|
13
|
-
|
|
14
|
-
项目使用 next-intl 进行国际化管理,配置文件位于 `config/i18n/i18nConfig.ts`:
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
export const i18nConfig = {
|
|
18
|
-
localeNames: {
|
|
19
|
-
en: 'English',
|
|
20
|
-
zh: '中文'
|
|
21
|
-
},
|
|
22
|
-
fallbackLng: 'en',
|
|
23
|
-
supportedLngs: ['en', 'zh'],
|
|
24
|
-
localeDetection: true
|
|
25
|
-
};
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
所有支持的语言都在 `supportedLngs` 中定义,默认语言为 `fallbackLng` 指定的语言。
|
|
29
|
-
|
|
30
|
-
## API 错误信息处理
|
|
31
|
-
|
|
32
|
-
API 错误信息的国际化处理流程如下:
|
|
33
|
-
|
|
34
|
-
1. API 响应格式:
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
interface AppApiErrorInterface {
|
|
38
|
-
success: false;
|
|
39
|
-
id: string; // i18n key
|
|
40
|
-
message?: string; // 可选的直接显示消息
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
2. 错误处理流程:
|
|
45
|
-
- API 请求通过 `AppApiPlugin` 处理响应
|
|
46
|
-
- 如果响应表示错误,错误信息会被转换为 `ExecutorError`
|
|
47
|
-
- `DialogErrorPlugin` 负责显示错误消息
|
|
48
|
-
- 如果错误消息是 i18n key 格式(如 "namespace_key"),则会通过 i18n 服务翻译后显示
|
|
49
|
-
- 如果不是 i18n key 格式,则直接显示原始消息
|
|
50
|
-
|
|
51
|
-
示例:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
// API 返回错误
|
|
55
|
-
{
|
|
56
|
-
success: false,
|
|
57
|
-
id: "error_invalid_password"
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// DialogErrorPlugin 会自动翻译并显示对应语言的错误信息
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## 页面内容国际化
|
|
64
|
-
|
|
65
|
-
### PageI18nInterface
|
|
66
|
-
|
|
67
|
-
`PageI18nInterface` 是一个核心接口,用于定义页面的国际化内容和 SEO 元数据。这个接口提供了完整的页面元数据结构,包括基本 SEO 信息、Open Graph、Twitter Card 等。
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
interface PageI18nInterface {
|
|
71
|
-
// 基本元数据属性
|
|
72
|
-
title: string; // 页面标题
|
|
73
|
-
description: string; // 页面描述
|
|
74
|
-
content: string; // 页面内容
|
|
75
|
-
keywords: string; // 页面关键词
|
|
76
|
-
|
|
77
|
-
// 规范链接
|
|
78
|
-
canonical?: string; // 可选的规范链接
|
|
79
|
-
|
|
80
|
-
// 爬虫控制
|
|
81
|
-
robots?: {
|
|
82
|
-
index?: boolean; // 是否允许索引
|
|
83
|
-
follow?: boolean; // 是否跟随链接
|
|
84
|
-
noarchive?: boolean; // 是否允许存档
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// Open Graph 元数据
|
|
88
|
-
og?: {
|
|
89
|
-
title?: string; // OG 标题
|
|
90
|
-
description?: string; // OG 描述
|
|
91
|
-
type?: string; // 内容类型
|
|
92
|
-
image?: string; // 图片 URL
|
|
93
|
-
url?: string; // 页面 URL
|
|
94
|
-
siteName?: string; // 站点名称
|
|
95
|
-
locale?: string; // 语言地区
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Twitter Card 元数据
|
|
99
|
-
twitter?: {
|
|
100
|
-
card?: 'summary' | 'summary_large_image' | 'app' | 'player'; // 卡片类型
|
|
101
|
-
site?: string; // Twitter 站点
|
|
102
|
-
creator?: string; // 创建者
|
|
103
|
-
title?: string; // Twitter 标题
|
|
104
|
-
description?: string; // Twitter 描述
|
|
105
|
-
image?: string; // Twitter 图片
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// 附加元数据
|
|
109
|
-
author?: string; // 作者
|
|
110
|
-
publishedTime?: string; // 发布时间
|
|
111
|
-
modifiedTime?: string; // 修改时间
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
使用说明:
|
|
116
|
-
|
|
117
|
-
1. 所有字符串类型的值都可以是:
|
|
118
|
-
- i18n key:将会被翻译成当前语言
|
|
119
|
-
- 直接字符串:将直接使用,不进行翻译
|
|
120
|
-
2. 可选字段(带 `?` 的字段)表示该页面可以不包含这些元数据
|
|
121
|
-
3. 这个接口通常用于:
|
|
122
|
-
- 定义页面的 SEO 信息
|
|
123
|
-
- 生成 meta 标签
|
|
124
|
-
- 提供社交媒体分享信息
|
|
125
|
-
- 控制搜索引擎爬虫行为
|
|
126
|
-
|
|
127
|
-
### 在页面中使用 PageI18nInterface
|
|
128
|
-
|
|
129
|
-
以下是一个完整的页面示例,展示如何使用 PageI18nInterface:
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
// 1. 首先定义页面的 i18n 接口
|
|
133
|
-
export const homeI18n = Object.freeze({
|
|
134
|
-
title: i18nKeys.PAGE_HOME_TITLE,
|
|
135
|
-
description: i18nKeys.PAGE_HOME_DESCRIPTION,
|
|
136
|
-
content: i18nKeys.PAGE_HOME_DESCRIPTION,
|
|
137
|
-
keywords: i18nKeys.PAGE_HOME_KEYWORDS,
|
|
138
|
-
|
|
139
|
-
welcome: i18nKeys.HOME_WELCOME,
|
|
140
|
-
getStartedTitle: i18nKeys.HOME_GET_STARTED_TITLE,
|
|
141
|
-
getStartedDescription: i18nKeys.HOME_GET_STARTED_DESCRIPTION,
|
|
142
|
-
getStartedButton: i18nKeys.HOME_GET_STARTED_BUTTON
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// 2. 在页面中使用
|
|
146
|
-
export async function generateMetadata({ params }: { params: PageParamsType }): Promise<Metadata> {
|
|
147
|
-
const pageParams = new PageParams(await params);
|
|
148
|
-
// 获取页面 SEO 元数据
|
|
149
|
-
return await pageParams.getI18nInterface(homeI18n);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export default async function HomePage({ params }: PageParamsProps) {
|
|
153
|
-
const pageParams = new PageParams(await params!);
|
|
154
|
-
// 获取页面翻译内容
|
|
155
|
-
const tt = await pageParams.getI18nInterface(homeI18n);
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<BaseLayout>
|
|
159
|
-
<section>
|
|
160
|
-
<h1>{tt.welcome}</h1>
|
|
161
|
-
<p>{tt.description}</p>
|
|
162
|
-
<div>
|
|
163
|
-
<h2>{tt.getStartedTitle}</h2>
|
|
164
|
-
<p>{tt.getStartedDescription}</p>
|
|
165
|
-
<Button>{tt.getStartedButton}</Button>
|
|
166
|
-
</div>
|
|
167
|
-
</section>
|
|
168
|
-
</BaseLayout>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
这个示例展示了:
|
|
174
|
-
|
|
175
|
-
1. 如何定义页面特定的 i18n 接口
|
|
176
|
-
2. 如何使用 `getI18nInterface` 获取翻译后的内容
|
|
177
|
-
3. 如何在页面元数据中使用 i18n
|
|
178
|
-
4. 如何在页面组件中使用翻译的内容
|
|
179
|
-
|
|
180
|
-
### 实现页面国际化
|
|
181
|
-
|
|
182
|
-
页面内容的国际化主要通过以下方式实现:
|
|
183
|
-
|
|
184
|
-
1. 页面 i18n 接口定义:
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
// config/i18n/HomeI18n.ts
|
|
188
|
-
export const homeI18n = Object.freeze({
|
|
189
|
-
title: i18nKeys.PAGE_HOME_TITLE,
|
|
190
|
-
description: i18nKeys.PAGE_HOME_DESCRIPTION,
|
|
191
|
-
welcome: i18nKeys.HOME_WELCOME
|
|
192
|
-
// ...
|
|
193
|
-
});
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
2. 获取翻译内容:
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
// 在页面组件中
|
|
200
|
-
const messages = await getMessages({ locale });
|
|
201
|
-
// 或者使用 PageParams
|
|
202
|
-
const i18nContent = await pageParams.getI18nInterface(homeI18n);
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
3. 动态路由中的语言处理:
|
|
206
|
-
|
|
207
|
-
```typescript
|
|
208
|
-
// src/app/[locale]/layout.tsx
|
|
209
|
-
export default async function RootLayout({ children, params }) {
|
|
210
|
-
const pageParams = new PageParams(params);
|
|
211
|
-
const locale = pageParams.getI18nWithNotFound();
|
|
212
|
-
// ...
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## 使用规范
|
|
217
|
-
|
|
218
|
-
1. **所有文本内容必须使用 i18n key**:
|
|
219
|
-
- 不要直接在代码中写入固定文本
|
|
220
|
-
- 所有文本都应该定义在 i18n 配置文件中
|
|
221
|
-
- 使用有意义的 key 名称,如:`PAGE_HOME_TITLE`、`ERROR_INVALID_INPUT`
|
|
222
|
-
|
|
223
|
-
2. **i18n key 命名规范**:
|
|
224
|
-
- 使用大写字母和下划线
|
|
225
|
-
- 使用有意义的前缀表示分类,如:
|
|
226
|
-
- `PAGE_` 前缀表示页面相关
|
|
227
|
-
- `ERROR_` 前缀表示错误信息
|
|
228
|
-
- `COMMON_` 前缀表示通用文本
|
|
229
|
-
|
|
230
|
-
3. **翻译文件组织**:
|
|
231
|
-
- 翻译文件位于 `public/locales/` 目录
|
|
232
|
-
- 按语言代码分类:`en.json`、`zh.json`
|
|
233
|
-
- 保持所有语言文件的 key 一致
|
|
234
|
-
|
|
235
|
-
4. **类型安全**:
|
|
236
|
-
- 使用 TypeScript 接口定义 i18n 内容
|
|
237
|
-
- 所有 i18n key 都应该在 `config/Identifier/` 目录下定义
|
|
238
|
-
- 使用 `Object.freeze` 确保 i18n 对象不被修改
|
|
239
|
-
|
|
240
|
-
5. **最佳实践**:
|
|
241
|
-
- 使用 `PageParams` 类处理页面的语言相关逻辑
|
|
242
|
-
- 在组件中使用 `useTranslations` hook 获取翻译
|
|
243
|
-
- API 错误信息优先使用 i18n key,而不是硬编码的消息
|
|
244
|
-
- 确保所有用户可见的文本都支持多语言
|
|
245
|
-
|
|
246
|
-
## 示例
|
|
247
|
-
|
|
248
|
-
1. 页面组件中使用 i18n:
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
export function LoginForm(props: { tt: LoginI18nInterface }) {
|
|
252
|
-
const { tt } = props;
|
|
253
|
-
|
|
254
|
-
return (
|
|
255
|
-
<form>
|
|
256
|
-
<h1>{tt.title}</h1>
|
|
257
|
-
<p>{tt.description}</p>
|
|
258
|
-
{/* ... */}
|
|
259
|
-
</form>
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
2. API 错误处理:
|
|
265
|
-
|
|
266
|
-
```typescript
|
|
267
|
-
// 后端返回错误
|
|
268
|
-
throw new AppErrorApi({
|
|
269
|
-
id: 'ERROR_INVALID_CREDENTIALS',
|
|
270
|
-
success: false
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// 前端自动处理并显示翻译后的错误消息
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
3. 动态内容:
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
const t = await getTranslations({
|
|
280
|
-
locale: pageParams.getLocale(),
|
|
281
|
-
namespace: 'common'
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
const message = t('welcome', {
|
|
285
|
-
name: userName
|
|
286
|
-
});
|
|
287
|
-
```
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Next.js 全栈应用开发文档
|
|
2
|
-
|
|
3
|
-
## 简介
|
|
4
|
-
|
|
5
|
-
这是一个基于 Next.js 的全栈应用模板,采用面向接口的设计模式,实现了清晰的分层架构。本模板提供了完整的全栈开发解决方案,包括服务端API、客户端状态管理、认证授权、国际化等核心功能。
|
|
6
|
-
|
|
7
|
-
### 主要特性
|
|
8
|
-
|
|
9
|
-
- 🏗️ **全栈架构**:基于 Next.js 的应用路由和API路由
|
|
10
|
-
- 🔌 **接口驱动**:完整的面向接口编程实践
|
|
11
|
-
- 🎨 **主题定制**:基于 Tailwind CSS 的主题系统
|
|
12
|
-
- 🌍 **国际化**:基于 next-intl 的多语言支持
|
|
13
|
-
- 🔄 **依赖注入**:基于 TypeScript 的 IOC 容器
|
|
14
|
-
- 🛡️ **身份认证**:完整的认证和授权方案
|
|
15
|
-
- 📡 **分层设计**:清晰的前后端分层架构
|
|
16
|
-
- 🎮 **状态管理**:基于控制器模式的状态管理
|
|
17
|
-
- 🔗 **数据访问**:灵活的数据库访问层
|
|
18
|
-
|
|
19
|
-
## 快速开始
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# 安装依赖
|
|
23
|
-
pnpm install
|
|
24
|
-
|
|
25
|
-
# 开发环境启动
|
|
26
|
-
pnpm dev
|
|
27
|
-
# cross-env APP_ENV=localhost next dev --turbopack --port 3100
|
|
28
|
-
# 自动加载 .env.localhost -> .env
|
|
29
|
-
|
|
30
|
-
# 预发环境启动
|
|
31
|
-
pnpm dev:staging
|
|
32
|
-
# cross-env APP_ENV=staging next dev --turbopack --port 3100
|
|
33
|
-
# 自动加载 .env.staging -> .env
|
|
34
|
-
|
|
35
|
-
# 构建生产版本
|
|
36
|
-
pnpm build
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## 架构概览
|
|
40
|
-
|
|
41
|
-
### 1. 客户端架构
|
|
42
|
-
|
|
43
|
-
#### 接口定义 (src/base/port)
|
|
44
|
-
|
|
45
|
-
- AppUserApiInterface: 用户API接口
|
|
46
|
-
- AsyncStateInterface: 异步状态接口
|
|
47
|
-
- RouterInterface: 路由管理接口
|
|
48
|
-
|
|
49
|
-
#### 核心实现
|
|
50
|
-
|
|
51
|
-
- 控制器层:状态和业务逻辑管理
|
|
52
|
-
- 服务层:API调用和数据处理
|
|
53
|
-
- UI组件:可复用的展示组件
|
|
54
|
-
|
|
55
|
-
### 2. 服务端架构
|
|
56
|
-
|
|
57
|
-
#### 接口定义 (src/server/port)
|
|
58
|
-
|
|
59
|
-
- ServerAuthInterface: 认证接口
|
|
60
|
-
- DBBridgeInterface: 数据库操作接口
|
|
61
|
-
- UserRepositoryInterface: 用户仓库接口
|
|
62
|
-
- ValidatorInterface: 数据验证接口
|
|
63
|
-
|
|
64
|
-
#### 核心实现
|
|
65
|
-
|
|
66
|
-
- API路由层:请求处理和响应
|
|
67
|
-
- 服务层:业务逻辑实现
|
|
68
|
-
- 数据访问层:仓库和数据库交互
|
|
69
|
-
|
|
70
|
-
## 开发指南
|
|
71
|
-
|
|
72
|
-
### 1. API 开发流程
|
|
73
|
-
|
|
74
|
-
1. 定义接口 (src/server/port)
|
|
75
|
-
2. 实现验证器 (src/server/validators)
|
|
76
|
-
3. 实现服务层 (src/server/services)
|
|
77
|
-
4. 实现数据访问 (src/server/repositorys)
|
|
78
|
-
5. 创建API路由 (src/app/api)
|
|
79
|
-
|
|
80
|
-
### 2. 页面开发流程
|
|
81
|
-
|
|
82
|
-
1. 创建页面组件 (src/app/[locale])
|
|
83
|
-
2. 实现页面控制器
|
|
84
|
-
3. 添加API服务
|
|
85
|
-
4. 注册IOC容器
|
|
86
|
-
|
|
87
|
-
### 3. 最佳实践
|
|
88
|
-
|
|
89
|
-
#### 接口优先开发
|
|
90
|
-
|
|
91
|
-
- 先定义接口,再实现具体类
|
|
92
|
-
- 保持接口的单一职责
|
|
93
|
-
- 使用依赖注入管理依赖
|
|
94
|
-
|
|
95
|
-
#### 分层原则
|
|
96
|
-
|
|
97
|
-
- 保持层级间的清晰边界
|
|
98
|
-
- 通过接口进行层级间通信
|
|
99
|
-
- 避免跨层级直接调用
|
|
100
|
-
|
|
101
|
-
#### 状态管理
|
|
102
|
-
|
|
103
|
-
- 使用控制器管理复杂状态
|
|
104
|
-
- 保持状态的不可变性
|
|
105
|
-
- 统一的状态更新流程
|
|
106
|
-
|
|
107
|
-
## 核心功能文档
|
|
108
|
-
|
|
109
|
-
### 基础架构
|
|
110
|
-
|
|
111
|
-
- [项目结构说明](./project-structure.md)
|
|
112
|
-
- [开发规范指南](./development-guide.md)
|
|
113
|
-
- [环境配置指南](./env.md)
|
|
114
|
-
|
|
115
|
-
### 服务端开发
|
|
116
|
-
|
|
117
|
-
- [API开发指南](./api.md)
|
|
118
|
-
- [认证授权](./auth.md)
|
|
119
|
-
- [数据访问层](./database.md)
|
|
120
|
-
- [验证器开发](./validator.md)
|
|
121
|
-
|
|
122
|
-
### 客户端开发
|
|
123
|
-
|
|
124
|
-
- [页面开发指南](./page.md)
|
|
125
|
-
- [组件开发](./component.md)
|
|
126
|
-
|
|
127
|
-
### 功能模块
|
|
128
|
-
|
|
129
|
-
- [国际化开发](./i18n.md)
|
|
130
|
-
- [主题系统](./theme.md)
|
|
131
|
-
- [路由管理](./router.md)
|
|
132
|
-
|
|
133
|
-
## 常见问题
|
|
134
|
-
|
|
135
|
-
### 1. 开发环境配置
|
|
136
|
-
|
|
137
|
-
- Node.js >= 16
|
|
138
|
-
- pnpm >= 8.0
|
|
139
|
-
- 推荐使用 VSCode + 推荐插件
|
|
140
|
-
|
|
141
|
-
### 2. 开发相关
|
|
142
|
-
|
|
143
|
-
- 接口设计规范
|
|
144
|
-
- 依赖注入使用
|
|
145
|
-
- 控制器开发规范
|
|
146
|
-
|
|
147
|
-
### 3. 部署相关
|
|
148
|
-
|
|
149
|
-
- 环境变量配置
|
|
150
|
-
- 构建优化
|
|
151
|
-
- 部署流程
|
|
152
|
-
|
|
153
|
-
## 更新日志
|
|
154
|
-
|
|
155
|
-
查看 [CHANGELOG.md](../../CHANGELOG.md) 了解详细的更新历史。
|
|
156
|
-
|
|
157
|
-
## 支持和帮助
|
|
158
|
-
|
|
159
|
-
- 提交 Issue
|
|
160
|
-
- 查看 Wiki
|
|
161
|
-
- 参与讨论
|
|
162
|
-
|
|
163
|
-
## 许可证
|
|
164
|
-
|
|
165
|
-
本项目基于 [ISC 许可证](../../LICENSE) 开源。
|