@qlover/create-app 0.4.1 → 0.4.3

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/configs/_common/.gitignore.template +49 -23
  3. package/dist/index.js +1 -1
  4. package/package.json +1 -1
  5. package/templates/react-app/{.env → .env.template} +2 -3
  6. package/templates/react-app/README.md +89 -8
  7. package/templates/react-app/config/app.router.json +13 -13
  8. package/templates/react-app/config/common.ts +8 -0
  9. package/templates/react-app/config/feapi.mock.json +8 -0
  10. package/templates/react-app/config/i18n.ts +3 -1
  11. package/templates/react-app/config/{Identifier.Error.ts → identifier/Error.ts} +7 -0
  12. package/templates/react-app/config/{Identifier.I18n.ts → identifier/I18n.ts} +321 -3
  13. package/templates/react-app/index.html +1 -1
  14. package/templates/react-app/package.json +3 -1
  15. package/templates/react-app/public/locales/en/common.json +55 -8
  16. package/templates/react-app/public/locales/zh/common.json +55 -8
  17. package/templates/react-app/public/router-root/logo.svg +1 -0
  18. package/templates/react-app/src/App.tsx +6 -3
  19. package/templates/react-app/src/base/cases/AppConfig.ts +1 -1
  20. package/templates/react-app/src/base/cases/PublicAssetsPath.ts +17 -0
  21. package/templates/react-app/src/base/port/LoginInterface.ts +8 -0
  22. package/templates/react-app/src/base/port/StoreInterface.ts +58 -0
  23. package/templates/react-app/src/base/services/I18nService.ts +15 -9
  24. package/templates/react-app/src/{uikit/controllers/RouterController.ts → base/services/RouteService.ts} +12 -12
  25. package/templates/react-app/src/{uikit/controllers/UserController.ts → base/services/UserService.ts} +29 -13
  26. package/templates/react-app/src/core/bootstrap.ts +1 -1
  27. package/templates/react-app/src/core/registers/RegisterCommon.ts +11 -1
  28. package/templates/react-app/src/core/registers/RegisterControllers.ts +3 -12
  29. package/templates/react-app/src/pages/auth/Layout.tsx +14 -6
  30. package/templates/react-app/src/pages/auth/Login.tsx +50 -29
  31. package/templates/react-app/src/pages/auth/Register.tsx +238 -1
  32. package/templates/react-app/src/pages/base/About.tsx +1 -1
  33. package/templates/react-app/src/pages/base/ErrorIdentifier.tsx +2 -2
  34. package/templates/react-app/src/pages/base/Executor.tsx +4 -4
  35. package/templates/react-app/src/pages/base/Home.tsx +1 -1
  36. package/templates/react-app/src/pages/base/JSONStorage.tsx +3 -3
  37. package/templates/react-app/src/pages/base/Request.tsx +4 -4
  38. package/templates/react-app/src/pages/base/components/BaseHeader.tsx +8 -2
  39. package/templates/react-app/src/styles/css/page.css +3 -3
  40. package/templates/react-app/src/styles/css/themes/_default.css +3 -3
  41. package/templates/react-app/src/styles/css/themes/dark.css +3 -3
  42. package/templates/react-app/src/styles/css/themes/pink.css +3 -3
  43. package/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +7 -7
  44. package/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +3 -3
  45. package/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +1 -1
  46. package/templates/react-app/src/uikit/controllers/ExecutorController.ts +6 -3
  47. package/templates/react-app/src/uikit/controllers/JSONStorageController.ts +6 -3
  48. package/templates/react-app/src/uikit/controllers/RequestController.ts +3 -4
  49. package/templates/react-app/src/uikit/hooks/useDocumentTitle.ts +15 -0
  50. package/templates/react-app/src/uikit/hooks/useStore.ts +12 -0
  51. package/templates/react-app/src/uikit/providers/BaseRouteProvider.tsx +7 -1
  52. package/templates/react-app/src/uikit/providers/ProcessProvider.tsx +7 -7
  53. package/templates/react-app/vite.config.ts +20 -11
@@ -1,6 +1,10 @@
1
1
  import { defineConfig } from 'vitest/config';
2
2
  import react from '@vitejs/plugin-react';
3
- import { envPrefix, overrideAntdThemeMode } from './config/common';
3
+ import {
4
+ envPrefix,
5
+ overrideAntdThemeMode,
6
+ routerPrefix
7
+ } from './config/common';
4
8
  import { name, version } from './package.json';
5
9
  import tsconfigPaths from 'vite-tsconfig-paths';
6
10
  import envConfig from '@qlover/corekit-bridge/vite-env-config/index';
@@ -9,6 +13,8 @@ import i18nConfig from './config/i18n';
9
13
  import tailwindcss from '@tailwindcss/vite';
10
14
  import viteDeprecatedAntd from '@brain-toolkit/antd-theme-override/vite';
11
15
  import vitePluginImp from 'vite-plugin-imp';
16
+ import { readdirSync } from 'fs';
17
+ import { join } from 'path';
12
18
 
13
19
  // https://vite.dev/config/
14
20
  export default defineConfig({
@@ -87,16 +93,18 @@ export default defineConfig({
87
93
  tsconfigPaths(),
88
94
  ts2Locales({
89
95
  locales: i18nConfig.supportedLngs as unknown as string[],
90
- options: [
91
- {
92
- source: './config/Identifier.Error.ts',
93
- target: './public/locales/{{lng}}/common.json'
94
- },
95
- {
96
- source: './config/Identifier.I18n.ts',
97
- target: './public/locales/{{lng}}/common.json'
98
- }
99
- ]
96
+ options: readdirSync(join(__dirname, './config/Identifier'))
97
+ .map((file) => ({
98
+ file,
99
+ name: file.replace('.ts', ''),
100
+ path: join('./config/Identifier', file)
101
+ }))
102
+ .map(({ path }) => ({
103
+ source: path,
104
+ // You can use namespace
105
+ // target: `./public/locales/{{lng}}/{{${name}}}.json`
106
+ target: `./public/locales/{{lng}}/common.json`
107
+ }))
100
108
  }),
101
109
  viteDeprecatedAntd({
102
110
  mode: overrideAntdThemeMode,
@@ -104,6 +112,7 @@ export default defineConfig({
104
112
  targetPath: './src/base/types/deprecated-antd.d.ts'
105
113
  })
106
114
  ],
115
+ base: routerPrefix,
107
116
  envPrefix: envPrefix,
108
117
  publicDir: 'public',
109
118
  server: {