@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,457 +0,0 @@
|
|
|
1
|
-
# Next.js 页面开发指南
|
|
2
|
-
|
|
3
|
-
## 目录
|
|
4
|
-
|
|
5
|
-
1. [页面开发概述](#页面开发概述)
|
|
6
|
-
2. [服务端组件详解](#服务端组件详解)
|
|
7
|
-
3. [客户端组件详解](#客户端组件详解)
|
|
8
|
-
4. [数据获取和状态管理](#数据获取和状态管理)
|
|
9
|
-
5. [页面路由和元数据](#页面路由和元数据)
|
|
10
|
-
6. [最佳实践和性能优化](#最佳实践和性能优化)
|
|
11
|
-
|
|
12
|
-
## 页面开发概述
|
|
13
|
-
|
|
14
|
-
### 1. 服务端组件 vs 客户端组件
|
|
15
|
-
|
|
16
|
-
在 Next.js 13+ 中,所有组件默认都是服务端组件(Server Components),除非显式声明为客户端组件。
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
// 服务端组件(默认)
|
|
20
|
-
// page.tsx
|
|
21
|
-
export default function Page() {
|
|
22
|
-
return <div>服务端渲染的内容</div>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// 客户端组件
|
|
26
|
-
// 需要在文件顶部添加 'use client' 指令
|
|
27
|
-
'use client';
|
|
28
|
-
|
|
29
|
-
export function ClientComponent() {
|
|
30
|
-
return <div>客户端渲染的内容</div>;
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 2. 选择指南
|
|
35
|
-
|
|
36
|
-
**使用服务端组件的场景**:
|
|
37
|
-
|
|
38
|
-
- 需要直接访问后端资源
|
|
39
|
-
- 包含敏感信息(API 密钥、tokens 等)
|
|
40
|
-
- 依赖后端的重量级操作
|
|
41
|
-
- 需要减少客户端 JavaScript 体积
|
|
42
|
-
- 需要 SEO 优化
|
|
43
|
-
- 页面级组件
|
|
44
|
-
- 不需要客户端交互
|
|
45
|
-
- 不需要浏览器 API
|
|
46
|
-
|
|
47
|
-
**使用客户端组件的场景**:
|
|
48
|
-
|
|
49
|
-
- 需要添加交互和事件处理
|
|
50
|
-
- 使用浏览器 API
|
|
51
|
-
- 使用 React hooks
|
|
52
|
-
- 需要维护组件状态
|
|
53
|
-
- 需要使用客户端特有的生命周期
|
|
54
|
-
- 使用依赖浏览器 API 的第三方库
|
|
55
|
-
|
|
56
|
-
## 服务端组件详解
|
|
57
|
-
|
|
58
|
-
### 1. 基本结构
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
// app/[locale]/login/page.tsx
|
|
62
|
-
export default async function LoginPage(props: PageParamsProps) {
|
|
63
|
-
// 1. 参数验证
|
|
64
|
-
if (!props.params) {
|
|
65
|
-
return notFound();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// 2. 服务端初始化
|
|
69
|
-
const params = await props.params;
|
|
70
|
-
const pageParams = new PageParams(params);
|
|
71
|
-
const server = new BootstrapServer();
|
|
72
|
-
|
|
73
|
-
// 3. 服务端数据获取和验证
|
|
74
|
-
if (await server.getIOC(ServerAuth).hasAuth()) {
|
|
75
|
-
return redirect({ href: '/', locale: params.locale! });
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 4. 获取国际化文本
|
|
79
|
-
const tt = await pageParams.getI18nInterface(loginI18n);
|
|
80
|
-
|
|
81
|
-
// 5. 渲染页面
|
|
82
|
-
return (
|
|
83
|
-
<BaseLayout>
|
|
84
|
-
<div>{/* 页面内容 */}</div>
|
|
85
|
-
<ClientComponent /> {/* 嵌入客户端组件 */}
|
|
86
|
-
</BaseLayout>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### 2. 服务端数据获取
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
// 直接在服务端组件中获取数据
|
|
95
|
-
export default async function UsersPage() {
|
|
96
|
-
const server = new BootstrapServer();
|
|
97
|
-
|
|
98
|
-
const result = await server
|
|
99
|
-
.use(new AdminAuthPlugin()) // 使用服务端中间件
|
|
100
|
-
.execNoError(async ({ parameters: { IOC } }) => {
|
|
101
|
-
const userService = IOC(UserService);
|
|
102
|
-
return userService.getUsers();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// 数据直接传递给客户端组件
|
|
106
|
-
return <UserList initialData={result.data} />;
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 3. 静态生成和动态渲染
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
// 静态页面生成
|
|
114
|
-
export const dynamic = 'force-static'; // 强制静态生成
|
|
115
|
-
export const revalidate = 3600; // 每小时重新生成
|
|
116
|
-
|
|
117
|
-
// 动态页面生成
|
|
118
|
-
export const dynamic = 'force-dynamic'; // 强制动态生成
|
|
119
|
-
|
|
120
|
-
// 生成静态路由参数
|
|
121
|
-
export async function generateStaticParams() {
|
|
122
|
-
return [{ locale: 'en' }, { locale: 'zh' }];
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## 客户端组件详解
|
|
127
|
-
|
|
128
|
-
### 1. 基本结构
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
'use client'; // 声明为客户端组件
|
|
132
|
-
|
|
133
|
-
export function LoginForm(props: { tt: LoginI18nInterface }) {
|
|
134
|
-
// 1. Hooks 使用
|
|
135
|
-
const [loading, setLoading] = useState(false);
|
|
136
|
-
const userService = useIOC(I.UserServiceInterface);
|
|
137
|
-
|
|
138
|
-
// 2. 事件处理
|
|
139
|
-
const handleLogin = async (values: LoginFormData) => {
|
|
140
|
-
try {
|
|
141
|
-
setLoading(true);
|
|
142
|
-
await userService.login(values);
|
|
143
|
-
routerService.gotoHome();
|
|
144
|
-
} catch (error) {
|
|
145
|
-
logger.error(error);
|
|
146
|
-
} finally {
|
|
147
|
-
setLoading(false);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// 3. 渲染 UI
|
|
152
|
-
return (
|
|
153
|
-
<Form onFinish={handleLogin}>
|
|
154
|
-
{/* 表单内容 */}
|
|
155
|
-
</Form>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### 2. 客户端状态管理
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
'use client';
|
|
164
|
-
|
|
165
|
-
export function UserProfile() {
|
|
166
|
-
// 1. 本地状态
|
|
167
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
168
|
-
|
|
169
|
-
// 2. 服务状态
|
|
170
|
-
const userStore = useIOC(UserStore);
|
|
171
|
-
const user = useStore(userStore, userStore.selector.currentUser);
|
|
172
|
-
|
|
173
|
-
// 3. 表单状态
|
|
174
|
-
const [form] = Form.useForm();
|
|
175
|
-
|
|
176
|
-
// 4. 副作用
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
if (user) {
|
|
179
|
-
form.setFieldsValue(user);
|
|
180
|
-
}
|
|
181
|
-
}, [user, form]);
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
<div>{/* 组件内容 */}</div>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### 3. 与服务端组件交互
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
// 1. 通过属性接收服务端数据
|
|
193
|
-
interface Props {
|
|
194
|
-
initialData: UserData; // 从服务端获取的初始数据
|
|
195
|
-
tt: I18nInterface; // 从服务端获取的翻译文本
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
'use client';
|
|
199
|
-
export function UserList({ initialData, tt }: Props) {
|
|
200
|
-
const [data, setData] = useState(initialData);
|
|
201
|
-
|
|
202
|
-
// 使用服务端数据初始化客户端状态
|
|
203
|
-
useEffect(() => {
|
|
204
|
-
setData(initialData);
|
|
205
|
-
}, [initialData]);
|
|
206
|
-
|
|
207
|
-
return (
|
|
208
|
-
<div>{/* 组件内容 */}</div>
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## 数据获取和状态管理
|
|
214
|
-
|
|
215
|
-
### 1. 服务端数据获取
|
|
216
|
-
|
|
217
|
-
```typescript
|
|
218
|
-
// 1. 在服务端组件中获取数据
|
|
219
|
-
export default async function DashboardPage() {
|
|
220
|
-
const server = new BootstrapServer();
|
|
221
|
-
|
|
222
|
-
// 并行数据获取
|
|
223
|
-
const [userData, statsData] = await Promise.all([
|
|
224
|
-
server.execNoError(async ({ IOC }) => IOC(UserService).getCurrentUser()),
|
|
225
|
-
server.execNoError(async ({ IOC }) => IOC(StatsService).getStats())
|
|
226
|
-
]);
|
|
227
|
-
|
|
228
|
-
return (
|
|
229
|
-
<Dashboard
|
|
230
|
-
userData={userData}
|
|
231
|
-
statsData={statsData}
|
|
232
|
-
/>
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// 2. 使用服务端 action
|
|
237
|
-
export async function fetchUserData(userId: string) {
|
|
238
|
-
'use server'; // 声明为服务端 action
|
|
239
|
-
|
|
240
|
-
const server = new BootstrapServer();
|
|
241
|
-
return server.execNoError(async ({ IOC }) => {
|
|
242
|
-
return IOC(UserService).getUserById(userId);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### 2. 客户端状态管理
|
|
248
|
-
|
|
249
|
-
```typescript
|
|
250
|
-
'use client';
|
|
251
|
-
|
|
252
|
-
// 1. 使用 Store 管理状态
|
|
253
|
-
@injectable()
|
|
254
|
-
export class UserProfileStore extends StoreInterface<UserProfileState> {
|
|
255
|
-
constructor() {
|
|
256
|
-
super(() => ({
|
|
257
|
-
user: null,
|
|
258
|
-
loading: false,
|
|
259
|
-
error: null
|
|
260
|
-
}));
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async fetchUser(id: string) {
|
|
264
|
-
this.emit({ ...this.state, loading: true });
|
|
265
|
-
try {
|
|
266
|
-
const user = await this.userService.getUser(id);
|
|
267
|
-
this.emit({ ...this.state, user, loading: false });
|
|
268
|
-
} catch (error) {
|
|
269
|
-
this.emit({ ...this.state, error, loading: false });
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// 2. 在组件中使用 Store
|
|
275
|
-
export function UserProfile() {
|
|
276
|
-
const store = useIOC(UserProfileStore);
|
|
277
|
-
const user = useStore(store, store.selector.user);
|
|
278
|
-
const loading = useStore(store, store.selector.loading);
|
|
279
|
-
|
|
280
|
-
return (
|
|
281
|
-
<div>
|
|
282
|
-
{loading ? <Loading /> : <UserInfo user={user} />}
|
|
283
|
-
</div>
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
## 页面路由和元数据
|
|
289
|
-
|
|
290
|
-
### 1. 动态路由
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
// app/[locale]/users/[id]/page.tsx
|
|
294
|
-
export default async function UserPage({
|
|
295
|
-
params: { locale, id }
|
|
296
|
-
}: {
|
|
297
|
-
params: { locale: string; id: string };
|
|
298
|
-
}) {
|
|
299
|
-
// 处理路由参数
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// 生成静态路由
|
|
303
|
-
export async function generateStaticParams() {
|
|
304
|
-
const users = await fetchUsers();
|
|
305
|
-
|
|
306
|
-
return users.map((user) => ({
|
|
307
|
-
locale: ['en', 'zh'],
|
|
308
|
-
id: user.id
|
|
309
|
-
}));
|
|
310
|
-
}
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
### 2. 元数据生成
|
|
314
|
-
|
|
315
|
-
```typescript
|
|
316
|
-
// 1. 静态元数据
|
|
317
|
-
export const metadata: Metadata = {
|
|
318
|
-
title: 'User Profile',
|
|
319
|
-
description: 'User profile page'
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
// 2. 动态元数据
|
|
323
|
-
export async function generateMetadata({
|
|
324
|
-
params
|
|
325
|
-
}: {
|
|
326
|
-
params: PageParamsType;
|
|
327
|
-
}): Promise<Metadata> {
|
|
328
|
-
const pageParams = new PageParams(await params);
|
|
329
|
-
const tt = await pageParams.getI18nInterface(userI18n);
|
|
330
|
-
|
|
331
|
-
return {
|
|
332
|
-
title: tt.pageTitle,
|
|
333
|
-
description: tt.pageDescription
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
## 最佳实践和性能优化
|
|
339
|
-
|
|
340
|
-
### 1. 组件分割原则
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
// ❌ 错误:在一个组件中混合服务端和客户端逻辑
|
|
344
|
-
export default function Page() {
|
|
345
|
-
const [state, setState] = useState(); // 错误:服务端组件不能使用 hooks
|
|
346
|
-
const data = await fetchData(); // 正确:服务端数据获取
|
|
347
|
-
|
|
348
|
-
return <div>{/* ... */}</div>;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// ✅ 正确:分离服务端和客户端逻辑
|
|
352
|
-
// page.tsx (服务端组件)
|
|
353
|
-
export default async function Page() {
|
|
354
|
-
const data = await fetchData(); // 服务端数据获取
|
|
355
|
-
return <ClientComponent data={data} />;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// ClientComponent.tsx (客户端组件)
|
|
359
|
-
'use client';
|
|
360
|
-
export function ClientComponent({ data }) {
|
|
361
|
-
const [state, setState] = useState(); // 客户端状态管理
|
|
362
|
-
return <div>{/* ... */}</div>;
|
|
363
|
-
}
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
### 2. 性能优化策略
|
|
367
|
-
|
|
368
|
-
```typescript
|
|
369
|
-
// 1. 组件级缓存
|
|
370
|
-
export default async function UserList() {
|
|
371
|
-
const users = await fetchUsers();
|
|
372
|
-
|
|
373
|
-
return (
|
|
374
|
-
<div>
|
|
375
|
-
{users.map(user => (
|
|
376
|
-
<Suspense key={user.id} fallback={<Loading />}>
|
|
377
|
-
<UserCard user={user} />
|
|
378
|
-
</Suspense>
|
|
379
|
-
))}
|
|
380
|
-
</div>
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// 2. 路由级缓存
|
|
385
|
-
export const revalidate = 3600; // 缓存一小时
|
|
386
|
-
|
|
387
|
-
// 3. 选择性水合
|
|
388
|
-
export default function Page() {
|
|
389
|
-
return (
|
|
390
|
-
<>
|
|
391
|
-
<StaticContent />
|
|
392
|
-
<Suspense fallback={<Loading />}>
|
|
393
|
-
<DynamicContent />
|
|
394
|
-
</Suspense>
|
|
395
|
-
</>
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### 3. 错误处理
|
|
401
|
-
|
|
402
|
-
```typescript
|
|
403
|
-
// 1. 错误边界
|
|
404
|
-
'use client';
|
|
405
|
-
export function ErrorBoundary({
|
|
406
|
-
error,
|
|
407
|
-
reset
|
|
408
|
-
}: {
|
|
409
|
-
error: Error;
|
|
410
|
-
reset: () => void;
|
|
411
|
-
}) {
|
|
412
|
-
return (
|
|
413
|
-
<div>
|
|
414
|
-
<h2>出错了!</h2>
|
|
415
|
-
<button onClick={reset}>重试</button>
|
|
416
|
-
</div>
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// 2. 加载状态
|
|
421
|
-
export default async function Page() {
|
|
422
|
-
return (
|
|
423
|
-
<Suspense fallback={<Loading />}>
|
|
424
|
-
<SlowComponent />
|
|
425
|
-
</Suspense>
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
## 总结
|
|
431
|
-
|
|
432
|
-
Next.js 13+ 的页面开发需要注意以下几点:
|
|
433
|
-
|
|
434
|
-
1. **组件类型选择**:
|
|
435
|
-
- 默认使用服务端组件
|
|
436
|
-
- 只在必要时使用客户端组件
|
|
437
|
-
- 合理分割组件职责
|
|
438
|
-
|
|
439
|
-
2. **数据流处理**:
|
|
440
|
-
- 服务端优先获取数据
|
|
441
|
-
- 通过属性传递给客户端
|
|
442
|
-
- 使用 Store 管理客户端状态
|
|
443
|
-
|
|
444
|
-
3. **性能优化**:
|
|
445
|
-
- 合理使用缓存策略
|
|
446
|
-
- 实现选择性水合
|
|
447
|
-
- 优化加载性能
|
|
448
|
-
|
|
449
|
-
4. **开发体验**:
|
|
450
|
-
- 清晰的代码组织
|
|
451
|
-
- 类型安全
|
|
452
|
-
- 完善的错误处理
|
|
453
|
-
|
|
454
|
-
5. **最佳实践**:
|
|
455
|
-
- 遵循单一职责原则
|
|
456
|
-
- 实现优雅降级
|
|
457
|
-
- 保持代码可维护性
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# 项目结构详细说明
|
|
2
|
-
|
|
3
|
-
## 目录结构概览
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
next-app/
|
|
7
|
-
├── config/ # 全局配置文件
|
|
8
|
-
├── src/ # 源代码目录
|
|
9
|
-
│ ├── app/ # Next.js 应用路由
|
|
10
|
-
│ ├── base/ # 客户端核心代码
|
|
11
|
-
│ ├── core/ # 核心启动和IOC配置
|
|
12
|
-
│ ├── server/ # 服务端代码
|
|
13
|
-
│ ├── styles/ # 样式文件
|
|
14
|
-
│ └── uikit/ # UI组件库
|
|
15
|
-
└── public/ # 静态资源
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## 详细结构说明
|
|
19
|
-
|
|
20
|
-
### 1. 客户端架构 (src/base)
|
|
21
|
-
|
|
22
|
-
#### 1.1 接口层 (src/base/port)
|
|
23
|
-
|
|
24
|
-
- `AdminLayoutInterface.ts` - 管理布局接口
|
|
25
|
-
- `AppApiInterface.ts` - 应用API接口
|
|
26
|
-
- `AppUserApiInterface.ts` - 用户API接口
|
|
27
|
-
- `AsyncStateInterface.ts` - 异步状态接口
|
|
28
|
-
- `I18nServiceInterface.ts` - 国际化服务接口
|
|
29
|
-
- `IOCInterface.ts` - 依赖注入接口
|
|
30
|
-
- `RouterInterface.ts` - 路由接口
|
|
31
|
-
- `UserServiceInterface.ts` - 用户服务接口
|
|
32
|
-
|
|
33
|
-
#### 1.2 业务逻辑层 (src/base/cases)
|
|
34
|
-
|
|
35
|
-
- 状态管理控制器
|
|
36
|
-
- 对话框处理
|
|
37
|
-
- 路由服务
|
|
38
|
-
- 用户服务
|
|
39
|
-
- 加密服务
|
|
40
|
-
|
|
41
|
-
#### 1.3 服务实现层 (src/base/services)
|
|
42
|
-
|
|
43
|
-
- `AdminUserService.ts` - 管理用户服务
|
|
44
|
-
- `I18nService.ts` - 国际化服务
|
|
45
|
-
- `UserService.ts` - 用户服务
|
|
46
|
-
- `adminApi/` - 管理API实现
|
|
47
|
-
- `appApi/` - 应用API实现
|
|
48
|
-
|
|
49
|
-
### 2. 服务端架构 (src/server)
|
|
50
|
-
|
|
51
|
-
#### 2.1 接口层 (src/server/port)
|
|
52
|
-
|
|
53
|
-
- `CrentialTokenInterface.ts` - 凭证令牌接口
|
|
54
|
-
- `DBBridgeInterface.ts` - 数据库桥接接口
|
|
55
|
-
- `DBTableInterface.ts` - 数据表接口
|
|
56
|
-
- `PaginationInterface.ts` - 分页接口
|
|
57
|
-
- `ParamsHandlerInterface.ts` - 参数处理接口
|
|
58
|
-
- `ServerAuthInterface.ts` - 服务认证接口
|
|
59
|
-
- `ServerInterface.ts` - 服务器接口
|
|
60
|
-
- `UserRepositoryInterface.ts` - 用户仓库接口
|
|
61
|
-
- `ValidatorInterface.ts` - 验证器接口
|
|
62
|
-
|
|
63
|
-
#### 2.2 核心实现
|
|
64
|
-
|
|
65
|
-
- `AppErrorApi.ts` - API错误处理
|
|
66
|
-
- `AppSuccessApi.ts` - API成功响应
|
|
67
|
-
- `ServerAuth.ts` - 服务认证实现
|
|
68
|
-
- `UserCredentialToken.ts` - 用户凭证令牌
|
|
69
|
-
|
|
70
|
-
#### 2.3 服务层 (src/server/services)
|
|
71
|
-
|
|
72
|
-
- `AdminAuthPlugin.ts` - 管理认证插件
|
|
73
|
-
- `AIService.ts` - AI服务
|
|
74
|
-
- `ApiUserService.ts` - API用户服务
|
|
75
|
-
- `UserService.ts` - 用户服务
|
|
76
|
-
|
|
77
|
-
#### 2.4 数据访问层
|
|
78
|
-
|
|
79
|
-
- `repositorys/UserRepository.ts` - 用户数据仓库
|
|
80
|
-
- `sqlBridges/SupabaseBridge.ts` - Supabase数据库桥接
|
|
81
|
-
|
|
82
|
-
#### 2.5 验证器 (src/server/validators)
|
|
83
|
-
|
|
84
|
-
- `LoginValidator.ts` - 登录验证
|
|
85
|
-
- `PaginationValidator.ts` - 分页验证
|
|
86
|
-
|
|
87
|
-
### 3. API路由结构 (src/app/api)
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
api/
|
|
91
|
-
├── admin/ # 管理接口
|
|
92
|
-
│ └── users/ # 用户管理
|
|
93
|
-
├── ai/ # AI相关接口
|
|
94
|
-
│ └── completions/ # AI补全
|
|
95
|
-
└── user/ # 用户接口
|
|
96
|
-
├── login/ # 登录
|
|
97
|
-
├── logout/ # 登出
|
|
98
|
-
└── register/ # 注册
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 4. 页面路由结构 (src/app/[locale])
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
[locale]/
|
|
105
|
-
├── admin/ # 管理页面
|
|
106
|
-
│ └── users/ # 用户管理
|
|
107
|
-
├── login/ # 登录页面
|
|
108
|
-
├── register/ # 注册页面
|
|
109
|
-
└── page.tsx # 首页
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### 5. UI组件库 (src/uikit)
|
|
113
|
-
|
|
114
|
-
#### 5.1 组件 (components)
|
|
115
|
-
|
|
116
|
-
- `AdminLayout.tsx` - 管理布局
|
|
117
|
-
- `BaseHeader.tsx` - 基础头部
|
|
118
|
-
- `BaseLayout.tsx` - 基础布局
|
|
119
|
-
- `ChatRoot.tsx` - 聊天根组件
|
|
120
|
-
- `LanguageSwitcher.tsx` - 语言切换
|
|
121
|
-
- `ThemeSwitcher.tsx` - 主题切换
|
|
122
|
-
- 其他通用组件
|
|
123
|
-
|
|
124
|
-
#### 5.2 Hooks和Context
|
|
125
|
-
|
|
126
|
-
- `useI18nInterface.ts` - 国际化Hook
|
|
127
|
-
- `useIOC.ts` - IOC容器Hook
|
|
128
|
-
- `useStore.ts` - 状态管理Hook
|
|
129
|
-
- `IOCContext.ts` - IOC上下文
|
|
130
|
-
|
|
131
|
-
## 技术特点
|
|
132
|
-
|
|
133
|
-
1. **依赖注入模式**
|
|
134
|
-
- 使用 IOC 容器管理依赖
|
|
135
|
-
- 客户端和服务端分别维护独立的 IOC 容器
|
|
136
|
-
- 通过接口进行解耦
|
|
137
|
-
|
|
138
|
-
2. **分层架构**
|
|
139
|
-
- 清晰的接口定义
|
|
140
|
-
- 职责分明的实现层
|
|
141
|
-
- 松耦合的模块设计
|
|
142
|
-
|
|
143
|
-
3. **状态管理**
|
|
144
|
-
- 基于控制器的状态管理
|
|
145
|
-
- 响应式数据流
|
|
146
|
-
- 可预测的状态变更
|
|
147
|
-
|
|
148
|
-
4. **国际化支持**
|
|
149
|
-
- 基于 next-intl 的多语言支持
|
|
150
|
-
- 动态语言切换
|
|
151
|
-
- 路由级别的语言隔离
|
|
152
|
-
|
|
153
|
-
5. **主题系统**
|
|
154
|
-
- 基于 Tailwind CSS
|
|
155
|
-
- 暗黑模式支持
|
|
156
|
-
- 可配置的主题变量
|
|
157
|
-
|
|
158
|
-
## 开发流程
|
|
159
|
-
|
|
160
|
-
1. **API开发**
|
|
161
|
-
- 定义接口 (port)
|
|
162
|
-
- 实现验证器 (validators)
|
|
163
|
-
- 实现服务 (services)
|
|
164
|
-
- 创建API路由 (api)
|
|
165
|
-
|
|
166
|
-
2. **页面开发**
|
|
167
|
-
- 创建页面组件
|
|
168
|
-
- 实现控制器
|
|
169
|
-
- 注册依赖
|
|
170
|
-
- 添加路由
|
|
171
|
-
|
|
172
|
-
3. **组件开发**
|
|
173
|
-
- 创建UI组件
|
|
174
|
-
- 实现业务逻辑
|
|
175
|
-
- 注入依赖
|
|
176
|
-
- 添加样式
|