@moluoxixi/create-app 2.0.436 → 2.0.438

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 (273) hide show
  1. package/dist/constants/index.d.ts +5 -0
  2. package/dist/constants/index.js +8 -0
  3. package/dist/core/feature.d.ts +26 -20
  4. package/dist/core/feature.js +47 -52
  5. package/dist/core/prompts.js +6 -3
  6. package/dist/core/template.js +1 -1
  7. package/dist/generators/project.js +8 -0
  8. package/dist/types/packageJson.d.ts +2 -0
  9. package/dist/utils/deepMerge.d.ts +1 -1
  10. package/dist/utils/file.js +6 -2
  11. package/dist/utils/framework.d.ts +11 -0
  12. package/dist/utils/framework.js +13 -0
  13. package/dist/utils/index.d.ts +1 -0
  14. package/dist/utils/index.js +1 -0
  15. package/package.json +4 -5
  16. package/templates/common/base/_npmrc +2 -0
  17. package/templates/common/base/_yarnrc.yml +3 -0
  18. package/templates/common/base/node_modules/.bin/parser +4 -4
  19. package/templates/common/base/node_modules/.bin/rollup +4 -4
  20. package/templates/common/base/node_modules/.bin/sass +2 -2
  21. package/templates/common/base/node_modules/.bin/terser +4 -4
  22. package/templates/common/base/node_modules/.bin/vite +2 -2
  23. package/templates/common/base/package.json +2 -4
  24. package/templates/common/base/scripts/build.mts +15 -10
  25. package/templates/common/base/src/apis/request.ts +23 -32
  26. package/templates/common/base/src/apis/services/example.ts +2 -2
  27. package/templates/common/base/src/apis/services/user.ts +2 -2
  28. package/templates/common/base/tsconfig.app.json +25 -0
  29. package/templates/common/base/tsconfig.base.json +17 -0
  30. package/templates/common/base/tsconfig.json +11 -0
  31. package/templates/common/base/tsconfig.node.json +14 -0
  32. package/templates/common/base/vite/index.ts +19 -18
  33. package/templates/common/base/vite.config.ts +8 -4
  34. package/templates/common/features/eslint/node_modules/.bin/sass +17 -0
  35. package/templates/common/features/eslint/node_modules/.bin/terser +17 -0
  36. package/templates/common/features/eslint/node_modules/.bin/tsx +17 -0
  37. package/templates/common/features/eslint/node_modules/.bin/vitest +17 -0
  38. package/templates/common/features/eslint/node_modules/.bin/yaml +17 -0
  39. package/templates/common/features/eslint/tsconfig.base.json +17 -0
  40. package/templates/common/features/eslint/tsconfig.json +8 -0
  41. package/templates/common/features/eslint/tsconfig.node.json +13 -0
  42. package/templates/common/features/husky/.husky/pre-commit +1 -1
  43. package/templates/common/features/husky/node_modules/.bin/commitizen +2 -2
  44. package/templates/common/features/husky/node_modules/.bin/commitlint +2 -2
  45. package/templates/common/features/husky/node_modules/.bin/cz +2 -2
  46. package/templates/common/features/husky/node_modules/.bin/git-cz +2 -2
  47. package/templates/common/features/husky/tsconfig.base.json +17 -0
  48. package/templates/common/features/husky/tsconfig.json +8 -0
  49. package/templates/common/features/husky/tsconfig.node.json +13 -0
  50. package/templates/react/base/node_modules/.bin/sass +4 -4
  51. package/templates/react/base/node_modules/.bin/terser +4 -4
  52. package/templates/react/base/node_modules/.bin/vite +4 -4
  53. package/templates/react/base/package.json +2 -1
  54. package/templates/react/base/src/main.tsx +1 -1
  55. package/templates/react/base/src/router/index.tsx +26 -0
  56. package/templates/react/base/src/utils/common.ts +126 -0
  57. package/templates/react/base/src/utils/index.ts +7 -0
  58. package/templates/react/base/tsconfig.app.json +13 -5
  59. package/templates/react/base/tsconfig.node.json +6 -7
  60. package/templates/react/features/ant-design/tsconfig.app.json +25 -0
  61. package/templates/react/features/ant-design/tsconfig.base.json +22 -0
  62. package/templates/react/features/ant-design/tsconfig.json +11 -0
  63. package/templates/react/features/ant-design/tsconfig.node.json +14 -0
  64. package/templates/react/features/i18n/tsconfig.app.json +25 -0
  65. package/templates/react/features/i18n/tsconfig.base.json +22 -0
  66. package/templates/react/features/i18n/tsconfig.json +11 -0
  67. package/templates/react/features/i18n/tsconfig.node.json +14 -0
  68. package/templates/react/features/manualRoutes/tsconfig.app.json +25 -0
  69. package/templates/react/features/manualRoutes/tsconfig.base.json +27 -0
  70. package/templates/react/features/manualRoutes/tsconfig.json +11 -0
  71. package/templates/react/features/manualRoutes/tsconfig.node.json +14 -0
  72. package/templates/react/features/pageRoutes/node_modules/.bin/browserslist +17 -0
  73. package/templates/react/features/pageRoutes/node_modules/.bin/jiti +17 -0
  74. package/templates/react/features/pageRoutes/node_modules/.bin/parser +17 -0
  75. package/templates/react/features/pageRoutes/node_modules/.bin/rollup +17 -0
  76. package/templates/react/features/pageRoutes/node_modules/.bin/sass +17 -0
  77. package/templates/react/features/pageRoutes/node_modules/.bin/terser +17 -0
  78. package/templates/react/features/pageRoutes/node_modules/.bin/tsc +17 -0
  79. package/templates/react/features/pageRoutes/node_modules/.bin/tsserver +17 -0
  80. package/templates/react/features/pageRoutes/node_modules/.bin/tsx +17 -0
  81. package/templates/react/features/pageRoutes/node_modules/.bin/vite +17 -0
  82. package/templates/react/features/pageRoutes/node_modules/.bin/yaml +17 -0
  83. package/templates/react/features/pageRoutes/package.json +4 -0
  84. package/templates/react/features/pageRoutes/tsconfig.app.json +25 -0
  85. package/templates/react/features/pageRoutes/tsconfig.base.json +27 -0
  86. package/templates/react/features/pageRoutes/tsconfig.json +11 -0
  87. package/templates/react/features/pageRoutes/tsconfig.node.json +14 -0
  88. package/templates/react/features/pageRoutes/vite/features/pageRoutes.ts +15 -0
  89. package/templates/react/features/sentry/node_modules/.bin/browserslist +17 -0
  90. package/templates/react/features/sentry/node_modules/.bin/jiti +17 -0
  91. package/templates/react/features/sentry/node_modules/.bin/parser +17 -0
  92. package/templates/react/features/sentry/node_modules/.bin/rollup +17 -0
  93. package/templates/react/features/sentry/node_modules/.bin/sass +17 -0
  94. package/templates/react/features/sentry/node_modules/.bin/terser +17 -0
  95. package/templates/react/features/sentry/node_modules/.bin/tsc +17 -0
  96. package/templates/react/features/sentry/node_modules/.bin/tsserver +17 -0
  97. package/templates/react/features/sentry/node_modules/.bin/tsx +17 -0
  98. package/templates/react/features/sentry/node_modules/.bin/vite +17 -0
  99. package/templates/react/features/sentry/node_modules/.bin/yaml +17 -0
  100. package/templates/react/features/sentry/package.json +3 -0
  101. package/templates/react/features/sentry/tsconfig.app.json +25 -0
  102. package/templates/react/features/sentry/tsconfig.base.json +22 -0
  103. package/templates/react/features/sentry/tsconfig.json +11 -0
  104. package/templates/react/features/sentry/tsconfig.node.json +14 -0
  105. package/templates/react/features/sentry/vite/features/sentry.ts +19 -25
  106. package/templates/react/features/zustand/tsconfig.app.json +25 -0
  107. package/templates/react/features/zustand/tsconfig.base.json +27 -0
  108. package/templates/react/features/zustand/tsconfig.json +11 -0
  109. package/templates/react/features/zustand/tsconfig.node.json +14 -0
  110. package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/browserslist +17 -0
  111. package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/parser +17 -0
  112. package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/rollup +17 -0
  113. package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/sass +4 -4
  114. package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/terser +4 -4
  115. package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/vite +2 -2
  116. package/templates/react/micro-frontends/qiankun/base/package.json +2 -1
  117. package/templates/react/micro-frontends/qiankun/base/src/main.tsx +3 -3
  118. package/templates/react/micro-frontends/qiankun/base/tsconfig.app.json +25 -0
  119. package/templates/react/micro-frontends/qiankun/base/tsconfig.base.json +27 -0
  120. package/templates/react/micro-frontends/qiankun/base/tsconfig.json +11 -0
  121. package/templates/react/micro-frontends/qiankun/base/tsconfig.node.json +14 -0
  122. package/templates/react/micro-frontends/qiankun/base/vite/index.ts +19 -18
  123. package/templates/vue/base/node_modules/.bin/vue-tsc +2 -2
  124. package/templates/vue/base/package.json +3 -2
  125. package/templates/vue/base/src/assets/fonts/index.css +6 -0
  126. package/templates/vue/base/src/assets/styles/base.scss +33 -0
  127. package/templates/vue/base/src/assets/styles/custom.scss +20 -0
  128. package/templates/vue/base/src/assets/styles/main.scss +8 -0
  129. package/templates/vue/base/src/assets/styles/tailwind.scss +3 -0
  130. package/templates/vue/base/src/main.ts +3 -3
  131. package/templates/vue/base/src/router/index.ts +25 -0
  132. package/templates/vue/base/src/utils/common.ts +126 -0
  133. package/templates/vue/base/src/utils/index.ts +4 -0
  134. package/templates/vue/base/tsconfig.app.json +10 -3
  135. package/templates/vue/base/tsconfig.base.json +2 -6
  136. package/templates/vue/base/tsconfig.json +1 -0
  137. package/templates/vue/base/tsconfig.node.json +1 -2
  138. package/templates/vue/features/ant-design-vue/tsconfig.app.json +33 -0
  139. package/templates/vue/features/ant-design-vue/tsconfig.base.json +25 -0
  140. package/templates/vue/features/ant-design-vue/tsconfig.json +12 -0
  141. package/templates/vue/features/ant-design-vue/tsconfig.node.json +14 -0
  142. package/templates/vue/features/element-plus/node_modules/.bin/browserslist +17 -0
  143. package/templates/vue/features/element-plus/node_modules/.bin/jiti +17 -0
  144. package/templates/vue/features/element-plus/node_modules/.bin/parser +17 -0
  145. package/templates/vue/features/element-plus/node_modules/.bin/rollup +17 -0
  146. package/templates/vue/features/element-plus/node_modules/.bin/sass +17 -0
  147. package/templates/vue/features/element-plus/node_modules/.bin/terser +17 -0
  148. package/templates/vue/features/element-plus/node_modules/.bin/tsx +17 -0
  149. package/templates/vue/features/element-plus/node_modules/.bin/vite +17 -0
  150. package/templates/vue/features/element-plus/node_modules/.bin/yaml +17 -0
  151. package/templates/vue/features/element-plus/package.json +4 -0
  152. package/templates/vue/features/element-plus/src/assets/styles/main.scss +0 -1
  153. package/templates/vue/features/element-plus/src/layouts/element.vue +1 -1
  154. package/templates/vue/features/element-plus/src/stores/modules/system.ts +1 -1
  155. package/templates/vue/features/element-plus/tsconfig.app.json +33 -0
  156. package/templates/vue/features/element-plus/tsconfig.base.json +25 -0
  157. package/templates/vue/features/element-plus/tsconfig.json +12 -0
  158. package/templates/vue/features/element-plus/tsconfig.node.json +14 -0
  159. package/templates/vue/features/element-plus/vite/features/element-plus.ts +13 -18
  160. package/templates/vue/features/i18n/tsconfig.app.json +33 -0
  161. package/templates/vue/features/i18n/tsconfig.base.json +25 -0
  162. package/templates/vue/features/i18n/tsconfig.json +12 -0
  163. package/templates/vue/features/i18n/tsconfig.node.json +14 -0
  164. package/templates/vue/features/manualRoutes/package.json +2 -1
  165. package/templates/vue/features/manualRoutes/src/layouts/index.ts +26 -0
  166. package/templates/vue/features/manualRoutes/src/router/index.ts +1 -1
  167. package/templates/vue/features/manualRoutes/src/stores/modules/system.ts +1 -1
  168. package/templates/vue/features/manualRoutes/tsconfig.app.json +33 -0
  169. package/templates/vue/features/manualRoutes/tsconfig.base.json +25 -0
  170. package/templates/vue/features/manualRoutes/tsconfig.json +12 -0
  171. package/templates/vue/features/manualRoutes/tsconfig.node.json +14 -0
  172. package/templates/vue/features/pageRoutes/node_modules/.bin/browserslist +17 -0
  173. package/templates/vue/features/pageRoutes/node_modules/.bin/jiti +17 -0
  174. package/templates/vue/features/pageRoutes/node_modules/.bin/parser +17 -0
  175. package/templates/vue/features/pageRoutes/node_modules/.bin/rollup +17 -0
  176. package/templates/vue/features/pageRoutes/node_modules/.bin/sass +17 -0
  177. package/templates/vue/features/pageRoutes/node_modules/.bin/terser +17 -0
  178. package/templates/vue/features/pageRoutes/node_modules/.bin/tsx +17 -0
  179. package/templates/vue/features/pageRoutes/node_modules/.bin/vite +17 -0
  180. package/templates/vue/features/pageRoutes/node_modules/.bin/yaml +17 -0
  181. package/templates/vue/features/pageRoutes/package.json +4 -1
  182. package/templates/vue/features/pageRoutes/src/layouts/index.ts +26 -0
  183. package/templates/vue/features/pageRoutes/src/stores/modules/system.ts +1 -1
  184. package/templates/vue/features/pageRoutes/tsconfig.app.json +33 -0
  185. package/templates/vue/features/pageRoutes/tsconfig.base.json +25 -0
  186. package/templates/vue/features/pageRoutes/tsconfig.json +12 -0
  187. package/templates/vue/features/pageRoutes/tsconfig.node.json +14 -0
  188. package/templates/vue/features/pageRoutes/vite/features/pageRoutes.ts +15 -0
  189. package/templates/vue/features/pinia/package.json +3 -0
  190. package/templates/vue/features/pinia/src/stores/modules/system.ts +1 -1
  191. package/templates/vue/features/pinia/tsconfig.app.json +33 -0
  192. package/templates/vue/features/pinia/tsconfig.base.json +25 -0
  193. package/templates/vue/features/pinia/tsconfig.json +12 -0
  194. package/templates/vue/features/pinia/tsconfig.node.json +14 -0
  195. package/templates/vue/features/sentry/node_modules/.bin/browserslist +17 -0
  196. package/templates/vue/features/sentry/node_modules/.bin/jiti +17 -0
  197. package/templates/vue/features/sentry/node_modules/.bin/parser +17 -0
  198. package/templates/vue/features/sentry/node_modules/.bin/rollup +17 -0
  199. package/templates/vue/features/sentry/node_modules/.bin/sass +17 -0
  200. package/templates/vue/features/sentry/node_modules/.bin/terser +17 -0
  201. package/templates/vue/features/sentry/node_modules/.bin/tsx +17 -0
  202. package/templates/vue/features/sentry/node_modules/.bin/vite +17 -0
  203. package/templates/vue/features/sentry/node_modules/.bin/yaml +17 -0
  204. package/templates/vue/features/sentry/package.json +3 -0
  205. package/templates/vue/features/sentry/tsconfig.app.json +33 -0
  206. package/templates/vue/features/sentry/tsconfig.base.json +25 -0
  207. package/templates/vue/features/sentry/tsconfig.json +12 -0
  208. package/templates/vue/features/sentry/tsconfig.node.json +14 -0
  209. package/templates/vue/features/sentry/vite/features/sentry.ts +19 -25
  210. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/browserslist +17 -0
  211. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/jiti +2 -2
  212. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/parser +17 -0
  213. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/rollup +17 -0
  214. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/sass +4 -4
  215. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/terser +4 -4
  216. package/templates/vue/micro-frontends/qiankun/base/node_modules/.bin/vite +2 -2
  217. package/templates/vue/micro-frontends/qiankun/base/package.json +6 -1
  218. package/templates/vue/micro-frontends/qiankun/base/src/App.vue +13 -0
  219. package/templates/vue/micro-frontends/qiankun/base/src/assets/fonts/index.css +6 -0
  220. package/templates/vue/micro-frontends/qiankun/base/src/assets/styles/base.scss +33 -0
  221. package/templates/vue/micro-frontends/qiankun/base/src/assets/styles/custom.scss +20 -0
  222. package/templates/vue/micro-frontends/qiankun/base/src/assets/styles/main.scss +8 -0
  223. package/templates/vue/micro-frontends/qiankun/base/src/assets/styles/tailwind.scss +3 -0
  224. package/templates/vue/micro-frontends/qiankun/base/src/directives/index.ts +36 -0
  225. package/templates/vue/micro-frontends/qiankun/base/src/main.ts +5 -5
  226. package/templates/vue/micro-frontends/qiankun/base/src/router/index.ts +27 -0
  227. package/templates/vue/micro-frontends/qiankun/base/src/stores/index.ts +8 -0
  228. package/templates/vue/micro-frontends/qiankun/base/tsconfig.app.json +33 -0
  229. package/templates/vue/micro-frontends/qiankun/base/tsconfig.base.json +25 -0
  230. package/templates/vue/micro-frontends/qiankun/base/tsconfig.json +12 -0
  231. package/templates/vue/micro-frontends/qiankun/base/tsconfig.node.json +14 -0
  232. package/templates/vue/micro-frontends/qiankun/base/vite/index.ts +19 -18
  233. package/templates/vue/micro-frontends/qiankun/features/element-plus/node_modules/.bin/browserslist +17 -0
  234. package/templates/vue/micro-frontends/qiankun/features/element-plus/node_modules/.bin/parser +17 -0
  235. package/templates/vue/micro-frontends/qiankun/features/element-plus/node_modules/.bin/rollup +17 -0
  236. package/templates/vue/micro-frontends/qiankun/features/element-plus/node_modules/.bin/sass +4 -4
  237. package/templates/vue/micro-frontends/qiankun/features/element-plus/node_modules/.bin/terser +4 -4
  238. package/templates/vue/micro-frontends/qiankun/features/element-plus/node_modules/.bin/vite +4 -4
  239. package/templates/vue/micro-frontends/qiankun/features/element-plus/package.json +4 -0
  240. package/templates/vue/micro-frontends/qiankun/features/element-plus/src/assets/styles/main.scss +0 -1
  241. package/templates/vue/micro-frontends/qiankun/features/element-plus/src/stores/modules/system.ts +1 -1
  242. package/templates/vue/micro-frontends/qiankun/features/element-plus/tsconfig.app.json +33 -0
  243. package/templates/vue/micro-frontends/qiankun/features/element-plus/tsconfig.base.json +25 -0
  244. package/templates/vue/micro-frontends/qiankun/features/element-plus/tsconfig.json +12 -0
  245. package/templates/vue/micro-frontends/qiankun/features/element-plus/tsconfig.node.json +14 -0
  246. package/templates/vue/micro-frontends/qiankun/features/element-plus/vite/features/element-plus.ts +13 -18
  247. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/sass +4 -4
  248. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/terser +4 -4
  249. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/node_modules/.bin/vite +4 -4
  250. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/package.json +2 -1
  251. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/layouts/index.ts +26 -0
  252. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/stores/modules/system.ts +1 -1
  253. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/tsconfig.app.json +33 -0
  254. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/tsconfig.base.json +25 -0
  255. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/tsconfig.json +12 -0
  256. package/templates/vue/micro-frontends/qiankun/features/manualRoutes/tsconfig.node.json +14 -0
  257. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/browserslist +17 -0
  258. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/parser +17 -0
  259. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/rollup +17 -0
  260. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/sass +4 -4
  261. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/terser +4 -4
  262. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/node_modules/.bin/vite +4 -4
  263. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/package.json +4 -1
  264. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/src/stores/modules/system.ts +1 -1
  265. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/tsconfig.app.json +33 -0
  266. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/tsconfig.base.json +25 -0
  267. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/tsconfig.json +12 -0
  268. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/tsconfig.node.json +14 -0
  269. package/templates/vue/micro-frontends/qiankun/features/pageRoutes/vite/features/pageRoutes.ts +15 -0
  270. package/dist/test.d.ts +0 -5
  271. package/dist/test.js +0 -508
  272. package/templates/common/base/src/utils/index.ts +0 -87
  273. /package/templates/vue/features/element-plus/src/assets/styles/{element.scss → element/index.scss} +0 -0
