@moluoxixi/create-app 2.0.411 → 2.0.412
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/README.md +4 -16
- package/package.json +1 -1
- package/templates/react/features/pageRoutes/package.json +1 -2
- package/templates/vue/features/manualRoutes/src/router/index.ts +1 -11
- package/templates/vue/features/pageRoutes/package.json +0 -1
- package/templates/vue/features/pageRoutes/src/router/index.ts +1 -11
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/package.json +3 -1
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/router/index.ts +4 -0
- package/templates/vue/micro-frontends/qiankun/features/pageRoutes/package.json +3 -1
- package/templates/vue/micro-frontends/qiankun/features/pageRoutes/src/router/index.ts +4 -0
package/README.md
CHANGED
|
@@ -21,19 +21,12 @@ npm create @moluoxixi/app
|
|
|
21
21
|
- 📦 **多框架支持** - Vue 3、React 18
|
|
22
22
|
- 🎨 **多 UI 库** - Element Plus、Ant Design Vue、Ant Design
|
|
23
23
|
- 📝 **TypeScript** - 全面的类型支持
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- ✅ **路由系统** - Vue Router / React Router DOM,支持手动配置和文件系统路由
|
|
28
|
-
- ✅ **状态管理** - Pinia (Vue) / Zustand (React)
|
|
29
|
-
- ✅ **微前端支持** - Qiankun 集成,开箱即用
|
|
30
|
-
|
|
31
|
-
### 可选功能
|
|
32
|
-
|
|
24
|
+
- 🛣️ **路由系统** - Vue Router / React Router DOM,支持手动配置和文件系统路由
|
|
25
|
+
- 🗄️ **状态管理** - Pinia (Vue) / Zustand (React),根据框架自动启用
|
|
33
26
|
- 🌍 **国际化** - 可选 vue-i18n / i18next 支持
|
|
34
27
|
- 📊 **错误监控** - 可选 Sentry 集成
|
|
35
|
-
- ⚡ **文件系统路由** - 可选 vite-plugin-pages(替代手动路由)
|
|
36
28
|
- 🔧 **规范配置** - 可选 ESLint + Commitlint + Husky
|
|
29
|
+
- 🧩 **微前端支持** - 可选 Qiankun 集成
|
|
37
30
|
|
|
38
31
|
## 📋 开发计划
|
|
39
32
|
|
|
@@ -117,7 +110,7 @@ pnpm commit
|
|
|
117
110
|
| 项目名称 | string | 项目名称,用于 package.json |
|
|
118
111
|
| 框架 | vue / react | 前端框架 |
|
|
119
112
|
| UI 库 | element-plus / ant-design-vue / ant-design | UI 组件库 |
|
|
120
|
-
| 路由模式 |
|
|
113
|
+
| 路由模式 | manualRoutes / pageRoutes | 手动配置或文件系统路由 |
|
|
121
114
|
| 包管理器 | pnpm / npm / yarn | 包管理器 |
|
|
122
115
|
|
|
123
116
|
### 可选功能
|
|
@@ -129,11 +122,6 @@ pnpm commit
|
|
|
129
122
|
| ESLint | boolean | true | 是否启用 ESLint 代码规范检查 |
|
|
130
123
|
| Git Hooks | boolean | true | 是否启用 Husky + Commitlint |
|
|
131
124
|
|
|
132
|
-
### 内置功能(无需配置)
|
|
133
|
-
|
|
134
|
-
- ✅ **路由系统** - 所有项目默认包含
|
|
135
|
-
- ✅ **状态管理** - Vue 使用 Pinia,React 使用 Zustand
|
|
136
|
-
- ✅ **微前端** - Qiankun 支持已内置
|
|
137
125
|
|
|
138
126
|
## 开发
|
|
139
127
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash-es'
|
|
2
|
-
import { assign, isEmpty } from 'radash'
|
|
3
2
|
import { routes } from './routes'
|
|
4
3
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
5
4
|
|
|
@@ -26,19 +25,10 @@ function getRouter() {
|
|
|
26
25
|
const base = import.meta.env.VITE_APP_CODE
|
|
27
26
|
const routesClone = cloneDeep(Routes)
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
return createRouter({
|
|
30
29
|
history: createWebHistory(base),
|
|
31
30
|
routes: routesClone,
|
|
32
31
|
})
|
|
33
|
-
|
|
34
|
-
router.beforeEach((_, from, next) => {
|
|
35
|
-
if (isEmpty(history.state.current)) {
|
|
36
|
-
assign(history.state, { current: from.fullPath })
|
|
37
|
-
}
|
|
38
|
-
next()
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
return router
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
export default getRouter
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash-es'
|
|
2
|
-
import { assign, isEmpty } from 'radash'
|
|
3
2
|
import routes from '~pages'
|
|
4
3
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
5
4
|
|
|
@@ -27,19 +26,10 @@ function getRouter() {
|
|
|
27
26
|
const base = import.meta.env.VITE_APP_CODE
|
|
28
27
|
const routesClone = cloneDeep(Routes)
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
return createRouter({
|
|
31
30
|
history: createWebHistory(base),
|
|
32
31
|
routes: routesClone,
|
|
33
32
|
})
|
|
34
|
-
|
|
35
|
-
router.beforeEach((_, from, next) => {
|
|
36
|
-
if (isEmpty(history.state.current)) {
|
|
37
|
-
assign(history.state, { current: from.fullPath })
|
|
38
|
-
}
|
|
39
|
-
next()
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
return router
|
|
43
33
|
}
|
|
44
34
|
|
|
45
35
|
export default getRouter
|
|
@@ -43,6 +43,10 @@ function getRouter(props: any = {}) {
|
|
|
43
43
|
routes: routesClone,
|
|
44
44
|
})
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* 微前端环境下,解决vue-router大版本路由不兼容问题
|
|
48
|
+
* @issue https://github.com/umijs/qiankun/issues/2254
|
|
49
|
+
*/
|
|
46
50
|
router.beforeEach((_, from, next) => {
|
|
47
51
|
if (isEmpty(history.state.current)) {
|
|
48
52
|
assign(history.state, { current: from.fullPath })
|
|
@@ -44,6 +44,10 @@ function getRouter(props: any = {}) {
|
|
|
44
44
|
routes: routesClone,
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* 微前端环境下,解决vue-router大版本路由不兼容问题
|
|
49
|
+
* @issue https://github.com/umijs/qiankun/issues/2254
|
|
50
|
+
*/
|
|
47
51
|
router.beforeEach((_, from, next) => {
|
|
48
52
|
if (isEmpty(history.state.current)) {
|
|
49
53
|
assign(history.state, { current: from.fullPath })
|