@farris/cli 2.2.5 → 2.3.0
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/lib/commands/add-app.js +6 -0
- package/lib/commands/add-app.js.map +1 -0
- package/lib/commands/add-lib.js +6 -0
- package/lib/commands/add-lib.js.map +1 -0
- package/lib/commands/add-project.js +194 -0
- package/lib/commands/add-project.js.map +1 -0
- package/lib/commands/build-components.js +57 -50
- package/lib/commands/build-components.js.map +1 -1
- package/lib/commands/build-css.js +38 -38
- package/lib/commands/build-css.js.map +1 -1
- package/lib/commands/build-lib.js +30 -25
- package/lib/commands/build-lib.js.map +1 -1
- package/lib/commands/build.js +19 -14
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/create-app-options.js +72 -74
- package/lib/commands/create-app-options.js.map +1 -1
- package/lib/commands/create-app.js +131 -126
- package/lib/commands/create-app.js.map +1 -1
- package/lib/commands/create-options.js +32 -29
- package/lib/commands/create-options.js.map +1 -1
- package/lib/commands/create.js +277 -224
- package/lib/commands/create.js.map +1 -1
- package/lib/commands/dev-serve.js +18 -18
- package/lib/commands/extract-i18n.js +74 -74
- package/lib/commands/extract-i18n.js.map +1 -1
- package/lib/commands/generate/api.js +124 -124
- package/lib/commands/generate/api.js.map +1 -1
- package/lib/commands/generate/common.js +101 -100
- package/lib/commands/generate/common.js.map +1 -1
- package/lib/commands/generate/component.js +156 -156
- package/lib/commands/generate/component.js.map +1 -1
- package/lib/commands/generate/view.js +168 -168
- package/lib/commands/generate/view.js.map +1 -1
- package/lib/commands/preview-serve.js +16 -16
- package/lib/commands/workspace/add-app.js +15 -180
- package/lib/commands/workspace/add-app.js.map +1 -1
- package/lib/commands/workspace/create.js +62 -379
- package/lib/commands/workspace/create.js.map +1 -1
- package/lib/commands/workspace/inspect.js +30 -30
- package/lib/commands/workspace/inspect.js.map +1 -1
- package/lib/commands/workspace/verify.js +38 -38
- package/lib/commands/workspace/verify.js.map +1 -1
- package/lib/common/agents-doc.js +34 -0
- package/lib/common/agents-doc.js.map +1 -0
- package/lib/common/apply-catalog-deps.js +15 -15
- package/lib/common/apply-catalog-deps.js.map +1 -1
- package/lib/common/component-file-name.js +3 -3
- package/lib/common/constant.js +64 -64
- package/lib/common/constant.js.map +1 -1
- package/lib/common/create-app-target.js +46 -46
- package/lib/common/create-app-target.js.map +1 -1
- package/lib/common/generate-app.js +109 -85
- package/lib/common/generate-app.js.map +1 -1
- package/lib/common/get-dependencies.js +9 -9
- package/lib/common/get-farris-config.js +25 -25
- package/lib/common/get-farris-config.js.map +1 -1
- package/lib/common/get-version.js +6 -6
- package/lib/common/get-vite-config.js +106 -106
- package/lib/common/get-vite-config.js.map +1 -1
- package/lib/common/lib-package-exports.js +24 -24
- package/lib/common/lib-package-exports.js.map +1 -1
- package/lib/common/list-lib-components.js +23 -23
- package/lib/common/list-lib-components.js.map +1 -1
- package/lib/common/output.js +164 -94
- package/lib/common/output.js.map +1 -1
- package/lib/common/project-layout.js +143 -0
- package/lib/common/project-layout.js.map +1 -0
- package/lib/common/safety.js +173 -171
- package/lib/common/safety.js.map +1 -1
- package/lib/common/template-manifest.js +14 -16
- package/lib/common/template-manifest.js.map +1 -1
- package/lib/common/template-renderer.js +114 -114
- package/lib/common/template-renderer.js.map +1 -1
- package/lib/common/transaction.js +83 -83
- package/lib/common/transaction.js.map +1 -1
- package/lib/common/verifier.js +194 -150
- package/lib/common/verifier.js.map +1 -1
- package/lib/common/workspace-contract.js +86 -0
- package/lib/common/workspace-contract.js.map +1 -0
- package/lib/config/vite-app.js +13 -13
- package/lib/config/vite-common.js +20 -20
- package/lib/config/vite-common.js.map +1 -1
- package/lib/config/vite-component.js +32 -32
- package/lib/config/vite-component.js.map +1 -1
- package/lib/config/vite-lib.js +26 -26
- package/lib/index.js +234 -205
- package/lib/index.js.map +1 -1
- package/lib/plugins/create-app-package-json.js +24 -0
- package/lib/plugins/create-app-package-json.js.map +1 -0
- package/lib/plugins/create-component-style.js +44 -44
- package/lib/plugins/create-package-json.js +48 -48
- package/lib/plugins/create-package-json.js.map +1 -1
- package/lib/plugins/dts.js +8 -8
- package/lib/plugins/html-system.js +9 -9
- package/lib/plugins/replace.js +17 -17
- package/lib/plugins/systemjs-bundle.js +15 -15
- package/lib/plugins/systemjs-bundle.js.map +1 -1
- package/package.json +53 -52
- package/templates/create/.gitignore.tpl +12 -0
- package/templates/create/.npmrc.tpl +1 -0
- package/templates/create/AGENTS.md +62 -0
- package/templates/create/CLAUDE.md +1 -0
- package/templates/create/README.md +14 -1
- package/templates/create/package.json +11 -3
- package/templates/create/pnpm-workspace.yaml +2 -1
- package/templates/lib/.eslintrc.cjs +15 -0
- package/templates/lib/.gitignore.tpl +3 -0
- package/templates/lib/.prettierrc.json +8 -0
- package/templates/lib/index.html +1 -1
- package/templates/lib/package.json +39 -4
- package/templates/lib/{components → test/components}/button/button.spec.ts +3 -2
- package/templates/lib/test/components/button/button.spec.tsx +11 -0
- package/templates/lib/tsconfig.json +5 -1
- package/templates/lib/vitest.config.ts +1 -1
- package/templates/mobile/.gitignore.tpl +31 -0
- package/templates/mobile/.gitlab-ci.yml +3 -9
- package/templates/mobile/index.html +1 -1
- package/templates/mobile/package.json +14 -10
- package/templates/mobile/src/main.ts +5 -4
- package/templates/mobile/src/router/index.ts +17 -17
- package/templates/mobile/test/src/components/TheButton.spec.ts +15 -0
- package/templates/mobile/test/src/components/TheButton.spec.tsx +15 -0
- package/templates/mobile/tsconfig.json +3 -2
- package/templates/mobile/vitest.config.ts +2 -1
- package/templates/web/.gitignore.tpl +31 -0
- package/templates/web/.gitlab-ci.yml +3 -9
- package/templates/web/index.html +1 -1
- package/templates/web/package.json +14 -10
- package/templates/web/src/locales/index.ts +5 -0
- package/templates/web/src/locales/zh-CN.json +1 -0
- package/templates/web/src/main.ts +5 -2
- package/templates/web/src/router/index.ts +17 -17
- package/templates/web/src/styles/index.css +0 -0
- package/templates/web/src/styles/index.scss +0 -0
- package/templates/web/test/src/components/TheButton.spec.ts +15 -0
- package/templates/web/test/src/components/TheButton.spec.tsx +15 -0
- package/templates/web/tsconfig.json +3 -2
- package/templates/web/vitest.config.ts +2 -1
- package/lib/common/project-package-name.js +0 -5
- package/lib/common/project-package-name.js.map +0 -1
- package/templates/mobile/.changeset/README.md +0 -4
- package/templates/mobile/.changeset/config.json +0 -11
- package/templates/mobile/project.json +0 -4
- package/templates/mobile/src/components/TheButton.spec.ts +0 -8
- package/templates/web/.changeset/README.md +0 -4
- package/templates/web/.changeset/config.json +0 -11
- package/templates/web/project.json +0 -4
- package/templates/web/src/components/TheButton.spec.ts +0 -8
- package/templates/workspace/app/farris.config.mjs +0 -13
- package/templates/workspace/app/index.html +0 -12
- package/templates/workspace/app/package.json +0 -22
- package/templates/workspace/app/src/App.tsx +0 -11
- package/templates/workspace/app/src/main.ts +0 -12
- package/templates/workspace/app/src/router/index.ts +0 -16
- package/templates/workspace/app/src/views/home/composables/use-home.ts +0 -7
- package/templates/workspace/app/src/views/home/home.component.tsx +0 -15
- package/templates/workspace/app/src/views/home/index.ts +0 -4
- package/templates/workspace/app/tsconfig.json +0 -21
- package/templates/workspace/root/README.md +0 -28
- package/templates/workspace/root/package.json +0 -13
- package/templates/workspace/root/pnpm-workspace.yaml +0 -12
- /package/templates/{workspace/app → mobile}/src/locales/index.ts +0 -0
- /package/templates/{workspace/app → mobile}/src/locales/zh-CN.json +0 -0
- /package/templates/{workspace/app → mobile}/src/styles/index.css +0 -0
- /package/templates/{workspace/app → mobile}/src/styles/index.scss +0 -0
|
@@ -1,101 +1,102 @@
|
|
|
1
|
-
import { existsSync,
|
|
2
|
-
import { resolve, join, dirname } from 'node:path';
|
|
3
|
-
import { fail } from '../../common/output.js';
|
|
4
|
-
import { ExitCode } from '../../common/constant.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.replace(/[
|
|
9
|
-
.
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
1
|
+
import { existsSync, statSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve, join, dirname } from 'node:path';
|
|
3
|
+
import { fail } from '../../common/output.js';
|
|
4
|
+
import { ExitCode } from '../../common/constant.js';
|
|
5
|
+
import { findWorkspaceRoot, listProjects } from '../../common/project-layout.js';
|
|
6
|
+
export function toKebabCase(str) {
|
|
7
|
+
return str
|
|
8
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
9
|
+
.replace(/[\s_]+/g, '-')
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.replace(/^-+|-+$/g, '');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 生成器名称必须可安全地映射为文件名和 TypeScript 标识符。
|
|
15
|
+
* 先校验原始输入,避免 toKebabCase 保留路径分隔符后造成目录穿越。
|
|
16
|
+
*/
|
|
17
|
+
export function normalizeGeneratorName(value) {
|
|
18
|
+
const raw = typeof value === 'string' ? value.trim() : '';
|
|
19
|
+
if (!raw) {
|
|
20
|
+
return { valid: false, error: '名称不能为空' };
|
|
21
|
+
}
|
|
22
|
+
if (!/^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/.test(raw)) {
|
|
23
|
+
return {
|
|
24
|
+
valid: false,
|
|
25
|
+
error: '名称仅支持字母、数字和短横线,且不能以短横线开头或结尾'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { valid: true, name: toKebabCase(raw) };
|
|
29
|
+
}
|
|
30
|
+
export function toPascalCase(str) {
|
|
31
|
+
const kebab = toKebabCase(str);
|
|
32
|
+
return kebab
|
|
33
|
+
.split('-')
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
36
|
+
.join('');
|
|
37
|
+
}
|
|
38
|
+
export function toCamelCase(str) {
|
|
39
|
+
const pascal = toPascalCase(str);
|
|
40
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
41
|
+
}
|
|
42
|
+
export function toReadableTitle(str) {
|
|
43
|
+
const kebab = toKebabCase(str);
|
|
44
|
+
return kebab
|
|
45
|
+
.split('-')
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
48
|
+
.join(' ');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 向上查找当前所在应用目录
|
|
52
|
+
*/
|
|
53
|
+
export function findAppContext(startDir = process.cwd()) {
|
|
54
|
+
let current = resolve(startDir);
|
|
55
|
+
while (true) {
|
|
56
|
+
const pkgPath = join(current, 'package.json');
|
|
57
|
+
const srcPath = join(current, 'src');
|
|
58
|
+
if (existsSync(pkgPath) && existsSync(srcPath) && statSync(srcPath).isDirectory()) {
|
|
59
|
+
try {
|
|
60
|
+
const pkgContent = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
61
|
+
// 排除根 workspace 的 package.json (根一般有 pnpm-workspace.yaml 且无 src)
|
|
62
|
+
return {
|
|
63
|
+
appRoot: current,
|
|
64
|
+
srcDir: srcPath,
|
|
65
|
+
pkgJsonPath: pkgPath,
|
|
66
|
+
pkgJson: pkgContent
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// 继续查找
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const parent = dirname(current);
|
|
74
|
+
if (parent === current) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
current = parent;
|
|
78
|
+
}
|
|
79
|
+
// 检查是否在 workspace 根目录执行:容器名与工程清单都来自单一数据源
|
|
80
|
+
const wsRoot = findWorkspaceRoot(startDir);
|
|
81
|
+
if (wsRoot) {
|
|
82
|
+
const projects = listProjects(wsRoot);
|
|
83
|
+
if (projects.length === 1) {
|
|
84
|
+
return findAppContext(join(wsRoot, projects[0].dir));
|
|
85
|
+
}
|
|
86
|
+
if (projects.length > 1) {
|
|
87
|
+
fail({
|
|
88
|
+
command: 'generate',
|
|
89
|
+
error: `当前处于 Workspace 根目录,存在多个工程 (${projects
|
|
90
|
+
.map((project) => project.dir)
|
|
91
|
+
.join(', ')})。请先进入具体工程目录(如 cd ${projects[0].dir})后再执行 generate 命令。`,
|
|
92
|
+
exitCode: ExitCode.GENERAL_ERROR
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
fail({
|
|
97
|
+
command: 'generate',
|
|
98
|
+
error: '未找到合法的前端应用工程目录 (必须包含 package.json 与 src/ 目录)',
|
|
99
|
+
exitCode: ExitCode.GENERAL_ERROR
|
|
100
|
+
});
|
|
101
|
+
}
|
|
101
102
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/commands/generate/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/commands/generate/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEjF,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,WAAW,EAAE;SACb,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,E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B,QAAQ;qBAC1C,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;qBAC7B,IAAI,CAAC,IAAI,CAAC,qBAAqB,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,oBAAoB;gBACrE,QAAQ,EAAE,QAAQ,CAAC,aAAa;aACjC,CAAC,CAAC;SACJ;KACF;IAED,IAAI,CAAC;QACH,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,8CAA8C;QACrD,QAAQ,EAAE,QAAQ,CAAC,aAAa;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { resolve, join } from 'node:path';
|
|
3
|
-
import { findAppContext, normalizeGeneratorName, toPascalCase, toCamelCase } from './common.js';
|
|
4
|
-
import { Transaction } from '../../common/transaction.js';
|
|
5
|
-
import { sendJson, logInfo, fail, setJsonMode, createSpinner } from '../../common/output.js';
|
|
6
|
-
import { ExitCode } from '../../common/constant.js';
|
|
7
|
-
export async function generateComponent(rawName, options = {}) {
|
|
8
|
-
const isJson = !!options.json;
|
|
9
|
-
setJsonMode(isJson);
|
|
10
|
-
if (!rawName) {
|
|
11
|
-
fail({
|
|
12
|
-
command: 'generate.component',
|
|
13
|
-
error: '必须指定组件名称: farris-cli generate component <name>',
|
|
14
|
-
exitCode: ExitCode.GENERAL_ERROR
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const normalizedName = normalizeGeneratorName(rawName);
|
|
18
|
-
if (!normalizedName.valid) {
|
|
19
|
-
fail({
|
|
20
|
-
command: 'generate.component',
|
|
21
|
-
error: `非法的组件名称: ${normalizedName.error}`,
|
|
22
|
-
exitCode: ExitCode.GENERAL_ERROR
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const name = normalizedName.name;
|
|
26
|
-
const pascalName = toPascalCase(name);
|
|
27
|
-
const camelName = toCamelCase(name);
|
|
28
|
-
const withProps = !!options.withProps;
|
|
29
|
-
const style = options.style || 'none';
|
|
30
|
-
const appContext = findAppContext(options.cwd || process.cwd());
|
|
31
|
-
const compDir = join(appContext.srcDir, 'components', name);
|
|
32
|
-
const filesPlanned = [
|
|
33
|
-
join(compDir, 'index.ts'),
|
|
34
|
-
join(compDir, `${name}.component.tsx`)
|
|
35
|
-
];
|
|
36
|
-
if (withProps) {
|
|
37
|
-
filesPlanned.push(join(compDir, `${name}.props.ts`));
|
|
38
|
-
}
|
|
39
|
-
if (style === 'css') {
|
|
40
|
-
filesPlanned.push(join(compDir, `${name}.css`));
|
|
41
|
-
}
|
|
42
|
-
else if (style === 'scss') {
|
|
43
|
-
filesPlanned.push(join(compDir, `${name}.scss`));
|
|
44
|
-
}
|
|
45
|
-
const conflicts = filesPlanned.filter((f) => existsSync(f));
|
|
46
|
-
if (conflicts.length > 0) {
|
|
47
|
-
fail({
|
|
48
|
-
command: 'generate.component',
|
|
49
|
-
error: `组件文件已存在,为保护已有代码已阻断生成: ${conflicts.map((c) => resolve(c)).join(', ')}`,
|
|
50
|
-
exitCode: ExitCode.TARGET_CONFLICT,
|
|
51
|
-
extra: { conflicts }
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const transaction = new Transaction();
|
|
55
|
-
const spinner = createSpinner(`正在生成组件: ${name}...`);
|
|
56
|
-
spinner.start();
|
|
57
|
-
try {
|
|
58
|
-
mkdirSync(compDir, { recursive: true });
|
|
59
|
-
transaction.recordCreatedDir(compDir);
|
|
60
|
-
const filesCreated = [];
|
|
61
|
-
const filesModified = [];
|
|
62
|
-
// 1. 生成样式文件(若启用)
|
|
63
|
-
let styleImport = '';
|
|
64
|
-
if (style === 'css') {
|
|
65
|
-
const cssPath = join(compDir, `${name}.css`);
|
|
66
|
-
transaction.prepareWrite(cssPath);
|
|
67
|
-
writeFileSync(cssPath, `.f-${name} {\n /* 组件自定义样式 */\n}\n`, 'utf-8');
|
|
68
|
-
filesCreated.push(cssPath);
|
|
69
|
-
styleImport = `import './${name}.css';\n`;
|
|
70
|
-
}
|
|
71
|
-
else if (style === 'scss') {
|
|
72
|
-
const scssPath = join(compDir, `${name}.scss`);
|
|
73
|
-
transaction.prepareWrite(scssPath);
|
|
74
|
-
writeFileSync(scssPath, `.f-${name} {\n /* 组件自定义 SCSS 样式 */\n}\n`, 'utf-8');
|
|
75
|
-
filesCreated.push(scssPath);
|
|
76
|
-
styleImport = `import './${name}.scss';\n`;
|
|
77
|
-
// 幂等确保应用 package.json devDependencies 包含 sass catalog
|
|
78
|
-
const pkgPath = appContext.pkgJsonPath;
|
|
79
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
80
|
-
if (!pkg.devDependencies) {
|
|
81
|
-
pkg.devDependencies = {};
|
|
82
|
-
}
|
|
83
|
-
if (!pkg.devDependencies.sass) {
|
|
84
|
-
transaction.prepareWrite(pkgPath);
|
|
85
|
-
pkg.devDependencies.sass = 'catalog:';
|
|
86
|
-
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8');
|
|
87
|
-
filesModified.push(pkgPath);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// 2. 生成 props 文件(若启用)
|
|
91
|
-
if (withProps) {
|
|
92
|
-
const propsPath = join(compDir, `${name}.props.ts`);
|
|
93
|
-
transaction.prepareWrite(propsPath);
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { resolve, join } from 'node:path';
|
|
3
|
+
import { findAppContext, normalizeGeneratorName, toPascalCase, toCamelCase } from './common.js';
|
|
4
|
+
import { Transaction } from '../../common/transaction.js';
|
|
5
|
+
import { sendJson, logInfo, fail, setJsonMode, createSpinner } from '../../common/output.js';
|
|
6
|
+
import { ExitCode } from '../../common/constant.js';
|
|
7
|
+
export async function generateComponent(rawName, options = {}) {
|
|
8
|
+
const isJson = !!options.json;
|
|
9
|
+
setJsonMode(isJson);
|
|
10
|
+
if (!rawName) {
|
|
11
|
+
fail({
|
|
12
|
+
command: 'generate.component',
|
|
13
|
+
error: '必须指定组件名称: farris-cli generate component <name>',
|
|
14
|
+
exitCode: ExitCode.GENERAL_ERROR
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const normalizedName = normalizeGeneratorName(rawName);
|
|
18
|
+
if (!normalizedName.valid) {
|
|
19
|
+
fail({
|
|
20
|
+
command: 'generate.component',
|
|
21
|
+
error: `非法的组件名称: ${normalizedName.error}`,
|
|
22
|
+
exitCode: ExitCode.GENERAL_ERROR
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const name = normalizedName.name;
|
|
26
|
+
const pascalName = toPascalCase(name);
|
|
27
|
+
const camelName = toCamelCase(name);
|
|
28
|
+
const withProps = !!options.withProps;
|
|
29
|
+
const style = options.style || 'none';
|
|
30
|
+
const appContext = findAppContext(options.cwd || process.cwd());
|
|
31
|
+
const compDir = join(appContext.srcDir, 'components', name);
|
|
32
|
+
const filesPlanned = [
|
|
33
|
+
join(compDir, 'index.ts'),
|
|
34
|
+
join(compDir, `${name}.component.tsx`)
|
|
35
|
+
];
|
|
36
|
+
if (withProps) {
|
|
37
|
+
filesPlanned.push(join(compDir, `${name}.props.ts`));
|
|
38
|
+
}
|
|
39
|
+
if (style === 'css') {
|
|
40
|
+
filesPlanned.push(join(compDir, `${name}.css`));
|
|
41
|
+
}
|
|
42
|
+
else if (style === 'scss') {
|
|
43
|
+
filesPlanned.push(join(compDir, `${name}.scss`));
|
|
44
|
+
}
|
|
45
|
+
const conflicts = filesPlanned.filter((f) => existsSync(f));
|
|
46
|
+
if (conflicts.length > 0) {
|
|
47
|
+
fail({
|
|
48
|
+
command: 'generate.component',
|
|
49
|
+
error: `组件文件已存在,为保护已有代码已阻断生成: ${conflicts.map((c) => resolve(c)).join(', ')}`,
|
|
50
|
+
exitCode: ExitCode.TARGET_CONFLICT,
|
|
51
|
+
extra: { conflicts }
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const transaction = new Transaction();
|
|
55
|
+
const spinner = createSpinner(`正在生成组件: ${name}...`);
|
|
56
|
+
spinner.start();
|
|
57
|
+
try {
|
|
58
|
+
mkdirSync(compDir, { recursive: true });
|
|
59
|
+
transaction.recordCreatedDir(compDir);
|
|
60
|
+
const filesCreated = [];
|
|
61
|
+
const filesModified = [];
|
|
62
|
+
// 1. 生成样式文件(若启用)
|
|
63
|
+
let styleImport = '';
|
|
64
|
+
if (style === 'css') {
|
|
65
|
+
const cssPath = join(compDir, `${name}.css`);
|
|
66
|
+
transaction.prepareWrite(cssPath);
|
|
67
|
+
writeFileSync(cssPath, `.f-${name} {\n /* 组件自定义样式 */\n}\n`, 'utf-8');
|
|
68
|
+
filesCreated.push(cssPath);
|
|
69
|
+
styleImport = `import './${name}.css';\n`;
|
|
70
|
+
}
|
|
71
|
+
else if (style === 'scss') {
|
|
72
|
+
const scssPath = join(compDir, `${name}.scss`);
|
|
73
|
+
transaction.prepareWrite(scssPath);
|
|
74
|
+
writeFileSync(scssPath, `.f-${name} {\n /* 组件自定义 SCSS 样式 */\n}\n`, 'utf-8');
|
|
75
|
+
filesCreated.push(scssPath);
|
|
76
|
+
styleImport = `import './${name}.scss';\n`;
|
|
77
|
+
// 幂等确保应用 package.json devDependencies 包含 sass catalog
|
|
78
|
+
const pkgPath = appContext.pkgJsonPath;
|
|
79
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
80
|
+
if (!pkg.devDependencies) {
|
|
81
|
+
pkg.devDependencies = {};
|
|
82
|
+
}
|
|
83
|
+
if (!pkg.devDependencies.sass) {
|
|
84
|
+
transaction.prepareWrite(pkgPath);
|
|
85
|
+
pkg.devDependencies.sass = 'catalog:';
|
|
86
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8');
|
|
87
|
+
filesModified.push(pkgPath);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// 2. 生成 props 文件(若启用)
|
|
91
|
+
if (withProps) {
|
|
92
|
+
const propsPath = join(compDir, `${name}.props.ts`);
|
|
93
|
+
transaction.prepareWrite(propsPath);
|
|
94
94
|
const propsContent = `import type { ExtractPropTypes } from 'vue';
|
|
95
95
|
|
|
96
96
|
export const ${camelName}Props = {
|
|
@@ -98,67 +98,67 @@ export const ${camelName}Props = {
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
export type ${pascalName}Props = ExtractPropTypes<typeof ${camelName}Props>;
|
|
101
|
-
`;
|
|
102
|
-
writeFileSync(propsPath, propsContent, 'utf-8');
|
|
103
|
-
filesCreated.push(propsPath);
|
|
104
|
-
}
|
|
105
|
-
// 3. 生成 component.tsx
|
|
106
|
-
const componentPath = join(compDir, `${name}.component.tsx`);
|
|
107
|
-
transaction.prepareWrite(componentPath);
|
|
108
|
-
let componentContent = `import { defineComponent } from 'vue';\n`;
|
|
109
|
-
if (withProps) {
|
|
110
|
-
componentContent += `import { ${camelName}Props } from './${name}.props';\n`;
|
|
111
|
-
}
|
|
112
|
-
if (styleImport) {
|
|
113
|
-
componentContent += styleImport;
|
|
114
|
-
}
|
|
115
|
-
componentContent += `\nexport default defineComponent({\n name: '${pascalName}',\n`;
|
|
116
|
-
if (withProps) {
|
|
117
|
-
componentContent += ` props: ${camelName}Props,\n`;
|
|
118
|
-
}
|
|
119
|
-
componentContent += ` setup(${withProps ? 'props, { slots }' : '_, { slots }'}) {\n return () => (\n <div class="f-${name}">\n {slots.default ? slots.default() : '${pascalName}'}\n </div>\n );\n }\n});\n`;
|
|
120
|
-
writeFileSync(componentPath, componentContent, 'utf-8');
|
|
121
|
-
filesCreated.push(componentPath);
|
|
122
|
-
// 4. 生成 index.ts
|
|
123
|
-
const indexPath = join(compDir, 'index.ts');
|
|
124
|
-
transaction.prepareWrite(indexPath);
|
|
125
|
-
let indexContent = `import ${pascalName} from './${name}.component';\n\n`;
|
|
126
|
-
if (withProps) {
|
|
127
|
-
indexContent += `export { ${camelName}Props, type ${pascalName}Props } from './${name}.props';\n`;
|
|
128
|
-
}
|
|
129
|
-
indexContent += `export { ${pascalName} };\nexport default ${pascalName};\n`;
|
|
130
|
-
writeFileSync(indexPath, indexContent, 'utf-8');
|
|
131
|
-
filesCreated.push(indexPath);
|
|
132
|
-
transaction.commit();
|
|
133
|
-
spinner.succeed(`组件 ${name} 生成成功!`);
|
|
134
|
-
if (isJson) {
|
|
135
|
-
sendJson({
|
|
136
|
-
command: 'generate.component',
|
|
137
|
-
ok: true,
|
|
138
|
-
componentName: name,
|
|
139
|
-
pascalName,
|
|
140
|
-
compDir,
|
|
141
|
-
withProps,
|
|
142
|
-
style,
|
|
143
|
-
filesCreated,
|
|
144
|
-
filesModified
|
|
145
|
-
});
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
logInfo(`\n✨ 已成功生成组件: src/components/${name}/`);
|
|
149
|
-
filesCreated.forEach((f) => logInfo(` + ${f}`));
|
|
150
|
-
if (filesModified.length > 0) {
|
|
151
|
-
filesModified.forEach((f) => logInfo(` ~ ${f} (更新依赖)`));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
spinner.fail('生成组件失败,正在回滚...');
|
|
156
|
-
transaction.rollback();
|
|
157
|
-
fail({
|
|
158
|
-
command: 'generate.component',
|
|
159
|
-
error: `生成组件失败: ${err.message}`,
|
|
160
|
-
exitCode: ExitCode.GENERAL_ERROR
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
101
|
+
`;
|
|
102
|
+
writeFileSync(propsPath, propsContent, 'utf-8');
|
|
103
|
+
filesCreated.push(propsPath);
|
|
104
|
+
}
|
|
105
|
+
// 3. 生成 component.tsx
|
|
106
|
+
const componentPath = join(compDir, `${name}.component.tsx`);
|
|
107
|
+
transaction.prepareWrite(componentPath);
|
|
108
|
+
let componentContent = `import { defineComponent } from 'vue';\n`;
|
|
109
|
+
if (withProps) {
|
|
110
|
+
componentContent += `import { ${camelName}Props } from './${name}.props';\n`;
|
|
111
|
+
}
|
|
112
|
+
if (styleImport) {
|
|
113
|
+
componentContent += styleImport;
|
|
114
|
+
}
|
|
115
|
+
componentContent += `\nexport default defineComponent({\n name: '${pascalName}',\n`;
|
|
116
|
+
if (withProps) {
|
|
117
|
+
componentContent += ` props: ${camelName}Props,\n`;
|
|
118
|
+
}
|
|
119
|
+
componentContent += ` setup(${withProps ? 'props, { slots }' : '_, { slots }'}) {\n return () => (\n <div class="f-${name}">\n {slots.default ? slots.default() : '${pascalName}'}\n </div>\n );\n }\n});\n`;
|
|
120
|
+
writeFileSync(componentPath, componentContent, 'utf-8');
|
|
121
|
+
filesCreated.push(componentPath);
|
|
122
|
+
// 4. 生成 index.ts
|
|
123
|
+
const indexPath = join(compDir, 'index.ts');
|
|
124
|
+
transaction.prepareWrite(indexPath);
|
|
125
|
+
let indexContent = `import ${pascalName} from './${name}.component';\n\n`;
|
|
126
|
+
if (withProps) {
|
|
127
|
+
indexContent += `export { ${camelName}Props, type ${pascalName}Props } from './${name}.props';\n`;
|
|
128
|
+
}
|
|
129
|
+
indexContent += `export { ${pascalName} };\nexport default ${pascalName};\n`;
|
|
130
|
+
writeFileSync(indexPath, indexContent, 'utf-8');
|
|
131
|
+
filesCreated.push(indexPath);
|
|
132
|
+
transaction.commit();
|
|
133
|
+
spinner.succeed(`组件 ${name} 生成成功!`);
|
|
134
|
+
if (isJson) {
|
|
135
|
+
sendJson({
|
|
136
|
+
command: 'generate.component',
|
|
137
|
+
ok: true,
|
|
138
|
+
componentName: name,
|
|
139
|
+
pascalName,
|
|
140
|
+
compDir,
|
|
141
|
+
withProps,
|
|
142
|
+
style,
|
|
143
|
+
filesCreated,
|
|
144
|
+
filesModified
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
logInfo(`\n✨ 已成功生成组件: src/components/${name}/`);
|
|
149
|
+
filesCreated.forEach((f) => logInfo(` + ${f}`));
|
|
150
|
+
if (filesModified.length > 0) {
|
|
151
|
+
filesModified.forEach((f) => logInfo(` ~ ${f} (更新依赖)`));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
spinner.fail('生成组件失败,正在回滚...');
|
|
156
|
+
transaction.rollback();
|
|
157
|
+
fail({
|
|
158
|
+
command: 'generate.component',
|
|
159
|
+
error: `生成组件失败: ${err.message}`,
|
|
160
|
+
exitCode: ExitCode.GENERAL_ERROR
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
164
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/commands/generate/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,WAAW,EACX,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AASpD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe,EAAE,UAAoC,EAAE;IAC7F,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9B,WAAW,CAAC,MAAM,CAAC,CAAC;IAEpB,IAAI,CAAC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/commands/generate/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,a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