@done-coding/cli-utils 0.8.1 → 0.8.2-alpha.1
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/es/index.mjs +605 -327
- package/package.json +3 -5
- package/types/index.d.ts +228 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/cli-utils",
|
|
3
|
-
"version": "0.8.1",
|
|
3
|
+
"version": "0.8.2-alpha.1",
|
|
4
4
|
"description": "cli utils",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -47,10 +47,9 @@
|
|
|
47
47
|
"@types/pinyin": "^2.10.0",
|
|
48
48
|
"@types/prompts": "^2.4.6",
|
|
49
49
|
"@types/semver": "^7.5.3",
|
|
50
|
-
"@types/uuid": "^10.0.0",
|
|
51
50
|
"@types/yargs": "^17.0.28",
|
|
52
51
|
"rimraf": "^6.0.1",
|
|
53
|
-
"typescript": "^5.
|
|
52
|
+
"typescript": "^5.8.3",
|
|
54
53
|
"vite": "^4.4.11",
|
|
55
54
|
"vite-plugin-dts": "^3.6.0"
|
|
56
55
|
},
|
|
@@ -67,8 +66,7 @@
|
|
|
67
66
|
"pinyin": "^2.11.2",
|
|
68
67
|
"prompts": "^2.4.2",
|
|
69
68
|
"semver": "^7.5.4",
|
|
70
|
-
"uuid": "^11.1.0",
|
|
71
69
|
"yargs": "^17.7.2"
|
|
72
70
|
},
|
|
73
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "660e39fc523e4eba1ea621e3c59122f98015a2de"
|
|
74
72
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import type { CommandModule } from 'yargs';
|
|
3
3
|
import _curry from 'lodash.curry';
|
|
4
|
+
import { ExecSyncOptions } from 'node:child_process';
|
|
5
|
+
import fs from 'node:fs';
|
|
4
6
|
import _get from 'lodash.get';
|
|
5
7
|
import json5 from 'json5';
|
|
6
8
|
import { Answers as PromptAnswers } from 'prompts';
|
|
@@ -14,7 +16,7 @@ import prompts from 'prompts';
|
|
|
14
16
|
import { PromptType } from 'prompts';
|
|
15
17
|
import { ValueOrFunc as PromptValueOrFunc } from 'prompts';
|
|
16
18
|
import _set from 'lodash.set';
|
|
17
|
-
import {
|
|
19
|
+
import type { WriteStream } from 'node:fs';
|
|
18
20
|
import yargs from 'yargs';
|
|
19
21
|
import type { Argv as YargsArgv } from 'yargs';
|
|
20
22
|
import type { Options as YargsOptions } from 'yargs';
|
|
@@ -30,10 +32,13 @@ export declare const addHuskyHooks: <H extends string>({ hookNames, rootDir, get
|
|
|
30
32
|
|
|
31
33
|
/** 添加package.json配置 */
|
|
32
34
|
export declare const addPackageConfig: ({ patchConfig, rootDir, }: {
|
|
33
|
-
patchConfig?: Record<string, any
|
|
35
|
+
patchConfig?: Record<string, any>;
|
|
34
36
|
rootDir: string;
|
|
35
37
|
}) => void;
|
|
36
38
|
|
|
39
|
+
/** 允许输出日志到控制台 */
|
|
40
|
+
export declare const allowConsoleLog: () => boolean;
|
|
41
|
+
|
|
37
42
|
/**
|
|
38
43
|
* 申请使用临时目录
|
|
39
44
|
* ---
|
|
@@ -43,15 +48,17 @@ export declare const applyUseTempDir: <T>({ dir, fn, endClear, exitClear, }: {
|
|
|
43
48
|
dir: string;
|
|
44
49
|
fn: (dir: string) => T;
|
|
45
50
|
/** 结束时移除临时目录 */
|
|
46
|
-
endClear?: boolean
|
|
51
|
+
endClear?: boolean;
|
|
47
52
|
/** 退出信号是否移除临时目录 */
|
|
48
|
-
exitClear?: boolean
|
|
53
|
+
exitClear?: boolean;
|
|
49
54
|
}) => T;
|
|
50
55
|
|
|
51
56
|
export { ArgumentsCamelCase }
|
|
52
57
|
|
|
53
58
|
/** 文件或文件夹是否存在(同步) */
|
|
54
|
-
export declare const assetIsExits: (
|
|
59
|
+
export declare const assetIsExits: (
|
|
60
|
+
/** 资源路径 */
|
|
61
|
+
assetPath: string) => boolean;
|
|
55
62
|
|
|
56
63
|
/**
|
|
57
64
|
* 检查路径是否存在(包括文件、目录、符号链接)
|
|
@@ -121,6 +128,9 @@ export declare function decryptAES({ encryptedText, secretKey, }: {
|
|
|
121
128
|
secretKey: string;
|
|
122
129
|
}): string;
|
|
123
130
|
|
|
131
|
+
/** done-coding 全局环境配置symbol */
|
|
132
|
+
declare const DONE_CONFIG_ENV_CONFIG_GLOBAL_SYMBOL: unique symbol;
|
|
133
|
+
|
|
124
134
|
/** done-coding-cli 全局配置 */
|
|
125
135
|
export declare type DoneCodingCliGlobalConfig = {
|
|
126
136
|
[K in DoneCodingCliGlobalConfigKeyEnum]: string;
|
|
@@ -153,11 +163,97 @@ export declare function encryptAES({ text, secretKey, }: {
|
|
|
153
163
|
secretKey: string;
|
|
154
164
|
}): string;
|
|
155
165
|
|
|
166
|
+
/**
|
|
167
|
+
* 环境配置
|
|
168
|
+
* ----
|
|
169
|
+
* !!! 不应包含token等敏感信息, 只作为通过环境变量标识及相关 如标记mcp调用场景及相关日志行为等
|
|
170
|
+
* ----
|
|
171
|
+
* !!! 不作为主要的通信方式
|
|
172
|
+
*/
|
|
173
|
+
export declare interface EnvConfig {
|
|
174
|
+
/** 调用模式 */
|
|
175
|
+
callMode: EnvConfigCallModeEnum;
|
|
176
|
+
/** 系列
|
|
177
|
+
* ----
|
|
178
|
+
* 规划的系列 会有 cli 、server等
|
|
179
|
+
* 默认会是 `${DONE_CODING_SERIES_DEFAULT}`
|
|
180
|
+
*/
|
|
181
|
+
series: string;
|
|
182
|
+
/** 是否允许日志输出到控制台 */
|
|
183
|
+
consoleLog: boolean;
|
|
184
|
+
/** 日志输出路径 */
|
|
185
|
+
logOutputDir: string;
|
|
186
|
+
/**
|
|
187
|
+
* 进程日志文件名列表
|
|
188
|
+
* ----
|
|
189
|
+
* 新进程的日志从左侧进栈
|
|
190
|
+
*/
|
|
191
|
+
processLogFileNameList: string[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** 环境配置 - 调用模式枚举 */
|
|
195
|
+
export declare enum EnvConfigCallModeEnum {
|
|
196
|
+
DEFAULT = "DEFAULT",
|
|
197
|
+
MCP = "MCP"
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* 环境配置 在进程中 key的初始值枚举
|
|
202
|
+
*/
|
|
203
|
+
export declare enum EnvConfigProcessKeyEnum {
|
|
204
|
+
/**
|
|
205
|
+
* 全局配置镜像
|
|
206
|
+
*/
|
|
207
|
+
GLOBAL_CONFIG_IMAGE = "GLOBAL_CONFIG_IMAGE"
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 工业级同步执行分发日志 (2026 稳定版)
|
|
212
|
+
*/
|
|
213
|
+
export declare const execSyncWithLogDispatch: (command: string, options?: ExecSyncOptions) => string | Buffer;
|
|
214
|
+
|
|
156
215
|
/** 文件添加执行权限 */
|
|
157
216
|
export declare const fileAddX: (filePath: string) => void;
|
|
158
217
|
|
|
218
|
+
/** 格式化日志流写入格式 */
|
|
219
|
+
export declare const formatLogSteamWrite: ({ stream, type, content, }: {
|
|
220
|
+
/** 流类型 */
|
|
221
|
+
stream: WriteStream;
|
|
222
|
+
/** 日志类型 */
|
|
223
|
+
type: LogTypeEnum;
|
|
224
|
+
/** 日志内容 */
|
|
225
|
+
content: string;
|
|
226
|
+
}) => boolean;
|
|
227
|
+
|
|
159
228
|
export { _get }
|
|
160
229
|
|
|
230
|
+
/** 快捷获取答案 */
|
|
231
|
+
export declare const getAnswerSwift: <V = unknown, T extends string = string>(key: T,
|
|
232
|
+
/** 表单问询配置 */
|
|
233
|
+
questionConfig: Parameters<typeof prompts<T>>[0]) => Promise<V>;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 获取答案 考虑mcp情况
|
|
237
|
+
* ----
|
|
238
|
+
* mcp 只拿预设值,非mcp优先拿默认值
|
|
239
|
+
* 有预设值的场景: MCP
|
|
240
|
+
*/
|
|
241
|
+
export declare const getAnswerWithMCP: <V = unknown, T extends string = string>({ isMCP, key, presetAnswer, defaultValue, questionConfig, }: {
|
|
242
|
+
/** 是否mcp场景 */
|
|
243
|
+
isMCP: boolean;
|
|
244
|
+
/** 表单key */
|
|
245
|
+
key: T;
|
|
246
|
+
/** 预设答案所在的对象 */
|
|
247
|
+
presetAnswer?: object & { [K in T]: any; };
|
|
248
|
+
/** 默认值 */
|
|
249
|
+
defaultValue?: V;
|
|
250
|
+
/** 表单问询配置 */
|
|
251
|
+
questionConfig: Parameters<typeof prompts<T>>[0];
|
|
252
|
+
}) => Promise<V>;
|
|
253
|
+
|
|
254
|
+
/** 获取调用模式 */
|
|
255
|
+
export declare const getCallMode: () => EnvConfigCallModeEnum;
|
|
256
|
+
|
|
161
257
|
/** 获取cli模块【临时】目录[绝对路径] */
|
|
162
258
|
export declare const getCliModuleTempDir: (moduleName: string) => string;
|
|
163
259
|
|
|
@@ -170,19 +266,22 @@ export declare const getCommitByHookName: ({ hookName, rootDir, }: {
|
|
|
170
266
|
/** 获取配置文件通用选项 */
|
|
171
267
|
export declare const getConfigFileCommonOptions: ({ configPathDefault, rootDirDefault, }: {
|
|
172
268
|
configPathDefault: string;
|
|
173
|
-
rootDirDefault?: string
|
|
269
|
+
rootDirDefault?: string;
|
|
174
270
|
}) => Record<keyof ConfigFileCommonOptions, YargsOptions>;
|
|
175
271
|
|
|
176
272
|
/** 获取当前分支最近提交列表 */
|
|
177
273
|
export declare const getCurrentBranchLastCommitList: ({ count, }?: {
|
|
178
|
-
count?: number
|
|
274
|
+
count?: number;
|
|
179
275
|
/** 某个hash之后的提交 */
|
|
180
|
-
afterHash?: string
|
|
276
|
+
afterHash?: string;
|
|
181
277
|
}) => GitLogItemInfo[];
|
|
182
278
|
|
|
183
279
|
/** 获取当前分支名 */
|
|
184
280
|
export declare const getCurrentBranchName: () => string | undefined;
|
|
185
281
|
|
|
282
|
+
/** 获取自身进程日志文件名 */
|
|
283
|
+
export declare const getCurrentProcessLogFileName: () => string;
|
|
284
|
+
|
|
186
285
|
/** 获取编辑器类型 */
|
|
187
286
|
export declare const getEditorType: () => Promise<any>;
|
|
188
287
|
|
|
@@ -199,20 +298,37 @@ export declare interface GetGitLastCommitParams {
|
|
|
199
298
|
remoteAlias?: GitRemoteInfo["alias"];
|
|
200
299
|
}
|
|
201
300
|
|
|
301
|
+
/**
|
|
302
|
+
* 获取git路径
|
|
303
|
+
* ---
|
|
304
|
+
* @param projectPath 项目路径
|
|
305
|
+
*/
|
|
306
|
+
export declare const getGitPath: (projectPath: string) => string;
|
|
307
|
+
|
|
202
308
|
/** 获取git项目目录 */
|
|
203
309
|
export declare const getGitProjectDir: (rootDir: string) => string;
|
|
204
310
|
|
|
205
311
|
/** 获取最后的reflog */
|
|
206
312
|
export declare const getLastReflogList: ({ count, filterItem, }?: {
|
|
207
|
-
count?: number
|
|
313
|
+
count?: number;
|
|
208
314
|
/** 某个hash之后的提交 */
|
|
209
|
-
afterHash?: string
|
|
315
|
+
afterHash?: string;
|
|
210
316
|
/** 过滤函数 */
|
|
211
|
-
filterItem?: (
|
|
317
|
+
filterItem?: (item: GitReflogItemInfoRaw) => boolean;
|
|
212
318
|
}) => GitReflogItemInfo[];
|
|
213
319
|
|
|
320
|
+
/**
|
|
321
|
+
* 获取日志文件夹
|
|
322
|
+
* ----
|
|
323
|
+
* 绝对路径
|
|
324
|
+
* @param persistent 是否持久话
|
|
325
|
+
*/
|
|
326
|
+
export declare const getLogOutputDir: (persistent?: boolean) => string;
|
|
327
|
+
|
|
214
328
|
/** 获取输出文字 */
|
|
215
329
|
export declare const getLogText: ((type: LogTypeEnum, ...messages: unknown[]) => string) & {
|
|
330
|
+
/** 系统 */
|
|
331
|
+
system: (...messages: unknown[]) => string;
|
|
216
332
|
/** 成功 */
|
|
217
333
|
success: (...messages: unknown[]) => string;
|
|
218
334
|
/** /步骤 */
|
|
@@ -225,17 +341,34 @@ export declare const getLogText: ((type: LogTypeEnum, ...messages: unknown[]) =>
|
|
|
225
341
|
error: (...messages: unknown[]) => string;
|
|
226
342
|
/** 跳过 */
|
|
227
343
|
skip: (...messages: unknown[]) => string;
|
|
344
|
+
/** 表格 */
|
|
345
|
+
table: (...messages: unknown[]) => string;
|
|
228
346
|
};
|
|
229
347
|
|
|
348
|
+
/** 格式: 2026-01-18 11:38:05 */
|
|
349
|
+
export declare const getLogTime: () => string;
|
|
350
|
+
|
|
351
|
+
/** 通过 LogTypeEnum 枚举值或者key */
|
|
352
|
+
export declare const getLogTypeByValue: (value: LogTypeEnum) => string;
|
|
353
|
+
|
|
230
354
|
/** 获取package.json文件内容 */
|
|
231
355
|
export declare const getPackageJson: <R extends PackageJson>({ rootDir, }: {
|
|
232
356
|
rootDir: string;
|
|
233
357
|
}) => R;
|
|
234
358
|
|
|
359
|
+
/** 获取父级进程日志文件名 */
|
|
360
|
+
export declare const getParentProcessLogFileName: () => string | undefined;
|
|
361
|
+
|
|
362
|
+
/** 获取环境变量 */
|
|
363
|
+
export declare const getProcessEnv: <T>(keyInit: EnvConfigProcessKeyEnum, defaultValue?: T) => T | undefined;
|
|
364
|
+
|
|
365
|
+
/** 获取当前进程对应的日志流 */
|
|
366
|
+
export declare const getProcessLogStream: () => XFsWriteStream;
|
|
367
|
+
|
|
235
368
|
/** 获取依赖包版本 */
|
|
236
369
|
export declare const getRelyPkgVersion: <R extends PackageJson>({ rootDir, pkgJson, pkgName, isDevPkg, }: {
|
|
237
370
|
rootDir: string;
|
|
238
|
-
pkgJson?: R
|
|
371
|
+
pkgJson?: R;
|
|
239
372
|
pkgName: string;
|
|
240
373
|
/** 是开发依赖包 */
|
|
241
374
|
isDevPkg: boolean;
|
|
@@ -248,10 +381,13 @@ export declare const getRootDirOptions: (rootDirDefault?: string) => {
|
|
|
248
381
|
|
|
249
382
|
/** 获取根命令名称 */
|
|
250
383
|
export declare const getRootScriptName: ({ rootScriptName, packageJson, }: {
|
|
251
|
-
rootScriptName?: string
|
|
252
|
-
packageJson?: Pick<PackageJson, "name" | "bin"
|
|
384
|
+
rootScriptName?: string;
|
|
385
|
+
packageJson?: Pick<PackageJson, "name" | "bin">;
|
|
253
386
|
}) => string | undefined;
|
|
254
387
|
|
|
388
|
+
/** 获取安全路径 */
|
|
389
|
+
export declare const getSafePath: (path?: string) => string;
|
|
390
|
+
|
|
255
391
|
/** 获取是否使用默认配置 */
|
|
256
392
|
export declare const getUseDefaultConfig: () => Promise<any>;
|
|
257
393
|
|
|
@@ -431,16 +567,32 @@ export declare const initConfigFile: <T>(content: T, argv: CliHandlerArgv<InitCo
|
|
|
431
567
|
/** 初始化文件选项 */
|
|
432
568
|
export declare type InitConfigFileOptions = ConfigFileCommonOptions;
|
|
433
569
|
|
|
570
|
+
/**
|
|
571
|
+
* 初始化环境配置
|
|
572
|
+
* ---
|
|
573
|
+
* !!! 顶级进程才调用且只能调用一次
|
|
574
|
+
* 非顶级进程调用会忽略入参 即优先使用父级设置的进程配置
|
|
575
|
+
* ---
|
|
576
|
+
* 即顶级进程调用
|
|
577
|
+
* 非顶级进程通过进程环境继承
|
|
578
|
+
*/
|
|
579
|
+
export declare const initEnvConfig: ({ series, ...otherConfig }: Partial<Pick<EnvConfig, "callMode" | "consoleLog"> & {
|
|
580
|
+
series: string;
|
|
581
|
+
}>) => EnvConfig;
|
|
582
|
+
|
|
434
583
|
/** 初始化配置文件通用处理器 */
|
|
435
584
|
export declare const initHandlerCommon: <T>(content: T, argv: CliHandlerArgv<InitConfigFileOptions>, { onFileGenerated, edit, }?: {
|
|
436
585
|
/** 文件已生成 */
|
|
437
|
-
onFileGenerated?: (
|
|
438
|
-
edit?: boolean
|
|
586
|
+
onFileGenerated?: (path: string) => void;
|
|
587
|
+
edit?: boolean;
|
|
439
588
|
}) => Promise<void>;
|
|
440
589
|
|
|
441
590
|
/** 是http git地址 */
|
|
442
591
|
export declare const isHttpGitUrl: (url: string) => boolean;
|
|
443
592
|
|
|
593
|
+
/** 是mcp模式 */
|
|
594
|
+
export declare const isMcpMode: () => boolean;
|
|
595
|
+
|
|
444
596
|
/** 是 ssh git地址 */
|
|
445
597
|
export declare const isSshGitUrl: (url: string) => boolean;
|
|
446
598
|
|
|
@@ -448,6 +600,8 @@ export { json5 }
|
|
|
448
600
|
|
|
449
601
|
/** 日志 */
|
|
450
602
|
export declare const log: ((type: LogTypeEnum, ...messages: unknown[]) => void) & {
|
|
603
|
+
/** 系统 */
|
|
604
|
+
system: (...messages: unknown[]) => void;
|
|
451
605
|
/** 成功 */
|
|
452
606
|
success: (...messages: unknown[]) => void;
|
|
453
607
|
/** /步骤 */
|
|
@@ -460,32 +614,40 @@ export declare const log: ((type: LogTypeEnum, ...messages: unknown[]) => void)
|
|
|
460
614
|
error: (...messages: unknown[]) => void;
|
|
461
615
|
/** 跳过 */
|
|
462
616
|
skip: (...messages: unknown[]) => void;
|
|
617
|
+
/** 表格 */
|
|
618
|
+
table: (...messages: unknown[]) => void;
|
|
463
619
|
};
|
|
464
620
|
|
|
465
621
|
export declare type LogParams = [type: LogTypeEnum, ...messages: unknown[]];
|
|
466
622
|
|
|
467
623
|
/** 日志类型 */
|
|
468
|
-
declare enum LogTypeEnum {
|
|
624
|
+
export declare enum LogTypeEnum {
|
|
625
|
+
/** 系统 */
|
|
626
|
+
SYSTEM = "magenta",
|
|
469
627
|
/** 成功 */
|
|
470
|
-
SUCCESS = "
|
|
628
|
+
SUCCESS = "greenBright",
|
|
471
629
|
/** 步骤 */
|
|
472
630
|
STAGE = "blue",
|
|
473
631
|
/** 提示信息 */
|
|
474
|
-
INFO = "
|
|
632
|
+
INFO = "white",
|
|
475
633
|
/** 警告 */
|
|
476
634
|
WARN = "yellow",
|
|
477
635
|
/** 错误 */
|
|
478
|
-
ERROR = "
|
|
636
|
+
ERROR = "redBright",
|
|
479
637
|
/** 跳过 */
|
|
480
|
-
SKIP = "
|
|
638
|
+
SKIP = "dim",
|
|
639
|
+
/** ---- 表格 ---- */
|
|
640
|
+
TABLE = "table"
|
|
481
641
|
}
|
|
482
642
|
|
|
483
643
|
/**
|
|
484
644
|
* 查找目标文件或目录
|
|
485
645
|
*/
|
|
486
|
-
export declare const lookForParentTarget: (
|
|
487
|
-
|
|
488
|
-
|
|
646
|
+
export declare const lookForParentTarget: (
|
|
647
|
+
/** 目标文件或目录 */
|
|
648
|
+
target: string, { currentDir, isFindFarthest, }?: {
|
|
649
|
+
currentDir?: string;
|
|
650
|
+
isFindFarthest?: boolean;
|
|
489
651
|
}) => string | undefined;
|
|
490
652
|
|
|
491
653
|
/** 用编辑器打开文件 */
|
|
@@ -503,6 +665,14 @@ export declare interface PackageJson {
|
|
|
503
665
|
peerDependencies?: Record<string, string>;
|
|
504
666
|
}
|
|
505
667
|
|
|
668
|
+
/** 路径是否安全 */
|
|
669
|
+
export declare const pathIsSafe: (path?: string) => boolean;
|
|
670
|
+
|
|
671
|
+
/** 进程值变量初始值 */
|
|
672
|
+
export declare interface ProcessValueInit<T> {
|
|
673
|
+
value: T;
|
|
674
|
+
}
|
|
675
|
+
|
|
506
676
|
export { PromptAnswers }
|
|
507
677
|
|
|
508
678
|
export { PromptChoice }
|
|
@@ -525,7 +695,7 @@ export { PromptValueOrFunc }
|
|
|
525
695
|
export declare const pushGitPublishInfoToRemote: ({ branchName, version, remoteInfo, }: {
|
|
526
696
|
branchName: string;
|
|
527
697
|
version: string;
|
|
528
|
-
remoteInfo?: GitRemoteInfo
|
|
698
|
+
remoteInfo?: GitRemoteInfo;
|
|
529
699
|
}) => void;
|
|
530
700
|
|
|
531
701
|
/** 读取(某个模块)配置 */
|
|
@@ -550,7 +720,7 @@ export declare const readCliModuleAssetsConfig: <R>({ moduleName, onSuccess, }:
|
|
|
550
720
|
}) => Promise<R>;
|
|
551
721
|
|
|
552
722
|
/** 读取配置文件 */
|
|
553
|
-
export declare const readConfigFile: <T>(options: ReadConfigFileOptions, onNotExists?: (
|
|
723
|
+
export declare const readConfigFile: <T>(options: ReadConfigFileOptions, onNotExists?: () => T) => Promise<T>;
|
|
554
724
|
|
|
555
725
|
/** 读取配置文件选项 */
|
|
556
726
|
export declare type ReadConfigFileOptions = ConfigFileCommonOptions;
|
|
@@ -562,24 +732,32 @@ export declare const readFile: (assetPath: string) => string;
|
|
|
562
732
|
export declare const readFileAsync: (assetPath: string) => Promise<string>;
|
|
563
733
|
|
|
564
734
|
/** 读取json文件[同步] */
|
|
565
|
-
export declare const readJsonFile: <T>(assetPath: string, defaultValue?: T
|
|
735
|
+
export declare const readJsonFile: <T>(assetPath: string, defaultValue?: T) => T;
|
|
566
736
|
|
|
567
737
|
/** 读取json文件[异步] */
|
|
568
|
-
export declare const readJsonFileAsync: <T>(assetPath: string, defaultValue?: T
|
|
738
|
+
export declare const readJsonFileAsync: <T>(assetPath: string, defaultValue?: T) => Promise<T>;
|
|
569
739
|
|
|
570
740
|
/**
|
|
571
741
|
* 删除资源 (同步)
|
|
572
742
|
* ---
|
|
573
743
|
* 无论文件还是文件夹
|
|
574
744
|
*/
|
|
575
|
-
export declare const removeAsset: (
|
|
745
|
+
export declare const removeAsset: (
|
|
746
|
+
/** 资源路径 */
|
|
747
|
+
assetPath: string,
|
|
748
|
+
/** 是否要强删除 */
|
|
749
|
+
force?: boolean) => void;
|
|
576
750
|
|
|
577
751
|
/**
|
|
578
752
|
* 删除资源 (异步)
|
|
579
753
|
* ---
|
|
580
754
|
* 无论文件还是文件夹
|
|
581
755
|
*/
|
|
582
|
-
export declare const removeAssetAsync: (
|
|
756
|
+
export declare const removeAssetAsync: (
|
|
757
|
+
/** 资源路径 */
|
|
758
|
+
assetPath: string,
|
|
759
|
+
/** 是否要强删除 */
|
|
760
|
+
force?: boolean) => Promise<void>;
|
|
583
761
|
|
|
584
762
|
/** 解析checkoutInfo */
|
|
585
763
|
export declare const resolveCheckoutInfoByRefInfo: (message: string) => {
|
|
@@ -596,6 +774,13 @@ export declare const resolveMergeInfoByGitReflogAction: () => GitMergeBranchInfo
|
|
|
596
774
|
/** 从reflog type解析合并信息 */
|
|
597
775
|
export declare const resolveMergeInfoByRefType: (type: string) => GitMergeBranchInfo | undefined;
|
|
598
776
|
|
|
777
|
+
/**
|
|
778
|
+
* 移除git控制 - 异步
|
|
779
|
+
* @param projectPath
|
|
780
|
+
* @returns
|
|
781
|
+
*/
|
|
782
|
+
export declare const rmGitCtrlAsync: (projectPath: string) => Promise<void>;
|
|
783
|
+
|
|
599
784
|
export { _set }
|
|
600
785
|
|
|
601
786
|
/** 子cli信息 */
|
|
@@ -609,10 +794,21 @@ export declare const SUPPORT_GET_COMMIT_BY_HOOKS_NAMES: readonly [HooksNameEnum.
|
|
|
609
794
|
|
|
610
795
|
export declare type SupportGetCommitByHookName = (typeof SUPPORT_GET_COMMIT_BY_HOOKS_NAMES)[number];
|
|
611
796
|
|
|
612
|
-
export
|
|
797
|
+
export declare const uuidv4: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* fs.WriteStream 确实没有直接声明 fd 属性(虽然运行时它确实存在)。这是因为 fd 是由底层的物理文件句柄分配的,其类型定义在内部较为隐蔽。
|
|
801
|
+
*/
|
|
802
|
+
declare interface XFsWriteStream extends fs.WriteStream {
|
|
803
|
+
fd?: number;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export declare interface XGlobalThis {
|
|
807
|
+
[DONE_CONFIG_ENV_CONFIG_GLOBAL_SYMBOL]: EnvConfig;
|
|
808
|
+
}
|
|
613
809
|
|
|
614
810
|
/** prompts 拓展 */
|
|
615
|
-
export declare const xPrompts: <T extends string = string>(
|
|
811
|
+
export declare const xPrompts: <T extends string = string>(...args: Parameters<typeof prompts<T>>) => Promise<prompts.Answers<T>>;
|
|
616
812
|
|
|
617
813
|
export { YargsArgv }
|
|
618
814
|
|