@@ -81,3 +81,8 @@ export declare const PACKAGE_MANAGER_OPTIONS: readonly [{
81
81
  * 包管理器列表(仅值)
82
82
  */
83
83
  export declare const PACKAGE_MANAGERS: readonly PackageManagerType[];
84
+ /**
85
+ * 状态管理库映射(按框架自动选择)
86
+ * 框架 -> 对应的状态管理库 feature 名称
87
+ */
88
+ export declare const STATE_MANAGEMENT_MAP: Record<FrameworkType, string>;
@@ -86,3 +86,11 @@ export const PACKAGE_MANAGER_OPTIONS = [
86
86
  * 包管理器列表(仅值)
87
87
  */
88
88
  export const PACKAGE_MANAGERS = PACKAGE_MANAGER_OPTIONS.map(opt => opt.value);
89
+ /**
90
+ * 状态管理库映射(按框架自动选择)
91
+ * 框架 -> 对应的状态管理库 feature 名称
92
+ */
93
+ export const STATE_MANAGEMENT_MAP = {
94
+ vue: 'pinia',
95
+ react: 'zustand',
96
+ };
@@ -4,22 +4,45 @@
4
4
  */
5
5
  import type { FrameworkType, ProjectConfigType, RouteModeType } from '../types/index.ts';
6
6
  /**
7
- * 扫描所有 features(框架的 + 公共的)
7
+ * 获取公共 features 列表(从文件系统扫描)
8
+ * @returns 公共 feature 名称数组
9
+ */
10
+ export declare function getCommonFeatures(): string[];
11
+ /**
12
+ * 获取框架 features 列表(从文件系统扫描)
13
+ * @param framework 框架类型
14
+ * @returns 框架 feature 名称数组
15
+ */
16
+ export declare function getFrameworkFeatures(framework: FrameworkType): string[];
17
+ /**
18
+ * 获取微前端引擎列表(从文件系统扫描)
19
+ * @param framework 框架类型
20
+ * @returns 微前端引擎名称数组
21
+ */
22
+ export declare function getMicroFrontendEngines(framework: FrameworkType): string[];
23
+ /**
24
+ * 扫描所有 features(框架的 + 公共的 + 微前端的)
8
25
  * @param framework 框架类型
9
26
  * @returns 所有 feature 名称数组
10
27
  */
11
28
  export declare function scanAllFeatures(framework: FrameworkType): string[];
29
+ /**
30
+ * 过滤出布尔类型功能(排除 UI 库和路由模式)
31
+ * @param features feature 名称数组
32
+ * @returns 布尔类型 feature 名称数组
33
+ */
34
+ export declare function filterBooleanFeatures(features: string[]): string[];
12
35
  /**
13
36
  * Feature 名称转换为配置键和值(用于测试用例生成)
14
37
  * 注意:大部分情况下 feature 名称 === 配置名称
15
38
  * @param feature feature 名称
16
39
  * @param _framework 框架类型(保留参数以保持接口兼容性)
17
- * @returns 配置键值对,如果无法映射则返回 null
40
+ * @returns 配置键值对
18
41
  */
19
42
  export declare function featureToConfig(feature: string, _framework: FrameworkType): {
20
43
  key: string;
21
44
  value: string | boolean;
22
- } | null;
45
+ };
23
46
  /**
24
47
  * 根据路由模式获取对应的布尔特征配置
25
48
  * @param routeMode 路由模式('pageRoutes' | 'manualRoutes')
@@ -61,20 +84,3 @@ export declare function renderMicroFrontendFeatures(config: ProjectConfigType, t
61
84
  * @returns 引擎是否存在
62
85
  */
63
86
  export declare function validateMicroFrontendEngine(framework: FrameworkType, engine: string): boolean;
64
- /**
65
- * 获取可用的公共 features(用于测试和文档生成)
66
- * @returns 公共 feature 名称数组
67
- */
68
- export declare function getAvailableCommonFeatures(): string[];
69
- /**
70
- * 获取可用的框架 features(用于测试和文档生成)
71
- * @param framework 框架类型
72
- * @returns 框架 feature 名称数组
73
- */
74
- export declare function getAvailableFrameworkFeatures(framework: FrameworkType): string[];
75
- /**
76
- * 获取可用的微前端引擎(用于测试和文档生成)
77
- * @param framework 框架类型
78
- * @returns 微前端引擎名称数组
79
- */
80
- export declare function getAvailableMicroFrontendEngines(framework: FrameworkType): string[];
@@ -28,7 +28,7 @@ function scanFeatures(baseDir) {
28
28
  * 获取公共 features 列表(从文件系统扫描)
29
29
  * @returns 公共 feature 名称数组
30
30
  */
31
- function getCommonFeatures() {
31
+ export function getCommonFeatures() {
32
32
  const templatesDir = getTemplatesDir();
33
33
  const commonFeaturesDir = path.join(templatesDir, 'common', 'features');
34
34
  return scanFeatures(commonFeaturesDir);
@@ -38,7 +38,7 @@ function getCommonFeatures() {
38
38
  * @param framework 框架类型
39
39
  * @returns 框架 feature 名称数组
40
40
  */
41
- function getFrameworkFeatures(framework) {
41
+ export function getFrameworkFeatures(framework) {
42
42
  const templatesDir = getTemplatesDir();
43
43
  const frameworkFeaturesDir = path.join(templatesDir, framework, 'features');
44
44
  return scanFeatures(frameworkFeaturesDir);
@@ -48,7 +48,7 @@ function getFrameworkFeatures(framework) {
48
48
  * @param framework 框架类型
49
49
  * @returns 微前端引擎名称数组
50
50
  */
51
- function getMicroFrontendEngines(framework) {
51
+ export function getMicroFrontendEngines(framework) {
52
52
  const templatesDir = getTemplatesDir();
53
53
  const microFrontendsDir = path.join(templatesDir, framework, 'micro-frontends');
54
54
  return scanFeatures(microFrontendsDir);
@@ -57,28 +57,55 @@ function getMicroFrontendEngines(framework) {
57
57
  // Feature 映射(用于测试用例生成)
58
58
  // ============================================================================
59
59
  /**
60
- * 扫描所有 features(框架的 + 公共的)
60
+ * 扫描所有 features(框架的 + 公共的 + 微前端的)
61
61
  * @param framework 框架类型
62
62
  * @returns 所有 feature 名称数组
63
63
  */
64
64
  export function scanAllFeatures(framework) {
65
- const frameworkDir = path.join(getTemplatesDir(), framework, 'features');
66
- const commonDir = path.join(getTemplatesDir(), 'common', 'features');
65
+ const templatesDir = getTemplatesDir();
66
+ const frameworkDir = path.join(templatesDir, framework, 'features');
67
+ const commonDir = path.join(templatesDir, 'common', 'features');
67
68
  const features = [];
69
+ // 扫描框架 features
68
70
  if (fs.existsSync(frameworkDir)) {
69
- features.push(...fs.readdirSync(frameworkDir).filter(f => fs.statSync(path.join(frameworkDir, f)).isDirectory()));
71
+ features.push(...scanFeatures(frameworkDir));
70
72
  }
73
+ // 扫描公共 features
71
74
  if (fs.existsSync(commonDir)) {
72
- features.push(...fs.readdirSync(commonDir).filter(f => fs.statSync(path.join(commonDir, f)).isDirectory()));
75
+ features.push(...scanFeatures(commonDir));
76
+ }
77
+ // 扫描微前端 features
78
+ const microFrontendsDir = path.join(templatesDir, framework, 'micro-frontends');
79
+ if (fs.existsSync(microFrontendsDir)) {
80
+ const engines = getMicroFrontendEngines(framework);
81
+ for (const engine of engines) {
82
+ const microFrontendFeaturesPath = path.join(microFrontendsDir, engine, 'features');
83
+ if (fs.existsSync(microFrontendFeaturesPath)) {
84
+ features.push(...scanFeatures(microFrontendFeaturesPath));
85
+ }
86
+ }
73
87
  }
74
- return features;
88
+ // 去重并返回
89
+ return [...new Set(features)];
90
+ }
91
+ /**
92
+ * 过滤出布尔类型功能(排除 UI 库和路由模式)
93
+ * @param features feature 名称数组
94
+ * @returns 布尔类型 feature 名称数组
95
+ */
96
+ export function filterBooleanFeatures(features) {
97
+ // 使用 Set 提高查找性能
98
+ const allUiLibraries = new Set(Object.values(UI_LIBRARIES).flat());
99
+ const routeModesSet = new Set(ROUTE_MODES);
100
+ return features.filter(feature => !allUiLibraries.has(feature)
101
+ && !routeModesSet.has(feature));
75
102
  }
76
103
  /**
77
104
  * Feature 名称转换为配置键和值(用于测试用例生成)
78
105
  * 注意:大部分情况下 feature 名称 === 配置名称
79
106
  * @param feature feature 名称
80
107
  * @param _framework 框架类型(保留参数以保持接口兼容性)
81
- * @returns 配置键值对,如果无法映射则返回 null
108
+ * @returns 配置键值对
82
109
  */
83
110
  export function featureToConfig(feature, _framework) {
84
111
  // UI 库:配置键是 uiLibrary,值是 feature 名称
@@ -91,19 +118,9 @@ export function featureToConfig(feature, _framework) {
91
118
  if (ROUTE_MODES.includes(feature)) {
92
119
  return { key: 'routeMode', value: feature };
93
120
  }
94
- // 布尔类型的 features:配置名 === feature 名
95
- const booleanFeatures = [
96
- 'eslint',
97
- 'i18n',
98
- 'sentry',
99
- 'pinia',
100
- 'zustand',
101
- 'husky',
102
- ];
103
- if (booleanFeatures.includes(feature)) {
104
- return { key: feature, value: true };
105
- }
106
- return null;
121
+ // 其他所有情况都视为布尔类型的 features:配置名 === feature 名
122
+ // 除了 UI 库、路由模式之外,其他都是布尔类型
123
+ return { key: feature, value: true };
107
124
  }
108
125
  // ============================================================================
109
126
  // 路由模式转换
@@ -114,12 +131,13 @@ export function featureToConfig(feature, _framework) {
114
131
  * @returns 包含 manualRoutes 和 pageRoutes 布尔值的对象
115
132
  */
116
133
  export function getRouteModeFeatures(routeMode) {
117
- const manualRoutesValue = ROUTE_MODES.find(m => m === 'manualRoutes');
118
- const pageRoutesValue = ROUTE_MODES.find(m => m === 'pageRoutes');
119
- return {
120
- manualRoutes: routeMode === manualRoutesValue,
121
- pageRoutes: routeMode === pageRoutesValue,
122
- };
134
+ // 使用常量确保类型安全,避免硬编码字符串
135
+ // 遍历 ROUTE_MODES 数组,初始化所有路由模式为 false
136
+ const result = {};
137
+ for (const mode of ROUTE_MODES) {
138
+ result[mode] = mode === routeMode;
139
+ }
140
+ return result;
123
141
  }
124
142
  // ============================================================================
125
143
  // Feature 渲染
@@ -211,26 +229,3 @@ export function validateMicroFrontendEngine(framework, engine) {
211
229
  const availableEngines = getMicroFrontendEngines(framework);
212
230
  return availableEngines.includes(engine);
213
231
  }
214
- /**
215
- * 获取可用的公共 features(用于测试和文档生成)
216
- * @returns 公共 feature 名称数组
217
- */
218
- export function getAvailableCommonFeatures() {
219
- return getCommonFeatures();
220
- }
221
- /**
222
- * 获取可用的框架 features(用于测试和文档生成)
223
- * @param framework 框架类型
224
- * @returns 框架 feature 名称数组
225
- */
226
- export function getAvailableFrameworkFeatures(framework) {
227
- return getFrameworkFeatures(framework);
228
- }
229
- /**
230
- * 获取可用的微前端引擎(用于测试和文档生成)
231
- * @param framework 框架类型
232
- * @returns 微前端引擎名称数组
233
- */
234
- export function getAvailableMicroFrontendEngines(framework) {
235
- return getMicroFrontendEngines(framework);
236
- }
@@ -6,6 +6,7 @@ import fs from 'node:fs';
6
6
  import process from 'node:process';
7
7
  import inquirer from 'inquirer';
8
8
  import { FRAMEWORK_OPTIONS, MICRO_FRONTEND_ENGINE_OPTIONS, PACKAGE_MANAGER_OPTIONS, ROUTE_MODE_OPTIONS, UI_LIBRARY_OPTIONS, } from "../constants/index.js";
9
+ import { getAutoSelectedStateManagement } from "../utils/framework.js";
9
10
  import { getDefaultAuthor } from "../utils/npmConfig.js";
10
11
  import { getRouteModeFeatures } from "./feature.js";
11
12
  /**
@@ -166,8 +167,10 @@ export async function collectProjectConfig(projectName) {
166
167
  ]);
167
168
  const targetDir = `${process.cwd()}/${answers.projectName}`;
168
169
  // 根据框架确定状态管理 feature
169
- const isPinia = answers.framework === 'vue';
170
- const isZustand = answers.framework === 'react';
170
+ const framework = answers.framework;
171
+ const autoSelectedStateManagement = getAutoSelectedStateManagement(framework);
172
+ const isPinia = autoSelectedStateManagement === 'pinia';
173
+ const isZustand = autoSelectedStateManagement === 'zustand';
171
174
  // 根据路由模式获取对应的布尔特征配置
172
175
  const routeMode = answers.routeMode;
173
176
  const routeModeFeatures = getRouteModeFeatures(routeMode);
@@ -175,7 +178,7 @@ export async function collectProjectConfig(projectName) {
175
178
  projectName: answers.projectName,
176
179
  description: answers.description,
177
180
  author: answers.author,
178
- framework: answers.framework,
181
+ framework,
179
182
  uiLibrary: answers.uiLibrary,
180
183
  routeMode,
181
184
  // feature 名称与目录名称一致
@@ -120,7 +120,7 @@ function getPackageManagerVersion(packageManager) {
120
120
  const versions = {
121
121
  pnpm: '10.8.0',
122
122
  npm: '10.9.0',
123
- yarn: '4.1.0',
123
+ yarn: '1.22.22',
124
124
  };
125
125
  return versions[packageManager] || versions.pnpm;
126
126
  }
@@ -3,6 +3,7 @@
3
3
  * 根据配置生成完整的项目结构
4
4
  * 支持三层嵌套优先级 (L1: common, L2: framework, L3: micro-frontend)
5
5
  */
6
+ import fs from 'node:fs';
6
7
  import path from 'node:path';
7
8
  import { FILE_CONSTANTS, FRAMEWORKS } from "../constants/index.js";
8
9
  import { renderCommonFeatures, renderFrameworkFeatures, renderMicroFrontendFeatures, } from "../core/feature.js";
@@ -74,4 +75,11 @@ export async function generateProject(config) {
74
75
  // 3. 更新 package.json 元数据字段
75
76
  const packageJsonPath = path.join(targetDir, FILE_CONSTANTS.PACKAGE_JSON);
76
77
  updatePackageJsonMetadata(packageJsonPath, config.projectName, config.description, config.author, config.packageManager);
78
+ // 4. 清理包管理器特定文件(只有 yarn 需要 .yarnrc.yml)
79
+ if (config.packageManager !== 'yarn') {
80
+ const yarnrcPath = path.join(targetDir, '.yarnrc.yml');
81
+ if (fs.existsSync(yarnrcPath)) {
82
+ fs.unlinkSync(yarnrcPath);
83
+ }
84
+ }
77
85
  }
@@ -15,6 +15,8 @@ export interface PackageJson {
15
15
  author?: string;
16
16
  /** 包管理器及版本 */
17
17
  packageManager?: string;
18
+ /** 脚本命令 */
19
+ scripts?: Record<string, string>;
18
20
  /** 生产依赖 */
19
21
  dependencies?: Record<string, string>;
20
22
  /** 开发依赖 */
@@ -7,4 +7,4 @@
7
7
  * @param source 源对象
8
8
  * @returns 合并后的对象
9
9
  */
10
- export declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
10
+ export declare function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): Record<string, unknown>;
@@ -12,8 +12,12 @@ import fs from 'fs-extra';
12
12
  * @throws {Error} 如果路径不安全
13
13
  */
14
14
  export function validatePath(filePath, baseDir) {
15
- // 检查路径遍历攻击(.. 和 ~)
16
- if (filePath.includes('..') || filePath.includes('~')) {
15
+ // 检查路径遍历攻击(..)
16
+ if (filePath.includes('..')) {
17
+ throw new Error(`不安全的路径: ${filePath}`);
18
+ }
19
+ // 检查 home 目录路径(~/ 或 ~\),但允许 Vite 别名如 ~pages、~page
20
+ if (/~[/\\]/.test(filePath)) {
17
21
  throw new Error(`不安全的路径: ${filePath}`);
18
22
  }
19
23
  // 如果提供了基础目录,确保路径在基础目录内
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 框架相关工具函数
3
+ * 处理框架相关的查询和转换逻辑
4
+ */
5
+ import type { FrameworkType } from '../types/index.ts';
6
+ /**
7
+ * 获取框架对应的自动选择的状态管理库 feature 名称
8
+ * @param framework 框架类型
9
+ * @returns 状态管理库 feature 名称
10
+ */
11
+ export declare function getAutoSelectedStateManagement(framework: FrameworkType): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 框架相关工具函数
3
+ * 处理框架相关的查询和转换逻辑
4
+ */
5
+ import { STATE_MANAGEMENT_MAP } from "../constants/index.js";
6
+ /**
7
+ * 获取框架对应的自动选择的状态管理库 feature 名称
8
+ * @param framework 框架类型
9
+ * @returns 状态管理库 feature 名称
10
+ */
11
+ export function getAutoSelectedStateManagement(framework) {
12
+ return STATE_MANAGEMENT_MAP[framework];
13
+ }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from './deepMerge.ts';
6
6
  export * from './file.ts';
7
+ export * from './framework.ts';
7
8
  export * from './install.ts';
8
9
  export * from './npmConfig.ts';
9
10
  export * from './sortDependencies.ts';
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from "./deepMerge.js";
6
6
  export * from "./file.js";
7
+ export * from "./framework.js";
7
8
  export * from "./install.js";
8
9
  export * from "./npmConfig.js";
9
10
  export * from "./sortDependencies.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moluoxixi/create-app",
3
- "version": "2.0.436",
3
+ "version": "2.0.438",
4
4
  "type": "module",
5
5
  "description": "Create Vue/React projects with atomic layered architecture",
6
6
  "main": "dist/index.js",
@@ -50,14 +50,13 @@
50
50
  "ora": "^8.1.1"
51
51
  },
52
52
  "devDependencies": {
53
- "vite": "^6.2.4",
54
53
  "@commitlint/cli": "^19.8.0",
55
54
  "@commitlint/config-conventional": "^19.8.0",
56
55
  "@moluoxixi/eslint-config": "latest",
57
56
  "@types/fs-extra": "^11.0.4",
58
57
  "@types/inquirer": "^9.0.7",
59
- "@vue-macros/volar": "^3.0.0-beta.15",
60
58
  "@types/node": "^22.14.0",
59
+ "@vue-macros/volar": "^3.0.0-beta.15",
61
60
  "commitizen": "^4.3.1",
62
61
  "cz-customizable": "^7.4.0",
63
62
  "eslint": "^9.5.0",
@@ -72,10 +71,10 @@
72
71
  "scripts": {
73
72
  "dev": "tsx src/index.ts",
74
73
  "build": "tsc --build tsconfig.build.json",
75
- "test": "tsx src/test.ts",
74
+ "test": "pnpm --filter @moluoxixi/vite-cli-test test:all",
76
75
  "type-check": "tsc --noEmit",
77
76
  "lint:eslint": "eslint . --fix",
78
- "submodule:update": "git submodule update --init --recursive --remote",
77
+ "submodule:update": "cd .cursor && git pull && cd .. && git submodule update --init --recursive --remote",
79
78
  "lint-staged": "lint-staged",
80
79
  "commit": "git add . && git-cz",
81
80
  "version:patch": "pnpm version patch --no-git-tag-version",
@@ -0,0 +1,2 @@
1
+ legacy-peer-deps=true
2
+
@@ -0,0 +1,3 @@
1
+ # Disable Yarn PnP mode for better compatibility with ESLint plugins
2
+ # Some plugins like eslint-plugin-antfu don't properly declare all peer dependencies
3
+ nodeLinker: node-modules
@@ -6,12 +6,12 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.5/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/@babel+parser@7.28.6/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/bin/babel-parser.js" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/bin/babel-parser.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/bin/babel-parser.js" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/bin/babel-parser.js" "$@"
17
17
  fi
@@ -6,12 +6,12 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/dist/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/dist/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/dist/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/dist/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/dist/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/dist/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.55.1/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/dist/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/dist/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/rollup@4.57.0/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/dist/bin/rollup" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/dist/bin/rollup" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/rollup@4.55.1/node_modules/rollup/dist/bin/rollup" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/rollup@4.57.0/node_modules/rollup/dist/bin/rollup" "$@"
17
17
  fi
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.2/node_modules/sass/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.2/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.3/node_modules/sass/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.3/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.2/node_modules/sass/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.2/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.3/node_modules/sass/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/sass@1.97.3/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../sass/sass.js" "$@"
@@ -6,12 +6,12 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.44.1/node_modules/terser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.44.1/node_modules/terser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.44.1/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.46.0/node_modules/terser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.46.0/node_modules/terser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.46.0/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.44.1/node_modules/terser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.44.1/node_modules/terser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.44.1/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.46.0/node_modules/terser/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.46.0/node_modules/terser/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/terser@5.46.0/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/terser@5.44.1/node_modules/terser/bin/terser" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/terser@5.46.0/node_modules/terser/bin/terser" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/terser@5.44.1/node_modules/terser/bin/terser" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/terser@5.46.0/node_modules/terser/bin/terser" "$@"
17
17
  fi
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22.19.5_jiti@2.6.1_lightningcss@1.30.1_sass-embedded@1.97.2_sas_49350b20785856445dede0a62779c9d5/node_modules/vite/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22.19.5_jiti@2.6.1_lightningcss@1.30.1_sass-embedded@1.97.2_sas_49350b20785856445dede0a62779c9d5/node_modules/vite/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22.19.5_jiti@2.6.1_lightningcss@1.30.1_sass-embedded@1.97.2_sas_49350b20785856445dede0a62779c9d5/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@6.2.4_@types+node@22.19.7_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.97.3_sass_8b0a8c2ec890dd5cbc7f2dee3cda2529/node_modules/vite/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@6.2.4_@types+node@22.19.7_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.97.3_sass_8b0a8c2ec890dd5cbc7f2dee3cda2529/node_modules/vite/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@6.2.4_@types+node@22.19.7_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.97.3_sass_8b0a8c2ec890dd5cbc7f2dee3cda2529/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22.19.5_jiti@2.6.1_lightningcss@1.30.1_sass-embedded@1.97.2_sas_49350b20785856445dede0a62779c9d5/node_modules/vite/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22.19.5_jiti@2.6.1_lightningcss@1.30.1_sass-embedded@1.97.2_sas_49350b20785856445dede0a62779c9d5/node_modules/vite/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22.19.5_jiti@2.6.1_lightningcss@1.30.1_sass-embedded@1.97.2_sas_49350b20785856445dede0a62779c9d5/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@6.2.4_@types+node@22.19.7_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.97.3_sass_8b0a8c2ec890dd5cbc7f2dee3cda2529/node_modules/vite/bin/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@6.2.4_@types+node@22.19.7_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.97.3_sass_8b0a8c2ec890dd5cbc7f2dee3cda2529/node_modules/vite/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/vite@6.2.4_@types+node@22.19.7_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.97.3_sass_8b0a8c2ec890dd5cbc7f2dee3cda2529/node_modules:/home/runner/work/vite-cli/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
@@ -6,11 +6,9 @@
6
6
  "engines": {
7
7
  "node": ">=20.18.0"
8
8
  },
9
- "packageManager": "pnpm@10.8.0",
10
9
  "scripts": {
11
10
  "dev": "vite",
12
- "submodule:update": "git submodule update --init --recursive --remote",
13
- "postinstall": "pnpm submodule:update",
11
+ "submodule:update": "cd .cursor && git pull && cd .. && git submodule update --init --recursive --remote",
14
12
  "build": "vite build --mode production",
15
13
  "build:zip": "vite build --mode production && tsx scripts/build.mts",
16
14
  "preview": "vite preview",
@@ -49,7 +47,7 @@
49
47
  "tailwindcss": "^4.0.0",
50
48
  "tsx": "^4.20.5",
51
49
  "typescript": "~5.8.0",
52
- "vite": "7.1.11"
50
+ "vite": "6.2.4"
53
51
  },
54
52
  "author": "",
55
53
  "license": "MIT"
@@ -1,29 +1,34 @@
1
1
  /**
2
2
  * 构建后处理脚本
3
- * 打包生成的 dist 目录为 zip 文件
3
+ * 打包生成的构建输出目录为 zip 文件
4
4
  */
5
5
 
6
6
  import path from 'node:path'
7
7
  import process from 'node:process'
8
8
  import compressing from 'compressing'
9
9
  import dotenv from 'dotenv'
10
-
11
- // 加载环境变量
12
- dotenv.config({ path: '.env.production' })
13
-
14
- const appCode = process.env.VITE_APP_CODE || 'app'
15
- const rootPath = path.resolve()
16
- const distPath = path.join(rootPath, 'dist')
17
- const outputPath = path.join(rootPath, `${appCode}.zip`)
10
+ import { resolveConfig } from 'vite'
18
11
 
19
12
  /**
20
13
  * 构建 ZIP 压缩包
21
- * dist 目录压缩为 zip 文件
14
+ * 将构建输出目录压缩为 zip 文件
22
15
  * @returns Promise<void>
23
16
  * @throws {Error} 如果压缩失败
24
17
  */
25
18
  async function buildZip(): Promise<void> {
26
19
  try {
20
+ // 加载环境变量
21
+ dotenv.config({ path: '.env.production' })
22
+
23
+ // 获取 Vite 配置中的输出目录
24
+ const viteConfig = await resolveConfig({}, 'build', 'production')
25
+ const buildoutputDir = viteConfig.build.outDir
26
+
27
+ const appCode = process.env.VITE_APP_CODE
28
+ const rootPath = path.resolve()
29
+ const distPath = path.join(rootPath, buildoutputDir)
30
+ const outputPath = path.join(rootPath, `${appCode}.zip`)
31
+
27
32
  console.log(`📦 Compressing ${distPath} to ${outputPath}...`)
28
33
  await compressing.zip.compressDir(distPath, outputPath)
29
34
  console.log(`✅ Successfully created ${outputPath}`)