generator-mico-cli 0.2.31 → 0.2.32
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 +145 -18
- package/bin/mico.js +76 -0
- package/generators/h5-react/ignore-list.json +1 -0
- package/generators/h5-react/index.js +349 -0
- package/generators/h5-react/meta.json +11 -0
- package/generators/h5-react/templates/.commitlintrc.js +7 -0
- package/generators/h5-react/templates/.cursor/rules/cicd-deploy.mdc +104 -0
- package/generators/h5-react/templates/.cursor/rules/common-intl.mdc +42 -0
- package/generators/h5-react/templates/.cursor/rules/git-hooks.mdc +40 -0
- package/generators/h5-react/templates/.cursor/rules/internal-packages.mdc +46 -0
- package/generators/h5-react/templates/.cursor/rules/monorepo.mdc +64 -0
- package/generators/h5-react/templates/.cursor/rules/package-json.mdc +52 -0
- package/generators/h5-react/templates/.cursor/rules/tailwind-umi.mdc +60 -0
- package/generators/h5-react/templates/.cursor/rules/umi-app.mdc +74 -0
- package/generators/h5-react/templates/.cursor/rules/umi-config.mdc +86 -0
- package/generators/h5-react/templates/.cursor/rules/umi-mock.mdc +80 -0
- package/generators/h5-react/templates/.cursor/rules/workspace-request.mdc +52 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/SKILL.md +213 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/evals/evals.json +23 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/cursor-rule-template.md +60 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-1-scanning.md +102 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-2-context-analysis.md +102 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-3-pattern-extraction.md +105 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-4-module-mapping.md +65 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/phase-5-glossary.md +63 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/DEV_PATTERNS.tpl.md +77 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/GLOSSARY.tpl.md +17 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/MODULE_MAP.tpl.md +45 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/templates/PROJECT_CONTEXT.tpl.md +155 -0
- package/generators/h5-react/templates/.cursor/skills/biz-app-analyzer/references/update-mode.md +116 -0
- package/generators/h5-react/templates/.env.development +5 -0
- package/generators/h5-react/templates/.env.production +5 -0
- package/generators/h5-react/templates/.env.testing +5 -0
- package/generators/h5-react/templates/.husky/commit-msg +2 -0
- package/generators/h5-react/templates/.husky/pre-commit +2 -0
- package/generators/h5-react/templates/.lintstagedrc.js +8 -0
- package/generators/h5-react/templates/.prettierrc.json +7 -0
- package/generators/h5-react/templates/CICD/before_build.sh +76 -0
- package/generators/h5-react/templates/CICD/start_dev.sh +54 -0
- package/generators/h5-react/templates/CICD/start_local.sh +30 -0
- package/generators/h5-react/templates/CICD/start_prod.sh +53 -0
- package/generators/h5-react/templates/CICD/start_test.sh +55 -0
- package/generators/h5-react/templates/CICD/wangsu_fresh_dev.sh +19 -0
- package/generators/h5-react/templates/CICD/wangsu_fresh_prod.sh +19 -0
- package/generators/h5-react/templates/CICD/wangsu_fresh_test.sh +19 -0
- package/generators/h5-react/templates/README.md +301 -0
- package/generators/h5-react/templates/_gitignore +30 -0
- package/generators/h5-react/templates/_npmrc +6 -0
- package/generators/h5-react/templates/apps/.gitkeep +0 -0
- package/generators/h5-react/templates/dev.preset.json +10 -0
- package/generators/h5-react/templates/package.json +56 -0
- package/generators/h5-react/templates/packages/common-intl/README.md +180 -0
- package/generators/h5-react/templates/packages/common-intl/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/common-intl/package.json +31 -0
- package/generators/h5-react/templates/packages/common-intl/src/index.ts +3 -0
- package/generators/h5-react/templates/packages/common-intl/src/intl.ts +100 -0
- package/generators/h5-react/templates/packages/common-intl/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/components/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/components/package.json +32 -0
- package/generators/h5-react/templates/packages/components/src/Layout/ImmersiveHeader.tsx +126 -0
- package/generators/h5-react/templates/packages/components/src/Layout/LayoutFooter.tsx +72 -0
- package/generators/h5-react/templates/packages/components/src/Layout/index.tsx +121 -0
- package/generators/h5-react/templates/packages/components/src/assets/image/back.png +0 -0
- package/generators/h5-react/templates/packages/components/src/index.ts +0 -0
- package/generators/h5-react/templates/packages/components/tsconfig.json +13 -0
- package/generators/h5-react/templates/packages/components/typings.d.ts +1 -0
- package/generators/h5-react/templates/packages/constant/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/constant/package.json +19 -0
- package/generators/h5-react/templates/packages/constant/src/index.ts +0 -0
- package/generators/h5-react/templates/packages/constant/src/member.ts +8 -0
- package/generators/h5-react/templates/packages/constant/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/deeplink/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/deeplink/package.json +18 -0
- package/generators/h5-react/templates/packages/deeplink/src/index.ts +7 -0
- package/generators/h5-react/templates/packages/deeplink/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/domain/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/domain/package.json +18 -0
- package/generators/h5-react/templates/packages/domain/src/index.ts +29 -0
- package/generators/h5-react/templates/packages/domain/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/domain/types.d.ts +11 -0
- package/generators/h5-react/templates/packages/eslint/eslint.config.base.ts +36 -0
- package/generators/h5-react/templates/packages/eslint/eslint.config.react.ts +33 -0
- package/generators/h5-react/templates/packages/eslint/package.json +22 -0
- package/generators/h5-react/templates/packages/js-bridge/eslint.config.ts +17 -0
- package/generators/h5-react/templates/packages/js-bridge/package.json +23 -0
- package/generators/h5-react/templates/packages/js-bridge/src/call.ts +126 -0
- package/generators/h5-react/templates/packages/js-bridge/src/closeH5Page.ts +9 -0
- package/generators/h5-react/templates/packages/js-bridge/src/getUserInfo.ts +96 -0
- package/generators/h5-react/templates/packages/js-bridge/src/index.ts +15 -0
- package/generators/h5-react/templates/packages/js-bridge/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/js-bridge/type.d.ts +24 -0
- package/generators/h5-react/templates/packages/request/axios.d.ts +42 -0
- package/generators/h5-react/templates/packages/request/eslint.config.ts +17 -0
- package/generators/h5-react/templates/packages/request/package.json +22 -0
- package/generators/h5-react/templates/packages/request/src/index.ts +165 -0
- package/generators/h5-react/templates/packages/request/src/interceptors.ts +126 -0
- package/generators/h5-react/templates/packages/request/src/types.ts +101 -0
- package/generators/h5-react/templates/packages/request/src/url-resolver.ts +66 -0
- package/generators/h5-react/templates/packages/request/src/utils.ts +12 -0
- package/generators/h5-react/templates/packages/request/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/request/umi.d.ts +94 -0
- package/generators/h5-react/templates/packages/typescript/package.json +11 -0
- package/generators/h5-react/templates/packages/typescript/tsconfig.base.json +23 -0
- package/generators/h5-react/templates/packages/typescript/tsconfig.react.json +7 -0
- package/generators/h5-react/templates/packages/umi-config/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/umi-config/package.json +31 -0
- package/generators/h5-react/templates/packages/umi-config/src/config.dev.ts +34 -0
- package/generators/h5-react/templates/packages/umi-config/src/config.prod.development.ts +17 -0
- package/generators/h5-react/templates/packages/umi-config/src/config.prod.production.ts +42 -0
- package/generators/h5-react/templates/packages/umi-config/src/config.prod.testing.ts +17 -0
- package/generators/h5-react/templates/packages/umi-config/src/config.prod.ts +56 -0
- package/generators/h5-react/templates/packages/umi-config/src/config.ts +86 -0
- package/generators/h5-react/templates/packages/umi-config/src/index.ts +25 -0
- package/generators/h5-react/templates/packages/umi-config/src/plugins/apply-sentry-plugin.ts +57 -0
- package/generators/h5-react/templates/packages/umi-config/src/type.d.ts +3 -0
- package/generators/h5-react/templates/packages/umi-config/tsconfig.json +3 -0
- package/generators/h5-react/templates/packages/utils/eslint.config.ts +12 -0
- package/generators/h5-react/templates/packages/utils/package.json +27 -0
- package/generators/h5-react/templates/packages/utils/src/date.ts +21 -0
- package/generators/h5-react/templates/packages/utils/src/env.ts +40 -0
- package/generators/h5-react/templates/packages/utils/src/index.ts +3 -0
- package/generators/h5-react/templates/packages/utils/src/md5.ts +17 -0
- package/generators/h5-react/templates/packages/utils/src/mock.ts +83 -0
- package/generators/h5-react/templates/packages/utils/src/number.ts +23 -0
- package/generators/h5-react/templates/packages/utils/src/tailwind.ts +12 -0
- package/generators/h5-react/templates/packages/utils/src/url.ts +19 -0
- package/generators/h5-react/templates/packages/utils/tsconfig.json +9 -0
- package/generators/h5-react/templates/page.config.ts +1 -0
- package/generators/h5-react/templates/pnpm-workspace.yaml +17 -0
- package/generators/h5-react/templates/scripts/collect-dist.js +78 -0
- package/generators/h5-react/templates/scripts/dev-preset.js +265 -0
- package/generators/h5-react/templates/scripts/dev-preset.schema.json +39 -0
- package/generators/h5-react/templates/scripts/dev.js +133 -0
- package/generators/h5-react/templates/scripts/gateway.ts +241 -0
- package/generators/h5-react/templates/turbo.json +86 -0
- package/generators/subapp-h5/ignore-list.json +1 -0
- package/generators/subapp-h5/index.js +424 -0
- package/generators/subapp-h5/meta.json +10 -0
- package/generators/subapp-h5/templates/.env +1 -0
- package/generators/subapp-h5/templates/.stylelintrc.js +22 -0
- package/generators/subapp-h5/templates/config/config.dev.ts +7 -0
- package/generators/subapp-h5/templates/config/config.prod.development.ts +7 -0
- package/generators/subapp-h5/templates/config/config.prod.production.ts +10 -0
- package/generators/subapp-h5/templates/config/config.prod.testing.ts +7 -0
- package/generators/subapp-h5/templates/config/config.prod.ts +7 -0
- package/generators/subapp-h5/templates/config/config.ts +6 -0
- package/generators/subapp-h5/templates/config/routes.ts +13 -0
- package/generators/subapp-h5/templates/eslint.config.ts +12 -0
- package/generators/subapp-h5/templates/mock/user.ts +34 -0
- package/generators/subapp-h5/templates/package.json +42 -0
- package/generators/subapp-h5/templates/src/app.tsx +14 -0
- package/generators/subapp-h5/templates/src/assets/yay.jpg +0 -0
- package/generators/subapp-h5/templates/src/intl.ts +37 -0
- package/generators/subapp-h5/templates/src/layouts/index.tsx +10 -0
- package/generators/subapp-h5/templates/src/pages/index.tsx +22 -0
- package/generators/subapp-h5/templates/src/services/user.ts +38 -0
- package/generators/subapp-h5/templates/tailwind.config.js +16 -0
- package/generators/subapp-h5/templates/tailwind.css +7 -0
- package/generators/subapp-h5/templates/tsconfig.json +3 -0
- package/generators/subapp-h5/templates/typings.d.ts +1 -0
- package/lib/setup-multica-desktop.js +154 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import intl from '@/intl';
|
|
2
|
+
import { fetchUserInfo, type UserResponse } from '@/services/user';
|
|
3
|
+
import Layout from '<%= packageScope %>/components/Layout';
|
|
4
|
+
import { cn } from '<%= packageScope %>/utils/tailwind';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export default function HomePage() {
|
|
8
|
+
const [userInfo, setUserInfo] = useState<UserResponse | null>(null);
|
|
9
|
+
|
|
10
|
+
const loadUserInfo = async () => {
|
|
11
|
+
const res = await fetchUserInfo();
|
|
12
|
+
setUserInfo(res);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Layout immersive={false}>
|
|
17
|
+
<h2 className={cn('text-2xl font-bold text-[16px]')}>app name: <%= appName %></h2>
|
|
18
|
+
<div onClick={loadUserInfo}>{intl.common_hello()}</div>
|
|
19
|
+
<div>{JSON.stringify(userInfo)}</div>
|
|
20
|
+
</Layout>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { request } from '<%= packageScope %>/request';
|
|
2
|
+
|
|
3
|
+
//ts
|
|
4
|
+
export interface UserRequest {
|
|
5
|
+
email: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UserResponse {
|
|
9
|
+
code: number;
|
|
10
|
+
message: string;
|
|
11
|
+
content: UserResponseContent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface UserResponseContent {
|
|
15
|
+
token: UserResponseContentToken;
|
|
16
|
+
thirdProfile: UserResponseContentThirdProfile;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UserResponseContentToken {
|
|
20
|
+
accessToken: string;
|
|
21
|
+
refreshToken: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UserResponseContentThirdProfile {
|
|
25
|
+
name: string;
|
|
26
|
+
email: string;
|
|
27
|
+
phone: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function fetchUserInfo() {
|
|
31
|
+
const res = await request<UserResponse, UserRequest>('/user', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
data: {
|
|
34
|
+
email: 'test@micous.com',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return res;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import safeAreaConfig from "tailwindcss-safe-area"
|
|
2
|
+
|
|
3
|
+
const config = {
|
|
4
|
+
content: [
|
|
5
|
+
"./src/**/*.{js,jsx,ts,tsx,less,css}",
|
|
6
|
+
// 排除 .umi 目录,避免 Tailwind 重建时触发自己的 watch,导致无限循环
|
|
7
|
+
"!./src/.umi/**",
|
|
8
|
+
"!./src/.umi-production/**",
|
|
9
|
+
"./README.md",
|
|
10
|
+
"./docs/**/*.{md,mdx}",
|
|
11
|
+
"../../packages/components/src/**/*.{ts,tsx}",
|
|
12
|
+
],
|
|
13
|
+
plugins: [safeAreaConfig],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default config
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'umi/typings';
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 为 Multica Desktop 写入自托管配置文件 `~/.multica/desktop.json`。
|
|
5
|
+
*
|
|
6
|
+
* 跨平台路径(统一由 os.homedir() 解析):
|
|
7
|
+
* macOS: /Users/<Username>/.multica/desktop.json
|
|
8
|
+
* Linux: /home/<Username>/.multica/desktop.json
|
|
9
|
+
* Windows: C:\Users\<Username>\.multica\desktop.json
|
|
10
|
+
*
|
|
11
|
+
* 参考:
|
|
12
|
+
* https://github.com/multica-ai/multica/blob/main/apps/docs/content/docs/desktop-app.zh.mdx
|
|
13
|
+
* https://github.com/multica-ai/multica/pull/2012
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('node:fs');
|
|
17
|
+
const os = require('node:os');
|
|
18
|
+
const path = require('node:path');
|
|
19
|
+
|
|
20
|
+
const DEFAULT_CONFIG = Object.freeze({
|
|
21
|
+
schemaVersion: 1,
|
|
22
|
+
apiUrl: 'https://multica-api.micoplatform.com',
|
|
23
|
+
appUrl: 'https://multica.micoplatform.com',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 解析配置文件路径。
|
|
28
|
+
* @param {string} [homedir] 可注入的 home 目录(便于测试)
|
|
29
|
+
* @returns {{ home: string, dir: string, file: string }}
|
|
30
|
+
*/
|
|
31
|
+
function resolvePaths(homedir = os.homedir()) {
|
|
32
|
+
if (!homedir) {
|
|
33
|
+
throw new Error('无法解析当前用户的 home 目录(请检查 HOME / USERPROFILE 环境变量)');
|
|
34
|
+
}
|
|
35
|
+
const dir = path.join(homedir, '.multica');
|
|
36
|
+
const file = path.join(dir, 'desktop.json');
|
|
37
|
+
return { home: homedir, dir, file };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 基于默认值与覆盖项构造最终配置对象。
|
|
42
|
+
* @param {{ apiUrl?: string, appUrl?: string, wsUrl?: string }} overrides
|
|
43
|
+
* @returns {{ schemaVersion: 1, apiUrl: string, appUrl: string, wsUrl?: string }}
|
|
44
|
+
*/
|
|
45
|
+
function buildConfig(overrides = {}) {
|
|
46
|
+
const config = { ...DEFAULT_CONFIG };
|
|
47
|
+
if (overrides.apiUrl) config.apiUrl = overrides.apiUrl;
|
|
48
|
+
if (overrides.appUrl) config.appUrl = overrides.appUrl;
|
|
49
|
+
if (overrides.wsUrl) config.wsUrl = overrides.wsUrl;
|
|
50
|
+
return config;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function formatBackupSuffix(date = new Date()) {
|
|
54
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
55
|
+
return [
|
|
56
|
+
date.getFullYear(),
|
|
57
|
+
pad(date.getMonth() + 1),
|
|
58
|
+
pad(date.getDate()),
|
|
59
|
+
pad(date.getHours()),
|
|
60
|
+
pad(date.getMinutes()),
|
|
61
|
+
pad(date.getSeconds()),
|
|
62
|
+
].join('');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 执行 `~/.multica/desktop.json` 的写入流程。
|
|
67
|
+
*
|
|
68
|
+
* @param {object} [options]
|
|
69
|
+
* @param {string} [options.apiUrl] 覆盖默认 apiUrl
|
|
70
|
+
* @param {string} [options.appUrl] 覆盖默认 appUrl
|
|
71
|
+
* @param {string} [options.wsUrl] 显式设置 wsUrl(不传则由 Desktop 自动推导)
|
|
72
|
+
* @param {boolean} [options.dryRun=false] 仅预览,不写盘
|
|
73
|
+
* @param {boolean} [options.force=false] 已存在时不备份直接覆盖
|
|
74
|
+
* @param {boolean} [options.noBackup=false] 不生成 .bak 文件
|
|
75
|
+
* @param {string} [options.homedir] 注入 home 目录(测试用)
|
|
76
|
+
* @param {(msg: string) => void} [options.logger=console.log]
|
|
77
|
+
* @returns {{
|
|
78
|
+
* file: string,
|
|
79
|
+
* dir: string,
|
|
80
|
+
* created: boolean,
|
|
81
|
+
* backedUpTo: string | null,
|
|
82
|
+
* config: object,
|
|
83
|
+
* dryRun: boolean
|
|
84
|
+
* }}
|
|
85
|
+
*/
|
|
86
|
+
function runSetupMulticaDesktop(options = {}) {
|
|
87
|
+
const {
|
|
88
|
+
apiUrl,
|
|
89
|
+
appUrl,
|
|
90
|
+
wsUrl,
|
|
91
|
+
dryRun = false,
|
|
92
|
+
force = false,
|
|
93
|
+
noBackup = false,
|
|
94
|
+
homedir,
|
|
95
|
+
logger = console.log,
|
|
96
|
+
} = options;
|
|
97
|
+
|
|
98
|
+
const { dir, file } = resolvePaths(homedir);
|
|
99
|
+
const config = buildConfig({ apiUrl, appUrl, wsUrl });
|
|
100
|
+
|
|
101
|
+
logger(`平台: ${process.platform} (${os.arch()})`);
|
|
102
|
+
logger(`目标文件: ${file}`);
|
|
103
|
+
|
|
104
|
+
const existed = fs.existsSync(file);
|
|
105
|
+
let backedUpTo = null;
|
|
106
|
+
|
|
107
|
+
if (existed && !force && !noBackup) {
|
|
108
|
+
backedUpTo = `${file}.bak.${formatBackupSuffix()}`;
|
|
109
|
+
if (dryRun) {
|
|
110
|
+
logger(`[dry-run] 备份现有文件 -> ${backedUpTo}`);
|
|
111
|
+
} else {
|
|
112
|
+
fs.copyFileSync(file, backedUpTo);
|
|
113
|
+
logger(`已备份现有文件 -> ${backedUpTo}`);
|
|
114
|
+
}
|
|
115
|
+
} else if (existed && force) {
|
|
116
|
+
logger('检测到现有配置(--force,将直接覆盖且不备份)');
|
|
117
|
+
} else if (existed && noBackup) {
|
|
118
|
+
logger('检测到现有配置(--no-backup,将直接覆盖)');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!fs.existsSync(dir)) {
|
|
122
|
+
if (dryRun) {
|
|
123
|
+
logger(`[dry-run] 创建目录: ${dir}`);
|
|
124
|
+
} else {
|
|
125
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
126
|
+
logger(`已创建目录: ${dir}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const content = `${JSON.stringify(config, null, 2)}\n`;
|
|
131
|
+
if (dryRun) {
|
|
132
|
+
logger(`[dry-run] 将写入 ${file}:\n${content}`);
|
|
133
|
+
} else {
|
|
134
|
+
fs.writeFileSync(file, content, { encoding: 'utf8' });
|
|
135
|
+
logger(`已写入配置: ${file}`);
|
|
136
|
+
logger('完成。请重启 Multica Desktop 让配置生效。');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
file,
|
|
141
|
+
dir,
|
|
142
|
+
created: !existed,
|
|
143
|
+
backedUpTo,
|
|
144
|
+
config,
|
|
145
|
+
dryRun,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = {
|
|
150
|
+
DEFAULT_CONFIG,
|
|
151
|
+
resolvePaths,
|
|
152
|
+
buildConfig,
|
|
153
|
+
runSetupMulticaDesktop,
|
|
154
|
+
};
|