@origen-ui/admin-cli 3.0.5 → 3.0.7

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 (41) hide show
  1. package/package.json +15 -15
  2. package/templates/current/clean/.claude/rules/05-style.md +7 -1
  3. package/templates/current/clean/.codebuddy/rules/05-style.md +7 -1
  4. package/templates/current/clean/.codex/rules/05-style.md +7 -1
  5. package/templates/current/clean/.cursor/rules/05-style.mdc +7 -1
  6. package/templates/current/clean/.qoder/rules/05-style.md +7 -1
  7. package/templates/current/clean/CHANGELOG.md +22 -0
  8. package/templates/current/clean/component-catalog.v2.json +15 -15
  9. package/templates/current/clean/docs/components/index.md +19 -19
  10. package/templates/current/clean/element-plus-plugin.ts +29 -0
  11. package/templates/current/clean/package.json +7 -7
  12. package/templates/current/clean/pnpm-workspace.yaml +3 -12
  13. package/templates/current/clean/scaffold.lock.json +25 -25
  14. package/templates/current/clean/src/app/ui/createAdminUi.ts +1 -0
  15. package/templates/current/clean/src/app/ui/elementPlusApiStyles.ts +3 -0
  16. package/templates/current/clean/src/layouts/BreadcrumbBar.vue +1 -0
  17. package/templates/current/clean/src/layouts/SideMenu.vue +1 -0
  18. package/templates/current/clean/src/layouts/WorkspaceTabs.vue +1 -1
  19. package/templates/current/clean/src/main.ts +1 -0
  20. package/templates/current/clean/tests/e2e/fixtures/adminMockBackend.ts +4 -0
  21. package/templates/current/clean/vite.config.ts +34 -21
  22. package/templates/current/examples/.claude/rules/05-style.md +7 -1
  23. package/templates/current/examples/.codebuddy/rules/05-style.md +7 -1
  24. package/templates/current/examples/.codex/rules/05-style.md +7 -1
  25. package/templates/current/examples/.cursor/rules/05-style.mdc +7 -1
  26. package/templates/current/examples/.qoder/rules/05-style.md +7 -1
  27. package/templates/current/examples/CHANGELOG.md +22 -0
  28. package/templates/current/examples/component-catalog.v2.json +15 -15
  29. package/templates/current/examples/docs/components/index.md +19 -19
  30. package/templates/current/examples/element-plus-plugin.ts +29 -0
  31. package/templates/current/examples/package.json +7 -7
  32. package/templates/current/examples/pnpm-workspace.yaml +3 -12
  33. package/templates/current/examples/scaffold.lock.json +25 -25
  34. package/templates/current/examples/src/app/ui/createAdminUi.ts +1 -0
  35. package/templates/current/examples/src/app/ui/elementPlusApiStyles.ts +3 -0
  36. package/templates/current/examples/src/layouts/BreadcrumbBar.vue +1 -0
  37. package/templates/current/examples/src/layouts/SideMenu.vue +1 -0
  38. package/templates/current/examples/src/layouts/WorkspaceTabs.vue +1 -1
  39. package/templates/current/examples/src/main.ts +1 -0
  40. package/templates/current/examples/tests/e2e/fixtures/adminMockBackend.ts +4 -0
  41. package/templates/current/examples/vite.config.ts +34 -21
@@ -5,12 +5,14 @@ import { fileURLToPath } from 'node:url'
5
5
  import { createSvgIconsPlugin } from '@origen-ui/icons/vite'
6
6
  import vue from '@vitejs/plugin-vue'
7
7
  import vueJsx from '@vitejs/plugin-vue-jsx'
8
- import ElementPlus from 'unplugin-element-plus/vite'
9
8
  import { loadEnv } from 'vite'
10
9
  import { defineConfig } from 'vitest/config'
10
+ import {
11
+ createAdminElementPlusPlugin,
12
+ createAdminElementPlusRolldownPlugin,
13
+ } from './element-plus-plugin.js'
11
14
  import { createMockApiPlugin } from './scripts/mock-api.js'
