generator-mico-cli 0.2.13 → 0.2.15
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 +1 -1
- package/generators/micro-react/index.js +34 -10
- package/generators/micro-react/templates/.commitlintrc.js +1 -0
- package/generators/micro-react/templates/.cursor/rules/coding-conventions.mdc +1 -1
- package/generators/micro-react/templates/.cursor/rules/development-guide.mdc +1 -1
- package/generators/micro-react/templates/.cursor/rules/layout-app.mdc +2 -5
- package/generators/micro-react/templates/.cursor/rules/project-overview.mdc +2 -2
- package/generators/micro-react/templates/.cursor/rules/theme-system.mdc +10 -12
- package/generators/micro-react/templates/AGENTS.md +2 -2
- package/generators/micro-react/templates/CLAUDE.md +1 -2
- package/generators/micro-react/templates/README.md +2 -2
- package/generators/micro-react/templates/_npmrc +3 -0
- package/generators/micro-react/templates/apps/layout/config/config.dev.ts +15 -0
- package/generators/micro-react/templates/apps/layout/config/config.ts +4 -3
- package/generators/micro-react/templates/apps/layout/docs/common-intl.md +370 -0
- package/generators/micro-react/templates/apps/layout/docs/feature-404/351/241/265/351/235/242.md +2 -2
- package/generators/micro-react/templates/apps/layout/docs/feature-/344/270/273/351/242/230/350/211/262/345/210/207/346/215/242.md +21 -25
- package/generators/micro-react/templates/apps/layout/docs/feature-/345/276/256/345/211/215/347/253/257/346/250/241/345/274/217.md +15 -16
- package/generators/micro-react/templates/apps/layout/docs/feature-/350/217/234/345/215/225/346/235/203/351/231/220/346/216/247/345/210/266.md +1 -1
- package/generators/micro-react/templates/apps/layout/docs/utils-timezone.md +322 -0
- package/generators/micro-react/templates/apps/layout/mock/menus.ts +39 -1
- package/generators/micro-react/templates/apps/layout/package.json +5 -2
- package/generators/micro-react/templates/apps/layout/src/app.tsx +22 -10
- package/generators/micro-react/templates/apps/layout/src/common/auth/index.ts +3 -0
- package/generators/micro-react/templates/apps/layout/src/common/helpers.ts +177 -0
- package/generators/micro-react/templates/apps/layout/src/common/locale.ts +56 -4
- package/generators/micro-react/templates/apps/layout/src/common/menu/parser.ts +84 -5
- package/generators/micro-react/templates/apps/layout/src/common/menu/types.ts +13 -1
- package/generators/micro-react/templates/apps/layout/src/common/request/interceptors.ts +1 -1
- package/generators/micro-react/templates/apps/layout/src/common/request/sso.ts +7 -1
- package/generators/micro-react/templates/apps/layout/src/common/theme.ts +1 -1
- package/generators/micro-react/templates/apps/layout/src/common/upload/oss.ts +2 -3
- package/generators/micro-react/templates/apps/layout/src/components/AppTabs/index.less +8 -2
- package/generators/micro-react/templates/apps/layout/src/components/AppTabs/index.tsx +23 -6
- package/generators/micro-react/templates/apps/layout/src/components/HeaderDropdown/index.tsx +22 -0
- package/generators/micro-react/templates/apps/layout/src/components/IconFont/index.tsx +1 -1
- package/generators/micro-react/templates/apps/layout/src/components/MicroAppLoader/index.tsx +1 -1
- package/generators/micro-react/templates/apps/layout/src/components/RightContent/AvatarDropdown.tsx +388 -0
- package/generators/micro-react/templates/apps/layout/src/components/RightContent/avatar-dropdown.less +35 -0
- package/generators/micro-react/templates/apps/layout/src/components/RightContent/index.ts +2 -0
- package/generators/micro-react/templates/apps/layout/src/constants/index.ts +2 -0
- package/generators/micro-react/templates/apps/layout/src/global.less +3 -6
- package/generators/micro-react/templates/apps/layout/src/layouts/components/header/index.less +3 -1
- package/generators/micro-react/templates/apps/layout/src/layouts/components/header/index.tsx +8 -53
- package/generators/micro-react/templates/apps/layout/src/layouts/components/menu/index.less +3 -1
- package/generators/micro-react/templates/apps/layout/src/layouts/components/menu/index.tsx +4 -4
- package/generators/micro-react/templates/apps/layout/src/layouts/index.less +83 -13
- package/generators/micro-react/templates/apps/layout/src/layouts/index.tsx +40 -25
- package/generators/micro-react/templates/apps/layout/src/locales/en-US.ts +9 -0
- package/generators/micro-react/templates/apps/layout/src/locales/zh-CN.ts +9 -0
- package/generators/micro-react/templates/apps/layout/src/pages/403/index.tsx +2 -1
- package/generators/micro-react/templates/apps/layout/src/pages/404/index.tsx +1 -1
- package/generators/micro-react/templates/apps/layout/src/pages/Home/index.less +3 -0
- package/generators/micro-react/templates/apps/layout/src/pages/User/Login/index.less +1 -1
- package/generators/micro-react/templates/apps/layout/src/pages/User/Login/index.tsx +3 -3
- package/generators/micro-react/templates/apps/layout/src/requestErrorConfig.ts +1 -1
- package/generators/micro-react/templates/apps/layout/src/services/config/index.ts +63 -0
- package/generators/micro-react/templates/apps/layout/src/services/config/type.ts +32 -0
- package/generators/micro-react/templates/apps/layout/src/services/user.ts +23 -1
- package/generators/micro-react/templates/package.json +4 -1
- package/generators/micro-react/templates/packages/common-intl/.turbo/turbo-build.log +13 -0
- package/generators/micro-react/templates/packages/common-intl/README.md +427 -0
- package/generators/micro-react/templates/packages/common-intl/dist/index.d.ts +3 -0
- package/generators/micro-react/templates/packages/common-intl/dist/index.js +4388 -0
- package/generators/micro-react/templates/packages/common-intl/dist/indexedDBUtils.d.ts +13 -0
- package/generators/micro-react/templates/packages/common-intl/dist/intl.d.ts +1022 -0
- package/generators/micro-react/templates/packages/common-intl/dist/utils.d.ts +122 -0
- package/generators/micro-react/templates/packages/common-intl/package.json +34 -0
- package/generators/micro-react/templates/packages/common-intl/src/index.ts +7 -0
- package/generators/micro-react/templates/packages/common-intl/src/indexedDBUtils.ts +51 -0
- package/generators/micro-react/templates/packages/common-intl/src/intl.ts +5709 -0
- package/generators/micro-react/templates/packages/common-intl/src/utils.ts +481 -0
- package/generators/micro-react/templates/packages/common-intl/tsconfig.json +22 -0
- package/generators/micro-react/templates/packages/common-intl/vite.config.ts +25 -0
- package/generators/micro-react/templates/turbo.json +3 -0
- package/generators/subapp-react/index.js +13 -18
- package/generators/subapp-react/templates/homepage/README.md +3 -3
- package/generators/subapp-react/templates/homepage/config/config.dev.ts +8 -7
- package/generators/subapp-react/templates/homepage/config/config.prod.development.ts +2 -3
- package/generators/subapp-react/templates/homepage/config/config.prod.testing.ts +2 -3
- package/generators/subapp-react/templates/homepage/config/config.prod.ts +4 -5
- package/generators/subapp-react/templates/homepage/package.json +3 -2
- package/generators/subapp-react/templates/homepage/src/global.less +3 -3
- package/generators/subapp-react/templates/homepage/src/pages/index.less +2 -2
- package/generators/subapp-react/templates/homepage/src/pages/index.tsx +72 -33
- package/generators/subapp-react/templates/homepage/src/styles/theme.less +1 -1
- package/lib/utils.js +43 -0
- package/package.json +8 -11
- package/generators/micro-react/templates/packages/shared-styles/README.md +0 -124
- package/generators/micro-react/templates/packages/shared-styles/arco-design-mobile-override.less +0 -91
- package/generators/micro-react/templates/packages/shared-styles/arco-override.less +0 -119
- package/generators/micro-react/templates/packages/shared-styles/index.d.ts +0 -44
- package/generators/micro-react/templates/packages/shared-styles/index.less +0 -13
- package/generators/micro-react/templates/packages/shared-styles/package.json +0 -30
- package/generators/micro-react/templates/packages/shared-styles/theme-inject.less +0 -10
- package/generators/micro-react/templates/packages/shared-styles/themes/dark/custom-var.less +0 -290
- package/generators/micro-react/templates/packages/shared-styles/themes/normal/custom-var.less +0 -269
- package/generators/micro-react/templates/packages/shared-styles/variables-only.less +0 -433
- package/generators/micro-react/templates/packages/shared-styles/variables.less +0 -452
package/README.md
CHANGED
|
@@ -9,7 +9,8 @@ const {
|
|
|
9
9
|
collectFiles,
|
|
10
10
|
transformDestPath,
|
|
11
11
|
isTemplateFile,
|
|
12
|
-
|
|
12
|
+
getLatestNpmVersion,
|
|
13
|
+
setupErrorHandlers,
|
|
13
14
|
} = require('../../lib/utils');
|
|
14
15
|
|
|
15
16
|
const IGNORE_LIST = require('./ignore-list.json');
|
|
@@ -28,7 +29,9 @@ module.exports = class extends Generator {
|
|
|
28
29
|
console.error('❌ Error: Current directory is already a monorepo.');
|
|
29
30
|
console.error('');
|
|
30
31
|
console.error(' A pnpm-workspace.yaml file already exists.');
|
|
31
|
-
console.error(
|
|
32
|
+
console.error(
|
|
33
|
+
' Please run this command in an empty directory or specify a new project name.',
|
|
34
|
+
);
|
|
32
35
|
console.error('');
|
|
33
36
|
console.error(' Usage:');
|
|
34
37
|
console.error(' mkdir my-project && cd my-project');
|
|
@@ -51,7 +54,7 @@ module.exports = class extends Generator {
|
|
|
51
54
|
const value = toKebab(input);
|
|
52
55
|
if (!value) return 'Project name is required';
|
|
53
56
|
return true;
|
|
54
|
-
}
|
|
57
|
+
},
|
|
55
58
|
},
|
|
56
59
|
{
|
|
57
60
|
type: 'input',
|
|
@@ -60,16 +63,17 @@ module.exports = class extends Generator {
|
|
|
60
63
|
default: (answers) => `@${toKebab(answers.projectName)}`,
|
|
61
64
|
validate: (input) => {
|
|
62
65
|
if (!input) return 'Package scope is required';
|
|
63
|
-
if (!input.startsWith('@'))
|
|
66
|
+
if (!input.startsWith('@'))
|
|
67
|
+
return 'Package scope must start with @';
|
|
64
68
|
return true;
|
|
65
|
-
}
|
|
69
|
+
},
|
|
66
70
|
},
|
|
67
71
|
{
|
|
68
72
|
type: 'input',
|
|
69
73
|
name: 'author',
|
|
70
74
|
message: 'Author',
|
|
71
|
-
default: 'Your Name <email@example.com>'
|
|
72
|
-
}
|
|
75
|
+
default: 'Your Name <email@example.com>',
|
|
76
|
+
},
|
|
73
77
|
]);
|
|
74
78
|
|
|
75
79
|
this.projectName = toKebab(this.answers.projectName);
|
|
@@ -97,14 +101,34 @@ module.exports = class extends Generator {
|
|
|
97
101
|
process.exit(1);
|
|
98
102
|
}
|
|
99
103
|
|
|
104
|
+
// 在 mico_cli 根目录执行 npm view,以使用该目录 .npmrc 中的 Nexus 认证
|
|
105
|
+
const cliRoot = path.resolve(__dirname, '../..');
|
|
106
|
+
const micoUiVer = getLatestNpmVersion(
|
|
107
|
+
'@mico-platform/ui',
|
|
108
|
+
'1.0.0',
|
|
109
|
+
8000,
|
|
110
|
+
cliRoot,
|
|
111
|
+
);
|
|
112
|
+
const themeVer = getLatestNpmVersion(
|
|
113
|
+
'@mico-platform/theme',
|
|
114
|
+
'1.0.0',
|
|
115
|
+
8000,
|
|
116
|
+
cliRoot,
|
|
117
|
+
);
|
|
100
118
|
const templateData = {
|
|
101
119
|
projectName: this.projectName,
|
|
102
120
|
ProjectName: this.ProjectName,
|
|
103
121
|
packageScope: this.packageScope,
|
|
104
|
-
author: this.author
|
|
122
|
+
author: this.author,
|
|
123
|
+
micoUiVersion: `^${micoUiVer}`,
|
|
124
|
+
themeVersion: `^${themeVer}`,
|
|
105
125
|
};
|
|
106
126
|
|
|
107
|
-
const files = collectFiles(
|
|
127
|
+
const files = collectFiles(
|
|
128
|
+
this.templateDir,
|
|
129
|
+
this.templateDir,
|
|
130
|
+
IGNORE_LIST,
|
|
131
|
+
);
|
|
108
132
|
|
|
109
133
|
if (files.length === 0) {
|
|
110
134
|
console.error('');
|
|
@@ -143,7 +167,7 @@ module.exports = class extends Generator {
|
|
|
143
167
|
this.log('');
|
|
144
168
|
this.log('📦 正在安装依赖...');
|
|
145
169
|
this.spawnCommandSync('pnpm', ['install'], {
|
|
146
|
-
cwd: this.destDir
|
|
170
|
+
cwd: this.destDir,
|
|
147
171
|
});
|
|
148
172
|
}
|
|
149
173
|
|
|
@@ -168,7 +168,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
168
168
|
import { useLocation } from '@umijs/max';
|
|
169
169
|
|
|
170
170
|
// 2. 第三方库
|
|
171
|
-
import { Button, Modal } from '@
|
|
171
|
+
import { Button, Modal } from '@mico-platform/ui';
|
|
172
172
|
import dayjs from 'dayjs';
|
|
173
173
|
|
|
174
174
|
// 3. 项目内部模块(使用 @ 别名)
|
|
@@ -289,6 +289,6 @@ cdn-portal[-env].micoplatform.com/<%= projectName %>/{version}/dist/{app}/
|
|
|
289
289
|
## 相关链接
|
|
290
290
|
|
|
291
291
|
- [UmiJS 文档](https://umijs.org/)
|
|
292
|
-
- [
|
|
292
|
+
- [@mico-platform/ui](hhttps://mico-ui.micoportal-test.com/react/docs/start)
|
|
293
293
|
- [qiankun 文档](https://qiankun.umijs.org/)
|
|
294
294
|
- [Turborepo 文档](https://turbo.build/repo)
|
|
@@ -52,10 +52,7 @@ apps/layout/
|
|
|
52
52
|
├── services/ # API 服务
|
|
53
53
|
├── models/ # Umi Model
|
|
54
54
|
├── locales/ # 国际化
|
|
55
|
-
└── styles/ #
|
|
56
|
-
├── themes/ # 主题变量
|
|
57
|
-
├── variables.less # Less 变量
|
|
58
|
-
└── arco-override.less # Arco 覆盖
|
|
55
|
+
└── styles/ # 主题样式(变量来自 @mico-platform/theme)
|
|
59
56
|
```
|
|
60
57
|
|
|
61
58
|
## 核心模块
|
|
@@ -206,7 +203,7 @@ const { isAuthenticated, user, logout } = useAuth();
|
|
|
206
203
|
### 主题变量引入
|
|
207
204
|
```less
|
|
208
205
|
// 在组件样式中使用
|
|
209
|
-
@import '
|
|
206
|
+
@import '@mico-platform/theme/variables';
|
|
210
207
|
|
|
211
208
|
.my-component {
|
|
212
209
|
background: @color-fill-1;
|
|
@@ -16,7 +16,7 @@ alwaysApply: true
|
|
|
16
16
|
| **Monorepo** | Turborepo + pnpm Workspace |
|
|
17
17
|
| **前端框架** | UmiJS 4 (@umijs/max)、React 18、TypeScript |
|
|
18
18
|
| **微前端** | qiankun |
|
|
19
|
-
| **UI 组件** |
|
|
19
|
+
| **UI 组件** | @mico-platform/ui |
|
|
20
20
|
| **样式方案** | Tailwind CSS + Less + CSS Variables |
|
|
21
21
|
| **代码规范** | ESLint、Stylelint、Husky、Commitlint |
|
|
22
22
|
|
|
@@ -74,7 +74,7 @@ alwaysApply: true
|
|
|
74
74
|
### 3. 主题系统
|
|
75
75
|
- 支持亮色/暗黑主题切换
|
|
76
76
|
- 使用 CSS Variables 实现运行时动态切换
|
|
77
|
-
- `arco-theme` 控制
|
|
77
|
+
- `arco-theme` 控制 @mico-platform/ui 组件
|
|
78
78
|
- `data-theme` 控制自定义样式
|
|
79
79
|
|
|
80
80
|
## 常用命令
|
|
@@ -18,7 +18,7 @@ globs: ["**/themes/**", "**/useTheme**", "**/*.less"]
|
|
|
18
18
|
│ └─────────────────────────────────────────────────────────┘│
|
|
19
19
|
│ ↓ │
|
|
20
20
|
│ ┌─────────────────────────────────────────────────────────┐│
|
|
21
|
-
│ │ body[arco-theme="dark"] →
|
|
21
|
+
│ │ body[arco-theme="dark"] → @mico-platform/ui 组件 ││
|
|
22
22
|
│ │ body[data-theme="dark"] → 自定义 CSS 变量 ││
|
|
23
23
|
│ └─────────────────────────────────────────────────────────┘│
|
|
24
24
|
└─────────────────────────────────────────────────────────────┘
|
|
@@ -28,12 +28,10 @@ globs: ["**/themes/**", "**/useTheme**", "**/*.less"]
|
|
|
28
28
|
|
|
29
29
|
| 文件 | 说明 |
|
|
30
30
|
|------|------|
|
|
31
|
-
| `
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| `packages/shared-styles/themes/dark/custom-var.less` | 暗黑主题变量 |
|
|
36
|
-
| `packages/shared-styles/arco-override.less` | Arco Design 变量覆盖 |
|
|
31
|
+
| `@mico-platform/theme` | **主题包(主应用和子应用共用)** |
|
|
32
|
+
| `@mico-platform/theme` | 主入口,CSS 变量 + Less 变量 |
|
|
33
|
+
| `@mico-platform/theme/variables` | 仅 Less 变量(子应用用) |
|
|
34
|
+
| `@mico-platform/theme/theme-inject` | 子应用独立运行时注入主题 |
|
|
37
35
|
| `apps/layout/src/hooks/useTheme.ts` | 主题管理 Hook |
|
|
38
36
|
| `apps/layout/src/common/theme.ts` | 主题初始化 |
|
|
39
37
|
|
|
@@ -54,7 +52,7 @@ interface UseThemeReturn {
|
|
|
54
52
|
### 使用示例
|
|
55
53
|
```tsx
|
|
56
54
|
import { useTheme } from '@/hooks/useTheme';
|
|
57
|
-
import { IconSun, IconMoon } from '@
|
|
55
|
+
import { IconSun, IconMoon } from '@mico-platform/ui/ic';
|
|
58
56
|
|
|
59
57
|
const ThemeToggle: React.FC = () => {
|
|
60
58
|
const { isDark, toggleTheme } = useTheme();
|
|
@@ -124,7 +122,7 @@ body[data-theme='dark'] {
|
|
|
124
122
|
|
|
125
123
|
## 主要颜色变量
|
|
126
124
|
|
|
127
|
-
>
|
|
125
|
+
> 完整列表见:@mico-platform/theme 包文档
|
|
128
126
|
|
|
129
127
|
| 分类 | 变量 | 说明 |
|
|
130
128
|
|------|------|------|
|
|
@@ -139,7 +137,7 @@ body[data-theme='dark'] {
|
|
|
139
137
|
```typescript
|
|
140
138
|
const applyTheme = (theme: Theme) => {
|
|
141
139
|
if (theme === 'dark') {
|
|
142
|
-
//
|
|
140
|
+
// @mico-platform/ui 暗黑模式(arco-theme)
|
|
143
141
|
document.body.setAttribute('arco-theme', 'dark');
|
|
144
142
|
// 自定义 CSS 变量
|
|
145
143
|
document.body.setAttribute('data-theme', 'dark');
|
|
@@ -178,7 +176,7 @@ const getStoredTheme = (): Theme => {
|
|
|
178
176
|
|
|
179
177
|
```less
|
|
180
178
|
// global.less - 仅导入 Less 变量(不打包 CSS 变量)
|
|
181
|
-
@import '
|
|
179
|
+
@import '@mico-platform/theme/variables';
|
|
182
180
|
```
|
|
183
181
|
|
|
184
182
|
```typescript
|
|
@@ -203,4 +201,4 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
203
201
|
3. **优先 Less 变量**: 使用 Less 变量有编辑器提示和类型检查
|
|
204
202
|
4. **避免硬编码颜色**: 所有颜色都应使用主题变量
|
|
205
203
|
5. **系统跟随**: 未手动设置主题时会跟随系统偏好变化
|
|
206
|
-
6. **子应用共享**: 子应用使用
|
|
204
|
+
6. **子应用共享**: 子应用使用 `@mico-platform/theme` 包复用主题
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- `apps/` 存放业务应用。当前应用:`apps/layout/`(主应用)、`apps/subapp/`(子应用)。
|
|
6
6
|
- 应用源码位于 `apps/<app>/src/`,包含 `pages/`、`layouts/`、`components/`、`common/`、`hooks/`、`styles/` 等目录。
|
|
7
|
-
- `packages/`
|
|
7
|
+
- `packages/` 可存放其他共享包。
|
|
8
8
|
- `scripts/` 包含仓库工具脚本(如 `scripts/dev.js`、`scripts/collect-dist.js`)。
|
|
9
9
|
- `docs/` 存放工作流文档;`CICD/` 包含部署相关资源。
|
|
10
10
|
- `dist/` 是生成的构建产物(收集于仓库根目录)。
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
- **Monorepo**:Turborepo + pnpm Workspace
|
|
15
15
|
- **前端框架**:UmiJS 4 / @umijs/max、React 18、TypeScript
|
|
16
16
|
- **微前端**:qiankun
|
|
17
|
-
- **UI
|
|
17
|
+
- **UI 组件**:@mico-platform/ui
|
|
18
18
|
- **样式方案**:Tailwind CSS + Less
|
|
19
19
|
- **代码规范**:ESLint、Stylelint、Husky、Commitlint
|
|
20
20
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- **Monorepo**: Turborepo + pnpm Workspace
|
|
12
12
|
- **前端框架**: UmiJS 4 (@umijs/max)、React 18、TypeScript
|
|
13
13
|
- **微前端**: qiankun
|
|
14
|
-
- **UI 组件**:
|
|
14
|
+
- **UI 组件**: @mico-platform/ui
|
|
15
15
|
- **样式方案**: Tailwind CSS + Less
|
|
16
16
|
- **代码规范**: ESLint、Stylelint、Husky、Commitlint
|
|
17
17
|
|
|
@@ -62,7 +62,6 @@ apps/ # Workspace 应用目录(微前端子应用)
|
|
|
62
62
|
│ │ └── styles/ # 主题变量与样式覆盖
|
|
63
63
|
│ └── config/ # Umi 配置
|
|
64
64
|
packages/ # 共享包
|
|
65
|
-
├── shared-styles/ # 共享样式
|
|
66
65
|
scripts/ # 构建与开发脚本
|
|
67
66
|
CICD/ # 部署资源
|
|
68
67
|
```
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- **Monorepo**:Turborepo + pnpm Workspace
|
|
8
8
|
- **前端框架**:UmiJS 4 / @umijs/max
|
|
9
9
|
- **微前端**:qiankun
|
|
10
|
-
- **UI
|
|
10
|
+
- **UI 组件**:@mico-platform/ui
|
|
11
11
|
- **样式方案**:Tailwind CSS + Less
|
|
12
12
|
- **代码规范**:ESLint、Stylelint、lint-staged、Husky、Commitlint
|
|
13
13
|
|
|
@@ -33,6 +33,7 @@ pnpm install
|
|
|
33
33
|
| `pnpm build:production` | 构建所有应用(生产环境) |
|
|
34
34
|
| `pnpm lint` | 运行 ESLint + Turborepo lint 校验 |
|
|
35
35
|
| `pnpm lint:fix` | 自动修复 lint 问题 |
|
|
36
|
+
| `pnpm create:umi-app` | 基于 Umi 模板创建新子应用 |
|
|
36
37
|
|
|
37
38
|
> **提示**:也可以使用 `pnpm -C apps/<app-name> dev` 直接启动指定应用,例如 `pnpm -C apps/layout dev`。
|
|
38
39
|
|
|
@@ -55,7 +56,6 @@ mico create subapp-react
|
|
|
55
56
|
├── apps/ # 业务应用目录
|
|
56
57
|
│ └── layout/ # 主应用(qiankun master)
|
|
57
58
|
├── packages/ # 共享包目录
|
|
58
|
-
│ └── shared-styles/ # 共享样式
|
|
59
59
|
├── scripts/ # 构建与开发脚本
|
|
60
60
|
│ ├── dev.js # 交互式启动脚本
|
|
61
61
|
│ ├── collect-dist.js # 构建产物收集
|
|
@@ -20,11 +20,26 @@ const config: ReturnType<typeof defineConfig> = {
|
|
|
20
20
|
appName: '<%= projectName %>',
|
|
21
21
|
apiBaseUrl: '',
|
|
22
22
|
defaultPath: '',
|
|
23
|
+
// 免认证路由(跳过 SSO 登录),支持 /* 前缀匹配
|
|
24
|
+
// noAuthRouteList: ['/*'],
|
|
25
|
+
// 免权限校验路由(跳过菜单权限检查)
|
|
26
|
+
// noPermissionRouteList: ['/task-query/*'],
|
|
27
|
+
// 不显示布局的路由(全屏页面)
|
|
28
|
+
// noLayoutRouteList: ['/task-query/*'],
|
|
29
|
+
// 关闭权限控制(调试用)
|
|
30
|
+
disableAuth: true,
|
|
23
31
|
};
|
|
24
32
|
`,
|
|
25
33
|
},
|
|
26
34
|
],
|
|
27
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @name Monorepo 重定向
|
|
38
|
+
* @description 开发时将 workspace 包指向源码,支持热更新
|
|
39
|
+
* @doc https://umijs.org/docs/api/config#monoreporedirect
|
|
40
|
+
*/
|
|
41
|
+
monorepoRedirect: {},
|
|
42
|
+
|
|
28
43
|
proxy: {
|
|
29
44
|
'/api': {
|
|
30
45
|
// 要代理的地址
|
|
@@ -36,7 +36,7 @@ const config: ReturnType<typeof defineConfig> = {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @name Less 配置
|
|
39
|
-
* @description
|
|
39
|
+
* @description 主题变量由 @mico-platform/theme 提供,在 global.less 中导入
|
|
40
40
|
*/
|
|
41
41
|
lessLoader: {
|
|
42
42
|
modifyVars: {},
|
|
@@ -77,7 +77,7 @@ const config: ReturnType<typeof defineConfig> = {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* @name layout 插件
|
|
80
|
-
* @description 禁用内置 layout,使用自定义
|
|
80
|
+
* @description 禁用内置 layout,使用自定义 @mico-platform/ui 布局
|
|
81
81
|
* @doc https://umijs.org/docs/max/layout-menu
|
|
82
82
|
*/
|
|
83
83
|
layout: false,
|
|
@@ -89,7 +89,8 @@ const config: ReturnType<typeof defineConfig> = {
|
|
|
89
89
|
locale: {
|
|
90
90
|
default: 'zh-CN',
|
|
91
91
|
antd: false,
|
|
92
|
-
|
|
92
|
+
// 禁用浏览器语言自动检测,由运行时 getLocale 统一处理
|
|
93
|
+
baseNavigator: false,
|
|
93
94
|
},
|
|
94
95
|
|
|
95
96
|
/**
|