soda-nodejs 0.5.3 → 0.6.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/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/utils/compress.d.ts +11 -0
- package/dist/cjs/utils/compress.js +53 -0
- package/dist/cjs/utils/compress.js.map +7 -0
- package/dist/cjs/utils/spawnAsync.js +2 -4
- package/dist/cjs/utils/spawnAsync.js.map +2 -2
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/compress.d.ts +11 -0
- package/dist/esm/utils/compress.js +30 -0
- package/dist/esm/utils/compress.js.map +1 -0
- package/dist/esm/utils/spawnAsync.js +2 -4
- package/dist/esm/utils/spawnAsync.js.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +1 -0
- package/src/utils/compress.ts +37 -0
- package/src/utils/spawnAsync.ts +2 -4
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
// src/index.ts
|
|
17
17
|
var src_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(src_exports);
|
|
19
|
+
__reExport(src_exports, require("./utils/compress"), module.exports);
|
|
19
20
|
__reExport(src_exports, require("./utils/copy"), module.exports);
|
|
20
21
|
__reExport(src_exports, require("./utils/execAsync"), module.exports);
|
|
21
22
|
__reExport(src_exports, require("./utils/saveFile"), module.exports);
|
|
@@ -25,6 +26,7 @@ __reExport(src_exports, require("./utils/unzip"), module.exports);
|
|
|
25
26
|
__reExport(src_exports, require("./utils/zip"), module.exports);
|
|
26
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
28
|
0 && (module.exports = {
|
|
29
|
+
...require("./utils/compress"),
|
|
28
30
|
...require("./utils/copy"),
|
|
29
31
|
...require("./utils/execAsync"),
|
|
30
32
|
...require("./utils/saveFile"),
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@/utils/copy\"\nexport * from \"@/utils/execAsync\"\nexport * from \"@/utils/saveFile\"\nexport * from \"@/utils/saveResponse\"\nexport * from \"@/utils/spawnAsync\"\nexport * from \"@/utils/unzip\"\nexport * from \"@/utils/zip\"\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,
|
|
4
|
+
"sourcesContent": ["export * from \"@/utils/compress\"\nexport * from \"@/utils/copy\"\nexport * from \"@/utils/execAsync\"\nexport * from \"@/utils/saveFile\"\nexport * from \"@/utils/saveResponse\"\nexport * from \"@/utils/spawnAsync\"\nexport * from \"@/utils/unzip\"\nexport * from \"@/utils/zip\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,6BAAd;AACA,wBAAc,yBADd;AAEA,wBAAc,8BAFd;AAGA,wBAAc,6BAHd;AAIA,wBAAc,iCAJd;AAKA,wBAAc,+BALd;AAMA,wBAAc,0BANd;AAOA,wBAAc,wBAPd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/compress.ts
|
|
20
|
+
var compress_exports = {};
|
|
21
|
+
__export(compress_exports, {
|
|
22
|
+
compress: () => compress
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(compress_exports);
|
|
25
|
+
var import_fs = require("fs");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
var import_tar = require("tar");
|
|
28
|
+
async function compress({ input, output }) {
|
|
29
|
+
input = (0, import_path.resolve)(input);
|
|
30
|
+
if (!(0, import_fs.existsSync)(input))
|
|
31
|
+
throw new Error("Source folder does not exist");
|
|
32
|
+
const outputDir = (0, import_path.dirname)(output);
|
|
33
|
+
if (!(0, import_fs.existsSync)(outputDir))
|
|
34
|
+
(0, import_fs.mkdirSync)(outputDir, { recursive: true });
|
|
35
|
+
await (0, import_tar.create)(
|
|
36
|
+
{
|
|
37
|
+
gzip: true,
|
|
38
|
+
// 使用 gzip 压缩
|
|
39
|
+
file: output,
|
|
40
|
+
// 输出文件路径
|
|
41
|
+
cwd: (0, import_path.dirname)(input)
|
|
42
|
+
// 设置工作目录
|
|
43
|
+
},
|
|
44
|
+
[(0, import_path.basename)(input)]
|
|
45
|
+
// 要压缩的文件夹名
|
|
46
|
+
);
|
|
47
|
+
return (0, import_path.resolve)(output);
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
compress
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=compress.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/compress.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, mkdirSync } from \"fs\"\r\nimport { basename, dirname, resolve } from \"path\"\r\nimport { create } from \"tar\"\r\n\r\nexport interface CompressionParams {\r\n /**\r\n * 需要压缩的文件夹\r\n */\r\n input: string\r\n /**\r\n * 压缩后的文件路径\r\n */\r\n output: string\r\n}\r\n\r\nexport async function compress({ input, output }: CompressionParams) {\r\n input = resolve(input)\r\n\r\n // 确保源路径存在\r\n if (!existsSync(input)) throw new Error(\"Source folder does not exist\")\r\n\r\n // 确保输出目录存在\r\n const outputDir = dirname(output)\r\n if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })\r\n\r\n // 执行压缩\r\n await create(\r\n {\r\n gzip: true, // 使用 gzip 压缩\r\n file: output, // 输出文件路径\r\n cwd: dirname(input), // 设置工作目录\r\n },\r\n [basename(input)], // 要压缩的文件夹名\r\n )\r\n\r\n return resolve(output)\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAsC;AACtC,kBAA2C;AAC3C,iBAAuB;AAavB,eAAsB,SAAS,EAAE,OAAO,OAAO,GAAsB;AACjE,cAAQ,qBAAQ,KAAK;AAGrB,MAAI,KAAC,sBAAW,KAAK;AAAG,UAAM,IAAI,MAAM,8BAA8B;AAGtE,QAAM,gBAAY,qBAAQ,MAAM;AAChC,MAAI,KAAC,sBAAW,SAAS;AAAG,6BAAU,WAAW,EAAE,WAAW,KAAK,CAAC;AAGpE,YAAM;AAAA,IACF;AAAA,MACI,MAAM;AAAA;AAAA,MACN,MAAM;AAAA;AAAA,MACN,SAAK,qBAAQ,KAAK;AAAA;AAAA,IACtB;AAAA,IACA,KAAC,sBAAS,KAAK,CAAC;AAAA;AAAA,EACpB;AAEA,aAAO,qBAAQ,MAAM;AACzB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -48,14 +48,12 @@ function spawnAsync(command, args, options) {
|
|
|
48
48
|
child.on("exit", (code) => {
|
|
49
49
|
if (code === 0)
|
|
50
50
|
return resolve(child);
|
|
51
|
-
let command2 = command;
|
|
52
51
|
if (Array.isArray(args)) {
|
|
53
52
|
const args2 = args.map((item) => item.trim()).filter(Boolean);
|
|
54
53
|
if (args2.length > 0)
|
|
55
|
-
|
|
54
|
+
command = `${command} ${args2.join(" ")}`;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
reject(new Error(`"${command2}" Command failed with code ${code}`));
|
|
56
|
+
reject(new Error(`spawn "${command}" failed with code ${code}`));
|
|
59
57
|
return;
|
|
60
58
|
});
|
|
61
59
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/spawnAsync.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n SpawnOptions,\n SpawnOptionsWithStdioTuple,\n SpawnOptionsWithoutStdio,\n StdioNull,\n StdioPipe,\n spawn,\n} from \"child_process\"\nimport { Readable, Writable } from \"stream\"\n\nexport interface PromiseWithChildProcess<T> extends Promise<T> {\n child: T\n}\n\nexport type Options =\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n\nlet defaultOptions: Options = {}\n\n/**\n * @description get default options for spawnAsync\n * @returns {Options} options\n */\nexport function getDefaultOptions(): Options {\n return defaultOptions\n}\n\n/**\n * @description set default options for spawnAsync\n * @param {Options | ((prev: Options) => Options)} options\n */\nexport function setDefaultOptions(options: Options | ((prev: Options) => Options)) {\n if (typeof options === \"function\") {\n defaultOptions = options(defaultOptions)\n return\n }\n defaultOptions = options\n return defaultOptions\n}\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): PromiseWithChildProcess<ChildProcessWithoutNullStreams>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, null>>\nexport function spawnAsync(command: string, options: SpawnOptions): PromiseWithChildProcess<ChildProcess>\nexport function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnOptionsWithoutStdio,\n): PromiseWithChildProcess<ChildProcessWithoutNullStreams>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, null>>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): PromiseWithChildProcess<ChildProcess>\n\n/**\n * @description wait for the command to exit\n * @returns a promise that resolves with the child process when the command exits successfully. Also, the child process is attached to the promise as a property.\n */\nexport function spawnAsync(command: string, args?: any, options?: any): Promise<any> {\n let child: any\n const promise = new Promise<any>((resolve, reject) => {\n if (Array.isArray(args)) options = { ...defaultOptions, ...options }\n else args = { ...defaultOptions, ...args }\n child = spawn(command, args, options)\n child.on(\"exit\", (code: number) => {\n if (code === 0) return resolve(child)\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAUO;AAmBP,IAAI,iBAA0B,CAAC;AAMxB,SAAS,oBAA6B;AACzC,SAAO;AACX;AAMO,SAAS,kBAAkB,SAAiD;AAC/E,MAAI,OAAO,YAAY,YAAY;AAC/B,qBAAiB,QAAQ,cAAc;AACvC;AAAA,EACJ;AACA,mBAAiB;AACjB,SAAO;AACX;AAuFO,SAAS,WAAW,SAAiB,MAAY,SAA6B;AACjF,MAAI;AACJ,QAAM,UAAU,IAAI,QAAa,CAAC,SAAS,WAAW;AAClD,QAAI,MAAM,QAAQ,IAAI;AAAG,gBAAU,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AAAA;AAC9D,aAAO,EAAE,GAAG,gBAAgB,GAAG,KAAK;AACzC,gBAAQ,4BAAM,SAAS,MAAM,OAAO;AACpC,UAAM,GAAG,QAAQ,CAAC,SAAiB;AAC/B,UAAI,SAAS;AAAG,eAAO,QAAQ,KAAK;AACpC,UAAI,
|
|
4
|
+
"sourcesContent": ["import {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n SpawnOptions,\n SpawnOptionsWithStdioTuple,\n SpawnOptionsWithoutStdio,\n StdioNull,\n StdioPipe,\n spawn,\n} from \"child_process\"\nimport { Readable, Writable } from \"stream\"\n\nexport interface PromiseWithChildProcess<T> extends Promise<T> {\n child: T\n}\n\nexport type Options =\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n\nlet defaultOptions: Options = {}\n\n/**\n * @description get default options for spawnAsync\n * @returns {Options} options\n */\nexport function getDefaultOptions(): Options {\n return defaultOptions\n}\n\n/**\n * @description set default options for spawnAsync\n * @param {Options | ((prev: Options) => Options)} options\n */\nexport function setDefaultOptions(options: Options | ((prev: Options) => Options)) {\n if (typeof options === \"function\") {\n defaultOptions = options(defaultOptions)\n return\n }\n defaultOptions = options\n return defaultOptions\n}\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): PromiseWithChildProcess<ChildProcessWithoutNullStreams>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, null>>\nexport function spawnAsync(command: string, options: SpawnOptions): PromiseWithChildProcess<ChildProcess>\nexport function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnOptionsWithoutStdio,\n): PromiseWithChildProcess<ChildProcessWithoutNullStreams>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, null>>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): PromiseWithChildProcess<ChildProcess>\n\n/**\n * @description wait for the command to exit\n * @returns a promise that resolves with the child process when the command exits successfully. Also, the child process is attached to the promise as a property.\n */\nexport function spawnAsync(command: string, args?: any, options?: any): Promise<any> {\n let child: any\n const promise = new Promise<any>((resolve, reject) => {\n if (Array.isArray(args)) options = { ...defaultOptions, ...options }\n else args = { ...defaultOptions, ...args }\n child = spawn(command, args, options)\n child.on(\"exit\", (code: number) => {\n if (code === 0) return resolve(child)\n if (Array.isArray(args)) {\n const args2 = args.map((item: string) => item.trim()).filter(Boolean)\n if (args2.length > 0) command = `${command} ${args2.join(\" \")}`\n }\n reject(new Error(`spawn \"${command}\" failed with code ${code}`))\n return\n })\n }) as PromiseWithChildProcess<any>\n promise.child = child\n return promise\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAUO;AAmBP,IAAI,iBAA0B,CAAC;AAMxB,SAAS,oBAA6B;AACzC,SAAO;AACX;AAMO,SAAS,kBAAkB,SAAiD;AAC/E,MAAI,OAAO,YAAY,YAAY;AAC/B,qBAAiB,QAAQ,cAAc;AACvC;AAAA,EACJ;AACA,mBAAiB;AACjB,SAAO;AACX;AAuFO,SAAS,WAAW,SAAiB,MAAY,SAA6B;AACjF,MAAI;AACJ,QAAM,UAAU,IAAI,QAAa,CAAC,SAAS,WAAW;AAClD,QAAI,MAAM,QAAQ,IAAI;AAAG,gBAAU,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AAAA;AAC9D,aAAO,EAAE,GAAG,gBAAgB,GAAG,KAAK;AACzC,gBAAQ,4BAAM,SAAS,MAAM,OAAO;AACpC,UAAM,GAAG,QAAQ,CAAC,SAAiB;AAC/B,UAAI,SAAS;AAAG,eAAO,QAAQ,KAAK;AACpC,UAAI,MAAM,QAAQ,IAAI,GAAG;AACrB,cAAM,QAAQ,KAAK,IAAI,CAAC,SAAiB,KAAK,KAAK,CAAC,EAAE,OAAO,OAAO;AACpE,YAAI,MAAM,SAAS;AAAG,oBAAU,GAAG,WAAW,MAAM,KAAK,GAAG;AAAA,MAChE;AACA,aAAO,IAAI,MAAM,UAAU,6BAA6B,MAAM,CAAC;AAC/D;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AACD,UAAQ,QAAQ;AAChB,SAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@/utils/copy\"\nexport * from \"@/utils/execAsync\"\nexport * from \"@/utils/saveFile\"\nexport * from \"@/utils/saveResponse\"\nexport * from \"@/utils/spawnAsync\"\nexport * from \"@/utils/unzip\"\nexport * from \"@/utils/zip\"\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@/utils/compress\"\nexport * from \"@/utils/copy\"\nexport * from \"@/utils/execAsync\"\nexport * from \"@/utils/saveFile\"\nexport * from \"@/utils/saveResponse\"\nexport * from \"@/utils/spawnAsync\"\nexport * from \"@/utils/unzip\"\nexport * from \"@/utils/zip\"\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { existsSync, mkdirSync } from "fs";
|
|
2
|
+
import { basename, dirname, resolve } from "path";
|
|
3
|
+
import { create } from "tar";
|
|
4
|
+
export async function compress({
|
|
5
|
+
input,
|
|
6
|
+
output
|
|
7
|
+
}) {
|
|
8
|
+
input = resolve(input);
|
|
9
|
+
|
|
10
|
+
// 确保源路径存在
|
|
11
|
+
if (!existsSync(input)) throw new Error("Source folder does not exist");
|
|
12
|
+
|
|
13
|
+
// 确保输出目录存在
|
|
14
|
+
const outputDir = dirname(output);
|
|
15
|
+
if (!existsSync(outputDir)) mkdirSync(outputDir, {
|
|
16
|
+
recursive: true
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// 执行压缩
|
|
20
|
+
await create({
|
|
21
|
+
gzip: true,
|
|
22
|
+
// 使用 gzip 压缩
|
|
23
|
+
file: output,
|
|
24
|
+
// 输出文件路径
|
|
25
|
+
cwd: dirname(input) // 设置工作目录
|
|
26
|
+
}, [basename(input)] // 要压缩的文件夹名
|
|
27
|
+
);
|
|
28
|
+
return resolve(output);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=compress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["existsSync","mkdirSync","basename","dirname","resolve","create","compress","input","output","Error","outputDir","recursive","gzip","file","cwd"],"sources":["../../../src/utils/compress.ts"],"sourcesContent":["import { existsSync, mkdirSync } from \"fs\"\r\nimport { basename, dirname, resolve } from \"path\"\r\nimport { create } from \"tar\"\r\n\r\nexport interface CompressionParams {\r\n /**\r\n * 需要压缩的文件夹\r\n */\r\n input: string\r\n /**\r\n * 压缩后的文件路径\r\n */\r\n output: string\r\n}\r\n\r\nexport async function compress({ input, output }: CompressionParams) {\r\n input = resolve(input)\r\n\r\n // 确保源路径存在\r\n if (!existsSync(input)) throw new Error(\"Source folder does not exist\")\r\n\r\n // 确保输出目录存在\r\n const outputDir = dirname(output)\r\n if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })\r\n\r\n // 执行压缩\r\n await create(\r\n {\r\n gzip: true, // 使用 gzip 压缩\r\n file: output, // 输出文件路径\r\n cwd: dirname(input), // 设置工作目录\r\n },\r\n [basename(input)], // 要压缩的文件夹名\r\n )\r\n\r\n return resolve(output)\r\n}\r\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,IAAI;AAC1C,SAASC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,QAAQ,MAAM;AACjD,SAASC,MAAM,QAAQ,KAAK;AAa5B,OAAO,eAAeC,QAAQA,CAAC;EAAEC,KAAK;EAAEC;AAA0B,CAAC,EAAE;EACjED,KAAK,GAAGH,OAAO,CAACG,KAAK,CAAC;;EAEtB;EACA,IAAI,CAACP,UAAU,CAACO,KAAK,CAAC,EAAE,MAAM,IAAIE,KAAK,CAAC,8BAA8B,CAAC;;EAEvE;EACA,MAAMC,SAAS,GAAGP,OAAO,CAACK,MAAM,CAAC;EACjC,IAAI,CAACR,UAAU,CAACU,SAAS,CAAC,EAAET,SAAS,CAACS,SAAS,EAAE;IAAEC,SAAS,EAAE;EAAK,CAAC,CAAC;;EAErE;EACA,MAAMN,MAAM,CACR;IACIO,IAAI,EAAE,IAAI;IAAE;IACZC,IAAI,EAAEL,MAAM;IAAE;IACdM,GAAG,EAAEX,OAAO,CAACI,KAAK,CAAC,CAAE;EACzB,CAAC,EACD,CAACL,QAAQ,CAACK,KAAK,CAAC,CAAC,CAAE;EACvB,CAAC;EAED,OAAOH,OAAO,CAACI,MAAM,CAAC;AAC1B"}
|
|
@@ -38,13 +38,11 @@ export function spawnAsync(command, args, options) {
|
|
|
38
38
|
child = spawn(command, args, options);
|
|
39
39
|
child.on("exit", code => {
|
|
40
40
|
if (code === 0) return resolve(child);
|
|
41
|
-
let command2 = command;
|
|
42
41
|
if (Array.isArray(args)) {
|
|
43
42
|
const args2 = args.map(item => item.trim()).filter(Boolean);
|
|
44
|
-
if (args2.length > 0)
|
|
43
|
+
if (args2.length > 0) command = `${command} ${args2.join(" ")}`;
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
reject(new Error(`"${command2}" Command failed with code ${code}`));
|
|
45
|
+
reject(new Error(`spawn "${command}" failed with code ${code}`));
|
|
48
46
|
return;
|
|
49
47
|
});
|
|
50
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["spawn","defaultOptions","getDefaultOptions","setDefaultOptions","options","spawnAsync","command","args","child","promise","Promise","resolve","reject","Array","isArray","on","code","
|
|
1
|
+
{"version":3,"names":["spawn","defaultOptions","getDefaultOptions","setDefaultOptions","options","spawnAsync","command","args","child","promise","Promise","resolve","reject","Array","isArray","on","code","args2","map","item","trim","filter","Boolean","length","join","Error"],"sources":["../../../src/utils/spawnAsync.ts"],"sourcesContent":["import {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n SpawnOptions,\n SpawnOptionsWithStdioTuple,\n SpawnOptionsWithoutStdio,\n StdioNull,\n StdioPipe,\n spawn,\n} from \"child_process\"\nimport { Readable, Writable } from \"stream\"\n\nexport interface PromiseWithChildProcess<T> extends Promise<T> {\n child: T\n}\n\nexport type Options =\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n\nlet defaultOptions: Options = {}\n\n/**\n * @description get default options for spawnAsync\n * @returns {Options} options\n */\nexport function getDefaultOptions(): Options {\n return defaultOptions\n}\n\n/**\n * @description set default options for spawnAsync\n * @param {Options | ((prev: Options) => Options)} options\n */\nexport function setDefaultOptions(options: Options | ((prev: Options) => Options)) {\n if (typeof options === \"function\") {\n defaultOptions = options(defaultOptions)\n return\n }\n defaultOptions = options\n return defaultOptions\n}\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): PromiseWithChildProcess<ChildProcessWithoutNullStreams>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, null>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, Readable>>\nexport function spawnAsync(\n command: string,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, null>>\nexport function spawnAsync(command: string, options: SpawnOptions): PromiseWithChildProcess<ChildProcess>\nexport function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnOptionsWithoutStdio,\n): PromiseWithChildProcess<ChildProcessWithoutNullStreams>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, Readable, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<Writable, null, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, Readable, null>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, Readable>>\nexport function spawnAsync(\n command: string,\n args: readonly string[],\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,\n): PromiseWithChildProcess<ChildProcessByStdio<null, null, null>>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): PromiseWithChildProcess<ChildProcess>\n\n/**\n * @description wait for the command to exit\n * @returns a promise that resolves with the child process when the command exits successfully. Also, the child process is attached to the promise as a property.\n */\nexport function spawnAsync(command: string, args?: any, options?: any): Promise<any> {\n let child: any\n const promise = new Promise<any>((resolve, reject) => {\n if (Array.isArray(args)) options = { ...defaultOptions, ...options }\n else args = { ...defaultOptions, ...args }\n child = spawn(command, args, options)\n child.on(\"exit\", (code: number) => {\n if (code === 0) return resolve(child)\n if (Array.isArray(args)) {\n const args2 = args.map((item: string) => item.trim()).filter(Boolean)\n if (args2.length > 0) command = `${command} ${args2.join(\" \")}`\n }\n reject(new Error(`spawn \"${command}\" failed with code ${code}`))\n return\n })\n }) as PromiseWithChildProcess<any>\n promise.child = child\n return promise\n}\n"],"mappings":"AAAA,SASIA,KAAK,QACF,eAAe;AAmBtB,IAAIC,cAAuB,GAAG,CAAC,CAAC;;AAEhC;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAY;EACzC,OAAOD,cAAc;AACzB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,iBAAiBA,CAACC,OAA+C,EAAE;EAC/E,IAAI,OAAOA,OAAO,KAAK,UAAU,EAAE;IAC/BH,cAAc,GAAGG,OAAO,CAACH,cAAc,CAAC;IACxC;EACJ;EACAA,cAAc,GAAGG,OAAO;EACxB,OAAOH,cAAc;AACzB;AAmFA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAACC,OAAe,EAAEC,IAAU,EAAEH,OAAa,EAAgB;EACjF,IAAII,KAAU;EACd,MAAMC,OAAO,GAAG,IAAIC,OAAO,CAAM,CAACC,OAAO,EAAEC,MAAM,KAAK;IAClD,IAAIC,KAAK,CAACC,OAAO,CAACP,IAAI,CAAC,EAAEH,OAAO,GAAG;MAAE,GAAGH,cAAc;MAAE,GAAGG;IAAQ,CAAC,MAC/DG,IAAI,GAAG;MAAE,GAAGN,cAAc;MAAE,GAAGM;IAAK,CAAC;IAC1CC,KAAK,GAAGR,KAAK,CAACM,OAAO,EAAEC,IAAI,EAAEH,OAAO,CAAC;IACrCI,KAAK,CAACO,EAAE,CAAC,MAAM,EAAGC,IAAY,IAAK;MAC/B,IAAIA,IAAI,KAAK,CAAC,EAAE,OAAOL,OAAO,CAACH,KAAK,CAAC;MACrC,IAAIK,KAAK,CAACC,OAAO,CAACP,IAAI,CAAC,EAAE;QACrB,MAAMU,KAAK,GAAGV,IAAI,CAACW,GAAG,CAAEC,IAAY,IAAKA,IAAI,CAACC,IAAI,CAAC,CAAC,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;QACrE,IAAIL,KAAK,CAACM,MAAM,GAAG,CAAC,EAAEjB,OAAO,GAAI,GAAEA,OAAQ,IAAGW,KAAK,CAACO,IAAI,CAAC,GAAG,CAAE,EAAC;MACnE;MACAZ,MAAM,CAAC,IAAIa,KAAK,CAAE,UAASnB,OAAQ,sBAAqBU,IAAK,EAAC,CAAC,CAAC;MAChE;IACJ,CAAC,CAAC;EACN,CAAC,CAAiC;EAClCP,OAAO,CAACD,KAAK,GAAGA,KAAK;EACrB,OAAOC,OAAO;AAClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soda-nodejs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"iconv-lite": "^0.6.3",
|
|
31
|
+
"tar": "^7.4.3",
|
|
31
32
|
"which": "^4.0.0"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { existsSync, mkdirSync } from "fs"
|
|
2
|
+
import { basename, dirname, resolve } from "path"
|
|
3
|
+
import { create } from "tar"
|
|
4
|
+
|
|
5
|
+
export interface CompressionParams {
|
|
6
|
+
/**
|
|
7
|
+
* 需要压缩的文件夹
|
|
8
|
+
*/
|
|
9
|
+
input: string
|
|
10
|
+
/**
|
|
11
|
+
* 压缩后的文件路径
|
|
12
|
+
*/
|
|
13
|
+
output: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function compress({ input, output }: CompressionParams) {
|
|
17
|
+
input = resolve(input)
|
|
18
|
+
|
|
19
|
+
// 确保源路径存在
|
|
20
|
+
if (!existsSync(input)) throw new Error("Source folder does not exist")
|
|
21
|
+
|
|
22
|
+
// 确保输出目录存在
|
|
23
|
+
const outputDir = dirname(output)
|
|
24
|
+
if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })
|
|
25
|
+
|
|
26
|
+
// 执行压缩
|
|
27
|
+
await create(
|
|
28
|
+
{
|
|
29
|
+
gzip: true, // 使用 gzip 压缩
|
|
30
|
+
file: output, // 输出文件路径
|
|
31
|
+
cwd: dirname(input), // 设置工作目录
|
|
32
|
+
},
|
|
33
|
+
[basename(input)], // 要压缩的文件夹名
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return resolve(output)
|
|
37
|
+
}
|
package/src/utils/spawnAsync.ts
CHANGED
|
@@ -143,13 +143,11 @@ export function spawnAsync(command: string, args?: any, options?: any): Promise<
|
|
|
143
143
|
child = spawn(command, args, options)
|
|
144
144
|
child.on("exit", (code: number) => {
|
|
145
145
|
if (code === 0) return resolve(child)
|
|
146
|
-
let command2 = command
|
|
147
146
|
if (Array.isArray(args)) {
|
|
148
147
|
const args2 = args.map((item: string) => item.trim()).filter(Boolean)
|
|
149
|
-
if (args2.length > 0)
|
|
148
|
+
if (args2.length > 0) command = `${command} ${args2.join(" ")}`
|
|
150
149
|
}
|
|
151
|
-
|
|
152
|
-
reject(new Error(`"${command2}" Command failed with code ${code}`))
|
|
150
|
+
reject(new Error(`spawn "${command}" failed with code ${code}`))
|
|
153
151
|
return
|
|
154
152
|
})
|
|
155
153
|
}) as PromiseWithChildProcess<any>
|