create-done-coding 0.12.3-alpha.0 → 0.13.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/README.md +2 -2
- package/es/cli.mjs +3 -1
- package/es/index-49fe32cc.js +4718 -0
- package/es/index.mjs +15 -10
- package/package.json +6 -6
- package/types/index.d.ts +96 -10
- package/es/index-b3017a49.js +0 -4384
package/es/index.mjs
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { F as
|
|
2
|
+
import { C as i, F as c, G as d, S as u, f as l, d as C, a as f, b, h as E, e as S, i as j, p as I } from "./index-49fe32cc.js";
|
|
3
3
|
import "@done-coding/cli-utils";
|
|
4
|
+
import "node:crypto";
|
|
4
5
|
import "node:fs";
|
|
6
|
+
import "node:os";
|
|
5
7
|
import "node:path";
|
|
6
8
|
import "@done-coding/cli-template";
|
|
7
9
|
import "@done-coding/cli-git";
|
|
8
10
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
d as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
b as
|
|
17
|
-
|
|
11
|
+
i as CreateTemplateSourceTypeEnum,
|
|
12
|
+
c as FormNameEnum,
|
|
13
|
+
d as GitRemoteRepoAliasNameEnum,
|
|
14
|
+
u as SubcommandEnum,
|
|
15
|
+
l as commandCliInfo,
|
|
16
|
+
C as completeCreateProject,
|
|
17
|
+
f as createAsSubcommand,
|
|
18
|
+
b as createCommandCliInfo,
|
|
19
|
+
E as createHandler,
|
|
20
|
+
S as handler,
|
|
21
|
+
j as injectInfo,
|
|
22
|
+
I as prepareCreateProject
|
|
18
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-done-coding",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "项目创建命令行工具",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"sideEffects": false,
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@done-coding/cli-inject": "0.6.3
|
|
40
|
+
"@done-coding/cli-inject": "0.6.3",
|
|
41
41
|
"@types/node": "^18.0.0",
|
|
42
42
|
"@types/yargs": "^17.0.28",
|
|
43
43
|
"typescript": "^5.8.3",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"vite-plugin-dts": "^3.6.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@done-coding/cli-git": "0.7.3
|
|
49
|
-
"@done-coding/cli-template": "0.
|
|
50
|
-
"@done-coding/cli-utils": "0.
|
|
48
|
+
"@done-coding/cli-git": "0.7.3",
|
|
49
|
+
"@done-coding/cli-template": "0.10.0",
|
|
50
|
+
"@done-coding/cli-utils": "0.10.0"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=18.0.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "ce637a19aaa611dec1ec33a1bb4164d622d05198"
|
|
56
56
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,30 +1,70 @@
|
|
|
1
1
|
import { CliHandlerArgv } from '@done-coding/cli-utils';
|
|
2
2
|
import { CliInfo } from '@done-coding/cli-utils';
|
|
3
3
|
import { CommandModule } from 'yargs';
|
|
4
|
+
import type { HandlerContextInit } from '@done-coding/cli-utils';
|
|
4
5
|
import type { SubCliInfo } from '@done-coding/cli-utils';
|
|
5
6
|
|
|
7
|
+
/** create 包根命令配置 */
|
|
6
8
|
export declare const commandCliInfo: Omit<CliInfo, "usage">;
|
|
7
9
|
|
|
10
|
+
/** 完成创建项目:使用 prepare 阶段草稿和模板参数完成编译、git 初始化与目录落位 */
|
|
11
|
+
export declare const completeCreateProject: (argv: CliHandlerArgv<CreateCompleteOptions>, ctxInit?: HandlerContextInit) => Promise<{
|
|
12
|
+
success: boolean;
|
|
13
|
+
projectPath: string;
|
|
14
|
+
draftId: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
8
18
|
/** 作为子命令创建 */
|
|
9
19
|
export declare const createAsSubcommand: () => CommandModule<{}, {}>;
|
|
10
20
|
|
|
21
|
+
/** create 子命令配置 */
|
|
11
22
|
export declare const createCommandCliInfo: SubCliInfo;
|
|
12
23
|
|
|
24
|
+
/** create complete 入参 */
|
|
25
|
+
export declare interface CreateCompleteOptions extends CreateOptions {
|
|
26
|
+
/** prepare 阶段返回的草稿 ID */
|
|
27
|
+
draftId: string;
|
|
28
|
+
/** 模板预置问题答案 */
|
|
29
|
+
envData?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** create 包配置文件结构 */
|
|
13
33
|
export declare interface CreateConfigJson {
|
|
34
|
+
/** 可选模板列表 */
|
|
14
35
|
templateList: CreateTemplateChoiceItem[];
|
|
15
36
|
}
|
|
16
37
|
|
|
17
|
-
|
|
38
|
+
/** create 命令 handler:交互模式保持原 CLI 流程,非交互模式走 prepare/complete 协议 */
|
|
39
|
+
export declare const createHandler: (argv: CliHandlerArgv<CreateOptions>, ctxInit?: HandlerContextInit) => Promise<{
|
|
40
|
+
status: "need_input";
|
|
41
|
+
draftId: string;
|
|
42
|
+
projectPath: string;
|
|
43
|
+
draftProjectPath: string;
|
|
44
|
+
questions: CreatePrepareQuestion[];
|
|
45
|
+
} | {
|
|
46
|
+
success: boolean;
|
|
47
|
+
projectPath: string;
|
|
48
|
+
draftId: string;
|
|
49
|
+
message: string;
|
|
50
|
+
} | undefined>;
|
|
18
51
|
|
|
52
|
+
/** 创建项目命令参数 */
|
|
19
53
|
export declare interface CreateOptions {
|
|
54
|
+
/** 创建项目的根目录 */
|
|
55
|
+
rootDir?: string;
|
|
20
56
|
/** 项目名称 */
|
|
21
57
|
[FormNameEnum.PROJECT_NAME]?: string;
|
|
22
58
|
/** 是否仅仅(从done-coding系列项目列表中)克隆远程仓库 */
|
|
23
59
|
justCloneFromDoneCoding?: boolean;
|
|
24
|
-
/**
|
|
60
|
+
/** 模板地址,远程 git 地址或本地绝对路径 */
|
|
61
|
+
[FormNameEnum.TEMPLATE_URL]?: string;
|
|
62
|
+
/** 模板仓库地址 @deprecated 使用 templateUrl */
|
|
25
63
|
[FormNameEnum.TEMPLATE_GIT_PATH]?: string;
|
|
26
64
|
/** 模板仓库分支 -- 不传则是默认分支 */
|
|
27
65
|
[FormNameEnum.TEMPLATE_GIT_BRANCH]?: string;
|
|
66
|
+
/** 仓库内模板目录 */
|
|
67
|
+
templateDirectory?: string;
|
|
28
68
|
/** 是否跳过模板编译(不跳过则会在克隆完成后进行模板编译)
|
|
29
69
|
* --
|
|
30
70
|
* 为MCP模式预留 设置为true则不会进行模板编译
|
|
@@ -54,6 +94,27 @@ export declare interface CreateOptions {
|
|
|
54
94
|
[FormNameEnum.GIT_COMMIT_MESSAGE]?: string;
|
|
55
95
|
}
|
|
56
96
|
|
|
97
|
+
/** create prepare 返回的模板预置问题 */
|
|
98
|
+
export declare interface CreatePrepareQuestion {
|
|
99
|
+
key: string;
|
|
100
|
+
label: string;
|
|
101
|
+
initial?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** create prepare 结果 */
|
|
105
|
+
export declare type CreatePrepareResult = {
|
|
106
|
+
status: "ready";
|
|
107
|
+
draftId: string;
|
|
108
|
+
projectPath: string;
|
|
109
|
+
draftProjectPath: string;
|
|
110
|
+
} | {
|
|
111
|
+
status: "need_input";
|
|
112
|
+
draftId: string;
|
|
113
|
+
projectPath: string;
|
|
114
|
+
draftProjectPath: string;
|
|
115
|
+
questions: CreatePrepareQuestion[];
|
|
116
|
+
};
|
|
117
|
+
|
|
57
118
|
/** 创建模板-分支信息 */
|
|
58
119
|
export declare interface CreateTemplateBranchInfo {
|
|
59
120
|
/** 分支名 */
|
|
@@ -66,8 +127,10 @@ export declare interface CreateTemplateBranchInfo {
|
|
|
66
127
|
export declare interface CreateTemplateChoiceItem {
|
|
67
128
|
/** 模板名 */
|
|
68
129
|
name: string;
|
|
69
|
-
/**
|
|
130
|
+
/** 模板 git 仓库地址,远程 git 地址或本地 git 仓库根路径 */
|
|
70
131
|
url?: string;
|
|
132
|
+
/** 仓库内模板目录 */
|
|
133
|
+
directory?: string;
|
|
71
134
|
/** 描述 */
|
|
72
135
|
description?: string;
|
|
73
136
|
/** 目标分支 */
|
|
@@ -76,6 +139,14 @@ export declare interface CreateTemplateChoiceItem {
|
|
|
76
139
|
instances?: string[];
|
|
77
140
|
}
|
|
78
141
|
|
|
142
|
+
/** 创建模板来源类型 */
|
|
143
|
+
export declare enum CreateTemplateSourceTypeEnum {
|
|
144
|
+
/** git 仓库模板 */
|
|
145
|
+
GIT = "git",
|
|
146
|
+
/** 本地目录模板 */
|
|
147
|
+
LOCAL = "local"
|
|
148
|
+
}
|
|
149
|
+
|
|
79
150
|
/** 表单name枚举 */
|
|
80
151
|
export declare enum FormNameEnum {
|
|
81
152
|
/** 项目名称选择 */
|
|
@@ -98,11 +169,9 @@ export declare enum FormNameEnum {
|
|
|
98
169
|
CUSTOM_GIT_URL_INPUT = "customUrl",
|
|
99
170
|
/** git的提交信息 */
|
|
100
171
|
GIT_COMMIT_MESSAGE = "gitCommitMessage",
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* 为mcp拓展所加
|
|
105
|
-
*/
|
|
172
|
+
/** 模板地址 */
|
|
173
|
+
TEMPLATE_URL = "templateUrl",
|
|
174
|
+
/** 模板仓库地址 @deprecated 使用 TEMPLATE_URL */
|
|
106
175
|
TEMPLATE_GIT_PATH = "templateGitPath",
|
|
107
176
|
/** 模板仓库分支 */
|
|
108
177
|
TEMPLATE_GIT_BRANCH = "templateGitBranch"
|
|
@@ -116,11 +185,23 @@ export declare enum GitRemoteRepoAliasNameEnum {
|
|
|
116
185
|
UPSTREAM = "upstream"
|
|
117
186
|
}
|
|
118
187
|
|
|
119
|
-
|
|
188
|
+
/** create 包根 handler */
|
|
189
|
+
export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<any>) => Promise<{
|
|
190
|
+
status: "need_input";
|
|
191
|
+
draftId: string;
|
|
192
|
+
projectPath: string;
|
|
193
|
+
draftProjectPath: string;
|
|
194
|
+
questions: CreatePrepareQuestion[];
|
|
195
|
+
} | {
|
|
196
|
+
success: boolean;
|
|
197
|
+
projectPath: string;
|
|
198
|
+
draftId: string;
|
|
199
|
+
message: string;
|
|
200
|
+
} | undefined>;
|
|
120
201
|
|
|
121
202
|
export declare const injectInfo: {
|
|
122
203
|
"name": "create-done-coding",
|
|
123
|
-
"version": "0.
|
|
204
|
+
"version": "0.13.0",
|
|
124
205
|
"description": "项目创建命令行工具",
|
|
125
206
|
"bin": {
|
|
126
207
|
"create-done-coding": "es/cli.mjs"
|
|
@@ -131,7 +212,12 @@ export declare const injectInfo: {
|
|
|
131
212
|
}
|
|
132
213
|
};
|
|
133
214
|
|
|
215
|
+
/** 准备创建项目:非交互模式下克隆模板、读取模板预置问题并返回草稿信息 */
|
|
216
|
+
export declare const prepareCreateProject: (argv: CliHandlerArgv<CreateOptions>, ctxInit?: HandlerContextInit) => Promise<CreatePrepareResult>;
|
|
217
|
+
|
|
218
|
+
/** create 包子命令枚举 */
|
|
134
219
|
export declare enum SubcommandEnum {
|
|
220
|
+
/** 创建项目命令 */
|
|
135
221
|
CREATE = "create"
|
|
136
222
|
}
|
|
137
223
|
|