@moluoxixi/create-app 2.0.408 → 2.0.411

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 (107) hide show
  1. package/dist/test.js +168 -87
  2. package/dist/types/features.d.ts +7 -9
  3. package/dist/types/features.js +6 -25
  4. package/dist/types/index.d.ts +20 -13
  5. package/dist/utils/featureMapping.d.ts +5 -26
  6. package/dist/utils/featureMapping.js +24 -68
  7. package/dist/utils/generateFrameworkProject.d.ts +2 -0
  8. package/dist/utils/generateFrameworkProject.js +136 -21
  9. package/dist/utils/prompts.js +37 -7
  10. package/dist/utils/renderFeatures.d.ts +38 -1
  11. package/dist/utils/renderFeatures.js +121 -37
  12. package/dist/utils/routeModeMapping.d.ts +14 -0
  13. package/dist/utils/routeModeMapping.js +15 -0
  14. package/package.json +2 -3
  15. package/templates/common/base/package.json +1 -1
  16. package/templates/common/base/vite.config.ts.ejs +1 -1
  17. package/templates/react/base/package.json +1 -3
  18. package/templates/react/base/src/main.tsx.ejs +16 -43
  19. package/templates/react/features/pageRoutes/package.json +1 -0
  20. package/templates/react/micro-frontends/qiankun/base/package.json +6 -0
  21. package/templates/react/micro-frontends/qiankun/base/src/main.tsx.ejs +83 -0
  22. package/templates/react/micro-frontends/qiankun/base/vite.config.ts.ejs +89 -0
  23. package/templates/vue/base/package.json +1 -5
  24. package/templates/vue/base/src/main.ts.ejs +18 -41
  25. package/templates/vue/features/element-plus/src/layouts/element.vue +1 -4
  26. package/templates/vue/features/manualRoutes/package.json +0 -1
  27. package/templates/vue/features/manualRoutes/src/router/index.ts +11 -12
  28. package/templates/vue/features/manualRoutes/src/router/routes.ts +14 -23
  29. package/templates/vue/features/pageRoutes/package.json +0 -1
  30. package/templates/vue/features/pageRoutes/src/router/index.ts +11 -12
  31. package/templates/vue/features/pinia/node_modules/.bin/tsc +17 -0
  32. package/templates/vue/features/pinia/node_modules/.bin/tsc.CMD +12 -0
  33. package/templates/vue/features/pinia/node_modules/.bin/tsc.ps1 +41 -0
  34. package/templates/vue/features/pinia/node_modules/.bin/tsserver +17 -0
  35. package/templates/vue/features/pinia/node_modules/.bin/tsserver.CMD +12 -0
  36. package/templates/vue/features/pinia/node_modules/.bin/tsserver.ps1 +41 -0
  37. package/templates/vue/features/pinia/package.json +6 -0
  38. package/templates/vue/micro-frontends/qiankun/base/package.json +6 -0
  39. package/templates/vue/micro-frontends/qiankun/base/src/main.ts.ejs +87 -0
  40. package/templates/vue/micro-frontends/qiankun/base/vite.config.ts.ejs +89 -0
  41. package/templates/vue/micro-frontends/qiankun/features/element-plus/src/layouts/element.vue +120 -0
  42. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/jiti +17 -0
  43. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/jiti.CMD +12 -0
  44. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/jiti.ps1 +41 -0
  45. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/sass +17 -0
  46. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/sass.CMD +12 -0
  47. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/sass.ps1 +41 -0
  48. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/terser +17 -0
  49. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/terser.CMD +12 -0
  50. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/terser.ps1 +41 -0
  51. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsc +17 -0
  52. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsc.CMD +12 -0
  53. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsc.ps1 +41 -0
  54. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsserver +17 -0
  55. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsserver.CMD +12 -0
  56. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsserver.ps1 +41 -0
  57. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsx +17 -0
  58. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsx.CMD +12 -0
  59. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/tsx.ps1 +41 -0
  60. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/vite +17 -0
  61. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/vite.CMD +12 -0
  62. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/vite.ps1 +41 -0
  63. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/yaml +17 -0
  64. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/yaml.CMD +12 -0
  65. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/yaml.ps1 +41 -0
  66. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/package.json +5 -0
  67. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/router/index.ts +56 -0
  68. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/jiti +17 -0
  69. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/jiti.CMD +12 -0
  70. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/jiti.ps1 +41 -0
  71. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/sass +17 -0
  72. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/sass.CMD +12 -0
  73. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/sass.ps1 +41 -0
  74. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/terser +17 -0
  75. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/terser.CMD +12 -0
  76. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/terser.ps1 +41 -0
  77. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsc +17 -0
  78. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsc.CMD +12 -0
  79. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsc.ps1 +41 -0
  80. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsserver +17 -0
  81. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsserver.CMD +12 -0
  82. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsserver.ps1 +41 -0
  83. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsx +17 -0
  84. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsx.CMD +12 -0
  85. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/tsx.ps1 +41 -0
  86. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/vite +17 -0
  87. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/vite.CMD +12 -0
  88. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/vite.ps1 +41 -0
  89. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/yaml +17 -0
  90. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/yaml.CMD +12 -0
  91. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/yaml.ps1 +41 -0
  92. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/package.json +5 -0
  93. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/src/router/index.ts +57 -0
  94. package/templates/react/base/src/qiankun/index.ts +0 -83
  95. package/templates/react/base/src/stores/user.ts +0 -55
  96. package/templates/vue/base/src/router/layout.vue +0 -15
  97. package/templates/vue/features/manualRoutes/src/stores/index.ts +0 -6
  98. package/templates/vue/features/manualRoutes/src/stores/modules/system.ts +0 -51
  99. package/templates/vue/features/manualRoutes/src/stores/modules/user.ts +0 -41
  100. package/templates/vue/features/pageRoutes/src/stores/index.ts +0 -6
  101. package/templates/vue/features/pageRoutes/src/stores/modules/system.ts +0 -51
  102. package/templates/vue/features/pageRoutes/src/stores/modules/user.ts +0 -41
  103. /package/templates/react/features/{router → manualRoutes}/package.json +0 -0
  104. /package/templates/react/{base → features/zustand}/src/stores/index.ts +0 -0
  105. /package/templates/vue/{base → features/pinia}/src/stores/index.ts +0 -0
  106. /package/templates/vue/{base → features/pinia}/src/stores/modules/system.ts +0 -0
  107. /package/templates/vue/{base → features/pinia}/src/stores/modules/user.ts +0 -0
