@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moluoxixi/create-app",
3
- "version": "2.0.415",
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.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/node_modules"
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.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/node_modules:$NODE_PATH"
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/../../../../../../../node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/vite.js" "$@"
14
+ exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../../../node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/vite.js" "$@"
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.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\bin\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\node_modules"
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.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\bin\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\node_modules;%NODE_PATH%"
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\..\..\..\..\..\..\..\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\bin\vite.js" %*
8
+ "%~dp0\node.exe" "%~dp0\..\vite\bin\vite.js" %*
9
9
  ) ELSE (
10
10
  @SET PATHEXT=%PATHEXT:;.JS;=;%
11
- node "%~dp0\..\..\..\..\..\..\..\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\bin\vite.js" %*
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.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\bin\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules\vite\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b\node_modules;E:\project\template\vite-cli\node_modules\.pnpm\node_modules"
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.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules:/mnt/e/project/template/vite-cli/node_modules/.pnpm/node_modules"
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/../../../../../../../node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/vite.js" $args
26
+ $input | & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
27
27
  } else {
28
- & "$basedir/node$exe" "$basedir/../../../../../../../node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/vite.js" $args
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/../../../../../../../node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/vite.js" $args
34
+ $input | & "node$exe" "$basedir/../vite/bin/vite.js" $args
35
35
  } else {
36
- & "node$exe" "$basedir/../../../../../../../node_modules/.pnpm/vite@7.3.0_@types+node@22.1_7c06d9c6f7b7316383c1af6ed786169b/node_modules/vite/bin/vite.js" $args
36
+ & "node$exe" "$basedir/../vite/bin/vite.js" $args
37
37
  }
38
38
  $ret=$LASTEXITCODE
39
39
  }
@@ -3,6 +3,7 @@
3
3
  "vite-plugin-qiankun": "^1.0.15"
4
4
  },
5
5
  "devDependencies": {
6
+ "vite": "7.1.11",
6
7
  "@moluoxixi/css-module-global-root-plugin": "latest",
7
8
  "@moluoxixi/vite-config": "latest"
8
9
  }
@@ -3,6 +3,7 @@
3
3
  "vite-plugin-qiankun": "^1.0.15"
4
4
  },
5
5
  "devDependencies": {
6
+ "vite": "7.1.11",
6
7
  "@moluoxixi/css-module-global-root-plugin": "latest",
7
8
  "@moluoxixi/vite-config": "latest"
8
9
  }
@@ -4,6 +4,8 @@
4
4
  "radash": "^12.1.0",
5
5
  "vite-plugin-qiankun": "^1.0.15",
6
6
  "vue": "^3.5.13",
7
+ "pinia": "^2.2.7",
8
+ "pinia-plugin-persistedstate": "^3.2.1",
7
9
  "vue-router": "^4.4.5"
8
10
  },
9
11
  "devDependencies": {
@@ -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
+ ]
@@ -0,0 +1,6 @@
1
+ import { createPinia } from 'pinia'
2
+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
3
+
4
+ const store = createPinia()
5
+ store.use(piniaPluginPersistedstate)
6
+ export { store }
@@ -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
+ }
@@ -3,6 +3,8 @@
3
3
  "lodash-es": "^4.17.21",
4
4
  "radash": "^12.1.0",
5
5
  "vite-plugin-qiankun": "^1.0.15",
6
+ "pinia": "^2.2.7",
7
+ "pinia-plugin-persistedstate": "^3.2.1",
6
8
  "vue": "^3.5.13",
7
9
  "vue-router": "^4.4.5"
8
10
  },
@@ -0,0 +1,6 @@
1
+ import { createPinia } from 'pinia'
2
+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
3
+
4
+ const store = createPinia()
5
+ store.use(piniaPluginPersistedstate)
6
+ export { store }
@@ -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