@moluoxixi/create-app 2.0.415 → 2.0.418
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/package.json +3 -2
- package/templates/common/base/.gitignore +42 -0
- package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/vite +4 -4
- package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/vite.CMD +4 -4
- package/templates/react/micro-frontends/qiankun/base/node_modules/.bin/vite.ps1 +6 -6
- package/templates/react/micro-frontends/qiankun/base/package.json +1 -0
- package/templates/vue/micro-frontends/qiankun/base/package.json +1 -0
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/package.json +2 -0
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/router/layout.vue +15 -0
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/router/routes.ts +26 -0
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/stores/index.ts +6 -0
- package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/stores/modules/system.ts +51 -0
- package/templates/vue/micro-frontends/qiankun/features/pageRoutes/package.json +2 -0
- package/templates/vue/micro-frontends/qiankun/features/pageRoutes/src/stores/index.ts +6 -0
- package/templates/vue/micro-frontends/qiankun/features/pageRoutes/src/stores/modules/system.ts +51 -0
- package/templates/vue/features/manualRoutes/src/layouts/index.ts +0 -26
- package/templates/vue/features/pageRoutes/src/layouts/index.ts +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moluoxixi/create-app",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.418",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Create Vue/React projects with atomic layered architecture",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"LICENSE.txt",
|
|
12
12
|
"README.md",
|
|
13
13
|
"dist",
|
|
14
|
-
"templates"
|
|
14
|
+
"templates",
|
|
15
|
+
"templates/**/.gitignore"
|
|
15
16
|
],
|
|
16
17
|
"lint-staged": {
|
|
17
18
|
"*.{js,jsx,ts,tsx}": [
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# user
|
|
2
|
+
typings
|
|
3
|
+
|
|
4
|
+
# Logs
|
|
5
|
+
logs
|
|
6
|
+
*.log
|
|
7
|
+
npm-debug.log*
|
|
8
|
+
yarn-debug.log*
|
|
9
|
+
yarn-error.log*
|
|
10
|
+
pnpm-debug.log*
|
|
11
|
+
lerna-debug.log*
|
|
12
|
+
|
|
13
|
+
node_modules
|
|
14
|
+
dist
|
|
15
|
+
*.local
|
|
16
|
+
test
|
|
17
|
+
test.zip
|
|
18
|
+
.DS_Store
|
|
19
|
+
|
|
20
|
+
# Editor directories and files
|
|
21
|
+
.idea
|
|
22
|
+
*.suo
|
|
23
|
+
*.ntvs*
|
|
24
|
+
*.njsproj
|
|
25
|
+
*.sln
|
|
26
|
+
*.sw?
|
|
27
|
+
|
|
28
|
+
# 系统文件
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# 测试覆盖率
|
|
32
|
+
coverage
|
|
33
|
+
|
|
34
|
+
# 环境变量
|
|
35
|
+
.env.local
|
|
36
|
+
.env.*.local
|
|
37
|
+
|
|
38
|
+
# 缓存
|
|
39
|
+
.cache
|
|
40
|
+
.temp
|
|
41
|
+
*.tsbuildinfo
|
|
42
|
+
|
|
@@ -6,12 +6,12 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.
|
|
9
|
+
export NODE_PATH="/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules/vite/bin/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules/vite/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.
|
|
11
|
+
export NODE_PATH="/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules/vite/bin/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules/vite/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir
|
|
14
|
+
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir
|
|
16
|
+
exec node "$basedir/../vite/bin/vite.js" "$@"
|
|
17
17
|
fi
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
@SETLOCAL
|
|
2
2
|
@IF NOT DEFINED NODE_PATH (
|
|
3
|
-
@SET "NODE_PATH=E:\project\template\vite-cli\node_modules\.pnpm\vite@7.
|
|
3
|
+
@SET "NODE_PATH=E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules\vite\bin\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules\vite\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\node_modules"
|
|
4
4
|
) ELSE (
|
|
5
|
-
@SET "NODE_PATH=E:\project\template\vite-cli\node_modules\.pnpm\vite@7.
|
|
5
|
+
@SET "NODE_PATH=E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules\vite\bin\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules\vite\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
6
|
)
|
|
7
7
|
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
-
"%~dp0\node.exe" "%~dp0
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\vite\bin\vite.js" %*
|
|
9
9
|
) ELSE (
|
|
10
10
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
-
node "%~dp0
|
|
11
|
+
node "%~dp0\..\vite\bin\vite.js" %*
|
|
12
12
|
)
|
|
@@ -4,14 +4,14 @@ $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
|
4
4
|
$exe=""
|
|
5
5
|
$pathsep=":"
|
|
6
6
|
$env_node_path=$env:NODE_PATH
|
|
7
|
-
$new_node_path="E:\project\template\vite-cli\node_modules\.pnpm\vite@7.
|
|
7
|
+
$new_node_path="E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules\vite\bin\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules\vite\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\node_modules"
|
|
8
8
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
9
|
# Fix case when both the Windows and Linux builds of Node
|
|
10
10
|
# are installed in the same directory
|
|
11
11
|
$exe=".exe"
|
|
12
12
|
$pathsep=";"
|
|
13
13
|
} else {
|
|
14
|
-
$new_node_path="/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.
|
|
14
|
+
$new_node_path="/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules/vite/bin/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules/vite/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.1.11_@types+node@22._a442b9e867f9e314d66f8a1e734ad862/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/node_modules"
|
|
15
15
|
}
|
|
16
16
|
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
17
|
$env:NODE_PATH=$new_node_path
|
|
@@ -23,17 +23,17 @@ $ret=0
|
|
|
23
23
|
if (Test-Path "$basedir/node$exe") {
|
|
24
24
|
# Support pipeline input
|
|
25
25
|
if ($MyInvocation.ExpectingInput) {
|
|
26
|
-
$input | & "$basedir/node$exe" "$basedir
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
27
27
|
} else {
|
|
28
|
-
& "$basedir/node$exe" "$basedir
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
29
29
|
}
|
|
30
30
|
$ret=$LASTEXITCODE
|
|
31
31
|
} else {
|
|
32
32
|
# Support pipeline input
|
|
33
33
|
if ($MyInvocation.ExpectingInput) {
|
|
34
|
-
$input | & "node$exe" "$basedir
|
|
34
|
+
$input | & "node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
35
35
|
} else {
|
|
36
|
-
& "node$exe" "$basedir
|
|
36
|
+
& "node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
37
37
|
}
|
|
38
38
|
$ret=$LASTEXITCODE
|
|
39
39
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="layout" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import layouts from '@/layouts'
|
|
8
|
+
import { useSystemStore } from '@/stores/modules/system'
|
|
9
|
+
|
|
10
|
+
const systemInfo = useSystemStore()
|
|
11
|
+
const layoutType = computed(() => systemInfo.layout)
|
|
12
|
+
const layout = computed(() => layouts[layoutType.value])
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 路由配置
|
|
3
|
+
* 手动配置路由表
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 路由配置数组
|
|
8
|
+
*/
|
|
9
|
+
export const routes = [
|
|
10
|
+
{
|
|
11
|
+
path: '/home',
|
|
12
|
+
name: 'Home',
|
|
13
|
+
component: () => import('@/pages/home/index.vue'),
|
|
14
|
+
meta: {
|
|
15
|
+
title: '首页',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
path: '/about',
|
|
20
|
+
name: 'About',
|
|
21
|
+
component: () => import('@/pages/about/index.vue'),
|
|
22
|
+
meta: {
|
|
23
|
+
title: '关于',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
]
|
package/templates/vue/micro-frontends/qiankun/features/manualRoutes/src/stores/modules/system.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
}
|
package/templates/vue/micro-frontends/qiankun/features/pageRoutes/src/stores/modules/system.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 布局组件导出
|
|
3
|
-
* 注意:具体的布局组件在对应的 UI 库 feature 中
|
|
4
|
-
*/
|
|
5
|
-
import type { App, Component } from 'vue'
|
|
6
|
-
|
|
7
|
-
const layoutFiles = import.meta.glob('./*.vue', { eager: true, import: 'default' })
|
|
8
|
-
const layouts = Object.keys(layoutFiles).reduce((modules, modulePath) => {
|
|
9
|
-
const nameArr: string[] = modulePath.split('/')
|
|
10
|
-
const name: string | undefined
|
|
11
|
-
= nameArr.at(-1) === 'index.vue' ? nameArr.at(-2) : nameArr.at(-1)?.slice(0, -4)
|
|
12
|
-
const layout: Component = layoutFiles[modulePath] as Component
|
|
13
|
-
if (!layout)
|
|
14
|
-
return modules
|
|
15
|
-
if (name) {
|
|
16
|
-
modules[name!] = layout as Component
|
|
17
|
-
}
|
|
18
|
-
return modules
|
|
19
|
-
}, {} as any)
|
|
20
|
-
layouts.install = function (app: App) {
|
|
21
|
-
const layoutNames = Object.keys(layouts)
|
|
22
|
-
layoutNames.forEach((name) => {
|
|
23
|
-
app.component(name, layouts[name!])
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
export default layouts
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 布局组件导出
|
|
3
|
-
* 注意:具体的布局组件在对应的 UI 库 feature 中
|
|
4
|
-
*/
|
|
5
|
-
import type { App, Component } from 'vue'
|
|
6
|
-
|
|
7
|
-
const layoutFiles = import.meta.glob('./*.vue', { eager: true, import: 'default' })
|
|
8
|
-
const layouts = Object.keys(layoutFiles).reduce((modules, modulePath) => {
|
|
9
|
-
const nameArr: string[] = modulePath.split('/')
|
|
10
|
-
const name: string | undefined
|
|
11
|
-
= nameArr.at(-1) === 'index.vue' ? nameArr.at(-2) : nameArr.at(-1)?.slice(0, -4)
|
|
12
|
-
const layout: Component = layoutFiles[modulePath] as Component
|
|
13
|
-
if (!layout)
|
|
14
|
-
return modules
|
|
15
|
-
if (name) {
|
|
16
|
-
modules[name!] = layout as Component
|
|
17
|
-
}
|
|
18
|
-
return modules
|
|
19
|
-
}, {} as any)
|
|
20
|
-
layouts.install = function (app: App) {
|
|
21
|
-
const layoutNames = Object.keys(layouts)
|
|
22
|
-
layoutNames.forEach((name) => {
|
|
23
|
-
app.component(name, layouts[name!])
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
export default layouts
|