12
- // This file is copied to the scaffold root, where the shared policy is copied
13
- // with the application source as ./vite.build-policy.ts.
15
+ // 此文件会复制到脚手架项目根目录;构建策略会随应用源码复制为 ./vite.build-policy.ts。
14
16
  import {
15
17
  createAdminBuildOptions,
16
18
  createAdminBuildPlugins,
@@ -18,6 +20,20 @@ import {
18
20
  } from './vite.build-policy.js'
19
21
 
20
22
  const elementPlusPackageRoot = dirname(dirname(fileURLToPath(import.meta.resolve('element-plus'))))
23
+ const origenUiSubpathIncludes = [
24
+ '@origen-ui/dialog/locale',
25
+ '@origen-ui/editor/locale',
26
+ '@origen-ui/form-table/locale',
27
+ '@origen-ui/form/core',
28
+ '@origen-ui/form/locale',
29
+ '@origen-ui/permission/codes',
30
+ '@origen-ui/router/element-plus',
31
+ '@origen-ui/router/tabs',
32
+ '@origen-ui/search/locale',
33
+ '@origen-ui/table/locale',
34
+ '@origen-ui/tabs/locale',
35
+ '@origen-ui/upload/locale',
36
+ ]
21
37
  const elementPlusStyleIncludes = readdirSync(join(elementPlusPackageRoot, 'es/components'), {
22
38
  withFileTypes: true,
23
39
  })
@@ -27,6 +43,11 @@ const elementPlusStyleIncludes = readdirSync(join(elementPlusPackageRoot, 'es/co
27
43
  existsSync(join(elementPlusPackageRoot, 'es/components', entry.name, 'style/index.mjs')),
28
44
  )
29
45
  .map((entry) => `element-plus/es/components/${entry.name}/style/index`)
46
+ // 显式补充子路径和插件生成的样式入口。
47
+ const optimizeDepsIncludes = [
48
+ ...origenUiSubpathIncludes,
49
+ ...elementPlusStyleIncludes,
50
+ ]
30
51
 
31
52
  export default defineConfig(({ command, mode }) => {
32
53
  const loadedEnv = loadEnv(mode, process.cwd(), '')
@@ -50,7 +71,7 @@ export default defineConfig(({ command, mode }) => {
50
71
  }),
51
72
  ...createAdminBuildPlugins(),
52
73
  ...mockPlugins,
53
- ElementPlus({ useSource: true }),
74
+ createAdminElementPlusPlugin(),
54
75
  ],
55
76
  resolve: {
56
77
  alias: {
@@ -58,22 +79,14 @@ export default defineConfig(({ command, mode }) => {
58
79
  },
59
80
  },
60
81
  optimizeDeps: {
61
- // Element Plus injects these entries only after lazy SFCs transform.
62
- // Pre-bundle them up front and keep the dependency set fixed for route loads.
63
- noDiscovery: true,
64
- include: [
65
- '@element-plus/icons-vue',
66
- '@origen-ui/icons',
67
- '@vueuse/core',
68
- 'axios',
69
- 'element-plus',
70
- 'pinia',
71
- 'sortablejs',
72
- 'vue',
73
- 'vue-i18n',
74
- 'vue-router',
75
- ...elementPlusStyleIncludes,
76
- ],
82
+ // 保留自动发现;include 会与扫描结果合并,补齐插件注入和样式入口。
83
+ noDiscovery: false,
84
+ include: optimizeDepsIncludes,
85
+ rolldownOptions: {
86
+ plugins: [
87
+ createAdminElementPlusRolldownPlugin(),
88
+ ],
89
+ },
77
90
  },
78
91
  oxc: {
79
92
  jsx: { runtime: 'automatic', importSource: 'vue' },
@@ -94,7 +107,7 @@ export default defineConfig(({ command, mode }) => {
94
107
  build: createAdminBuildOptions(isDebugBuild),
95
108
  test: {
96
109
  environment: 'jsdom',
97
- // Bound cold package transforms without extending individual test timeouts.
110
+ // 限制冷启动时的并行转换量,不调整单项测试的超时时间。
98
111
  maxWorkers: 2,
99
112
  include: ['tests/unit/**/*.spec.ts'],
100
113
  exclude: ['tests/e2e/**', 'node_modules/**'],