@@ -1,6 +0,0 @@
1
- import { createPinia } from 'pinia'
2
- import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
3
-
4
- const store = createPinia()
5
- store.use(piniaPluginPersistedstate)
6
- export { store }
@@ -1,51 +0,0 @@
1
- import { defineStore } from 'pinia'
2
- import { store } from '../index.ts'
3
-
4
- /**
5
- * 系统对象
6
- * @returns {object} 系统存储对象
7
- */
8
- const systemStore = defineStore('system', {
9
- state: () => ({
10
- /**
11
- * 主题颜色
12
- * @type {string}
13
- */
14
- themeColor: '#3a77ff',
15
- /**
16
- * 布局
17
- * @type {string}
18
- */
19
- layout: 'element',
20
- /**
21
- * 系统编码
22
- * @type {string}
23
- */
24
- systemCode: import.meta.env.VITE_APP_CODE || '',
25
- }),
26
- actions: {
27
- setSystemCode(systemCode: string) {
28
- // 将当前的主题颜色设置为传入的颜色
29
- this.systemCode = systemCode
30
- },
31
- /**
32
- * 设置布局
33
- * @param {string} layout - 新的布局
34
- */
35
- setLayout(layout: string) {
36
- this.layout = layout
37
- },
38
- /**
39
- * 设置主题颜色
40
- * @param {string} color - 新的主题颜色
41
- */
42
- setTheme(color: string) {
43
- // 将当前的主题颜色设置为传入的颜色
44
- this.themeColor = color
45
- },
46
- },
47
- })
48
-
49
- export function useSystemStore() {
50
- return systemStore(store)
51
- }
@@ -1,41 +0,0 @@
1
- import { defineStore } from 'pinia'
2
- import { ref } from 'vue'
3
- import { store } from '@/stores'
4
-
5
- export const userStore = defineStore(
6
- 'user',
7
- () => {
8
- // 定义token
9
- const token = ref('')
10
-
11
- /**
12
- * 用户登录
13
- * @param userInfo 用户信息(可选,qiankun 环境下可能从主应用传递)
14
- */
15
- const userLogin = async (userInfo?: any) => {
16
- // 如果传递了用户信息,可以在这里处理登录逻辑
17
- // 例如:设置 token、保存用户信息等
18
- if (userInfo) {
19
- // 可以根据实际需求处理用户信息
20
- console.log('User login with info:', userInfo)
21
- }
22
- }
23
-
24
- /**
25
- * 获取 token
26
- * @returns token 值
27
- */
28
- const getToken = () => {
29
- return token.value
30
- }
31
-
32
- return { getToken, userLogin, token }
33
- },
34
- {
35
- persist: true,
36
- },
37
- )
38
-
39
- export function useUserStore() {
40
- return userStore(store)
41
- }
@@ -1,6 +0,0 @@
1
- import { createPinia } from 'pinia'
2
- import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
3
-
4
- const store = createPinia()
5
- store.use(piniaPluginPersistedstate)
6
- export { store }
@@ -1,51 +0,0 @@
1
- import { defineStore } from 'pinia'
2
- import { store } from '../index.ts'
3
-
4
- /**
5
- * 系统对象
6
- * @returns {object} 系统存储对象
7
- */
8
- const systemStore = defineStore('system', {
9
- state: () => ({
10
- /**
11
- * 主题颜色
12
- * @type {string}
13
- */
14
- themeColor: '#3a77ff',
15
- /**
16
- * 布局
17
- * @type {string}
18
- */
19
- layout: 'element',
20
- /**
21
- * 系统编码
22
- * @type {string}
23
- */
24
- systemCode: import.meta.env.VITE_APP_CODE || '',
25
- }),
26
- actions: {
27
- setSystemCode(systemCode: string) {
28
- // 将当前的主题颜色设置为传入的颜色
29
- this.systemCode = systemCode
30
- },
31
- /**
32
- * 设置布局
33
- * @param {string} layout - 新的布局
34
- */
35
- setLayout(layout: string) {
36
- this.layout = layout
37
- },
38
- /**
39
- * 设置主题颜色
40
- * @param {string} color - 新的主题颜色
41
- */
42
- setTheme(color: string) {
43
- // 将当前的主题颜色设置为传入的颜色
44
- this.themeColor = color
45
- },
46
- },
47
- })
48
-
49
- export function useSystemStore() {
50
- return systemStore(store)
51
- }
@@ -1,41 +0,0 @@
1
- import { defineStore } from 'pinia'
2
- import { ref } from 'vue'
3
- import { store } from '@/stores'
4
-
5
- export const userStore = defineStore(
6
- 'user',
7
- () => {
8
- // 定义token
9
- const token = ref('')
10
-
11
- /**
12
- * 用户登录
13
- * @param userInfo 用户信息(可选,qiankun 环境下可能从主应用传递)
14
- */
15
- const userLogin = async (userInfo?: any) => {
16
- // 如果传递了用户信息,可以在这里处理登录逻辑
17
- // 例如:设置 token、保存用户信息等
18
- if (userInfo) {
19
- // 可以根据实际需求处理用户信息
20
- console.log('User login with info:', userInfo)
21
- }
22
- }
23
-
24
- /**
25
- * 获取 token
26
- * @returns token 值
27
- */
28
- const getToken = () => {
29
- return token.value
30
- }
31
-
32
- return { getToken, userLogin, token }
33
- },
34
- {
35
- persist: true,
36
- },
37
- )
38
-
39
- export function useUserStore() {
40
- return userStore(store)
41
- }