soda-nodejs 0.0.1 → 0.0.3
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 +3 -3
- package/dist/cjs/index.d.ts +2 -41
- package/dist/cjs/index.js +5 -34
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/utils/execAsync.d.ts +21 -0
- package/dist/cjs/utils/execAsync.js +41 -0
- package/dist/cjs/utils/execAsync.js.map +7 -0
- package/dist/cjs/utils/spawnAsync.d.ts +22 -0
- package/dist/cjs/utils/spawnAsync.js +42 -0
- package/dist/cjs/utils/spawnAsync.js.map +7 -0
- package/dist/esm/index.d.ts +2 -41
- package/dist/esm/index.js +2 -27
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/execAsync.d.ts +21 -0
- package/dist/esm/utils/execAsync.js +16 -0
- package/dist/esm/utils/execAsync.js.map +1 -0
- package/dist/esm/utils/spawnAsync.d.ts +22 -0
- package/dist/esm/utils/spawnAsync.js +14 -0
- package/dist/esm/utils/spawnAsync.js.map +1 -0
- package/package.json +29 -33
- package/src/index.ts +2 -58
- package/src/utils/execAsync.ts +25 -0
- package/src/utils/spawnAsync.ts +34 -0
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# soda-node
|
|
2
2
|
|
|
3
|
-
[](https://npmjs.
|
|
4
|
-
[](https://npmjs.
|
|
3
|
+
[](https://npmjs.com/package/soda-node)
|
|
4
|
+
[](https://npmjs.com/package/soda-node)
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
$
|
|
9
|
+
$ pnpm install
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
```bash
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import { ExecOptions, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process";
|
|
5
|
-
import { ObjectEncodingOptions } from "fs";
|
|
6
|
-
export declare function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
7
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
8
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
9
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
10
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
11
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
12
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
13
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
14
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
15
|
-
export declare function spawnAsync(command: string, options: SpawnOptions): Promise<void>;
|
|
16
|
-
export declare function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
17
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
18
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
19
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
20
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
21
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
22
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
23
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
24
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
25
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>;
|
|
26
|
-
export type ExecResult<T> = {
|
|
27
|
-
stdout: T;
|
|
28
|
-
stderr: T;
|
|
29
|
-
};
|
|
30
|
-
export declare function execAsync(command: string): Promise<ExecResult<string>>;
|
|
31
|
-
export declare function execAsync(command: string, options: {
|
|
32
|
-
encoding: "buffer" | null;
|
|
33
|
-
} & ExecOptions): Promise<ExecResult<Buffer>>;
|
|
34
|
-
export declare function execAsync(command: string, options: {
|
|
35
|
-
encoding: BufferEncoding;
|
|
36
|
-
} & ExecOptions): Promise<ExecResult<string>>;
|
|
37
|
-
export declare function execAsync(command: string, options: {
|
|
38
|
-
encoding: BufferEncoding;
|
|
39
|
-
} & ExecOptions): Promise<ExecResult<string | Buffer>>;
|
|
40
|
-
export declare function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>;
|
|
41
|
-
export declare function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>;
|
|
1
|
+
export * from "./utils/execAsync";
|
|
2
|
+
export * from "./utils/spawnAsync";
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
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
5
|
var __copyProps = (to, from, except, desc) => {
|
|
10
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
7
|
for (let key of __getOwnPropNames(from))
|
|
@@ -14,42 +10,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
10
|
}
|
|
15
11
|
return to;
|
|
16
12
|
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
15
|
|
|
19
16
|
// src/index.ts
|
|
20
17
|
var src_exports = {};
|
|
21
|
-
__export(src_exports, {
|
|
22
|
-
execAsync: () => execAsync,
|
|
23
|
-
spawnAsync: () => spawnAsync
|
|
24
|
-
});
|
|
25
18
|
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
await new Promise((resolve, reject) => {
|
|
29
|
-
const child = (0, import_child_process.spawn)(command, args, options);
|
|
30
|
-
child.on("exit", (code) => {
|
|
31
|
-
if (code !== 0) {
|
|
32
|
-
reject(new Error(`Command failed with code ${code}`));
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
resolve();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
async function execAsync(command, options) {
|
|
40
|
-
return await new Promise((resolve, reject) => {
|
|
41
|
-
(0, import_child_process.exec)(command, options, (error, stdout, stderr) => {
|
|
42
|
-
if (error) {
|
|
43
|
-
reject(error);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
resolve({ stdout, stderr });
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
19
|
+
__reExport(src_exports, require("./utils/execAsync"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./utils/spawnAsync"), module.exports);
|
|
50
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
22
|
0 && (module.exports = {
|
|
52
|
-
execAsync,
|
|
53
|
-
spawnAsync
|
|
23
|
+
...require("./utils/execAsync"),
|
|
24
|
+
...require("./utils/spawnAsync")
|
|
54
25
|
});
|
|
55
26
|
//# sourceMappingURL=index.js.map
|
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": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export * from \"@utils/execAsync\"\nexport * from \"@utils/spawnAsync\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,8BAAd;AACA,wBAAc,+BADd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { ExecOptions } from "child_process";
|
|
5
|
+
import { ObjectEncodingOptions } from "fs";
|
|
6
|
+
export type ExecResult<T> = {
|
|
7
|
+
stdout: T;
|
|
8
|
+
stderr: T;
|
|
9
|
+
};
|
|
10
|
+
export declare function execAsync(command: string): Promise<ExecResult<string>>;
|
|
11
|
+
export declare function execAsync(command: string, options: {
|
|
12
|
+
encoding: "buffer" | null;
|
|
13
|
+
} & ExecOptions): Promise<ExecResult<Buffer>>;
|
|
14
|
+
export declare function execAsync(command: string, options: {
|
|
15
|
+
encoding: BufferEncoding;
|
|
16
|
+
} & ExecOptions): Promise<ExecResult<string>>;
|
|
17
|
+
export declare function execAsync(command: string, options: {
|
|
18
|
+
encoding: BufferEncoding;
|
|
19
|
+
} & ExecOptions): Promise<ExecResult<string | Buffer>>;
|
|
20
|
+
export declare function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>;
|
|
21
|
+
export declare function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
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/execAsync.ts
|
|
20
|
+
var execAsync_exports = {};
|
|
21
|
+
__export(execAsync_exports, {
|
|
22
|
+
execAsync: () => execAsync
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(execAsync_exports);
|
|
25
|
+
var import_child_process = require("child_process");
|
|
26
|
+
async function execAsync(command, options) {
|
|
27
|
+
return await new Promise((resolve, reject) => {
|
|
28
|
+
(0, import_child_process.exec)(command, options, (error, stdout, stderr) => {
|
|
29
|
+
if (error) {
|
|
30
|
+
reject(error);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
resolve({ stdout, stderr });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
execAsync
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=execAsync.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/execAsync.ts"],
|
|
4
|
+
"sourcesContent": ["import { exec, ExecOptions } from \"child_process\"\r\nimport { ObjectEncodingOptions } from \"fs\"\r\n\r\nexport type ExecResult<T> = {\r\n stdout: T\r\n stderr: T\r\n}\r\n\r\nexport async function execAsync(command: string): Promise<ExecResult<string>>\r\nexport async function execAsync(command: string, options: { encoding: \"buffer\" | null } & ExecOptions): Promise<ExecResult<Buffer>>\r\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string>>\r\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string | Buffer>>\r\nexport async function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>\r\nexport async function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>\r\nexport async function execAsync(command: string, options?: any) {\r\n return await new Promise<ExecResult<string | Buffer>>((resolve, reject) => {\r\n exec(command, options, (error, stdout, stderr) => {\r\n if (error) {\r\n reject(error)\r\n return\r\n }\r\n resolve({ stdout, stderr })\r\n })\r\n })\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAkC;AAclC,eAAsB,UAAU,SAAiB,SAAe;AAC5D,SAAO,MAAM,IAAI,QAAqC,CAAC,SAAS,WAAW;AACvE,mCAAK,SAAS,SAAS,CAAC,OAAO,QAAQ,WAAW;AAC9C,UAAI,OAAO;AACP,eAAO,KAAK;AACZ;AAAA,MACJ;AACA,cAAQ,EAAE,QAAQ,OAAO,CAAC;AAAA,IAC9B,CAAC;AAAA,EACL,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process";
|
|
3
|
+
export declare function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
4
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
5
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
6
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
7
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
8
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
9
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
10
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
11
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
12
|
+
export declare function spawnAsync(command: string, options: SpawnOptions): Promise<void>;
|
|
13
|
+
export declare function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
14
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
15
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
16
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
17
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
18
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
19
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
20
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
21
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
22
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
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/spawnAsync.ts
|
|
20
|
+
var spawnAsync_exports = {};
|
|
21
|
+
__export(spawnAsync_exports, {
|
|
22
|
+
spawnAsync: () => spawnAsync
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(spawnAsync_exports);
|
|
25
|
+
var import_child_process = require("child_process");
|
|
26
|
+
async function spawnAsync(command, args, options) {
|
|
27
|
+
await new Promise((resolve, reject) => {
|
|
28
|
+
const child = (0, import_child_process.spawn)(command, args, options);
|
|
29
|
+
child.on("exit", (code) => {
|
|
30
|
+
if (code !== 0) {
|
|
31
|
+
reject(new Error(`Command failed with code ${code}`));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
resolve();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
spawnAsync
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=spawnAsync.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/spawnAsync.ts"],
|
|
4
|
+
"sourcesContent": ["import { spawn, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from \"child_process\"\r\n\r\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptions): Promise<void>\r\nexport function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>\r\nexport async function spawnAsync(command: string, args?: any, options?: any) {\r\n await new Promise<void>((resolve, reject) => {\r\n const child = spawn(command, args, options)\r\n child.on(\"exit\", code => {\r\n if (code !== 0) {\r\n reject(new Error(`Command failed with code ${code}`))\r\n return\r\n }\r\n resolve()\r\n })\r\n })\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAgH;AAsBhH,eAAsB,WAAW,SAAiB,MAAY,SAAe;AACzE,QAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AACzC,UAAM,YAAQ,4BAAM,SAAS,MAAM,OAAO;AAC1C,UAAM,GAAG,QAAQ,UAAQ;AACrB,UAAI,SAAS,GAAG;AACZ,eAAO,IAAI,MAAM,4BAA4B,MAAM,CAAC;AACpD;AAAA,MACJ;AACA,cAAQ;AAAA,IACZ,CAAC;AAAA,EACL,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import { ExecOptions, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process";
|
|
5
|
-
import { ObjectEncodingOptions } from "fs";
|
|
6
|
-
export declare function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
7
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
8
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
9
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
10
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
11
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
12
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
13
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
14
|
-
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
15
|
-
export declare function spawnAsync(command: string, options: SpawnOptions): Promise<void>;
|
|
16
|
-
export declare function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
17
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
18
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
19
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
20
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
21
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
22
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
23
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
24
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
25
|
-
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>;
|
|
26
|
-
export type ExecResult<T> = {
|
|
27
|
-
stdout: T;
|
|
28
|
-
stderr: T;
|
|
29
|
-
};
|
|
30
|
-
export declare function execAsync(command: string): Promise<ExecResult<string>>;
|
|
31
|
-
export declare function execAsync(command: string, options: {
|
|
32
|
-
encoding: "buffer" | null;
|
|
33
|
-
} & ExecOptions): Promise<ExecResult<Buffer>>;
|
|
34
|
-
export declare function execAsync(command: string, options: {
|
|
35
|
-
encoding: BufferEncoding;
|
|
36
|
-
} & ExecOptions): Promise<ExecResult<string>>;
|
|
37
|
-
export declare function execAsync(command: string, options: {
|
|
38
|
-
encoding: BufferEncoding;
|
|
39
|
-
} & ExecOptions): Promise<ExecResult<string | Buffer>>;
|
|
40
|
-
export declare function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>;
|
|
41
|
-
export declare function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>;
|
|
1
|
+
export * from "./utils/execAsync";
|
|
2
|
+
export * from "./utils/spawnAsync";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
await new Promise((resolve, reject) => {
|
|
4
|
-
const child = spawn(command, args, options);
|
|
5
|
-
child.on("exit", code => {
|
|
6
|
-
if (code !== 0) {
|
|
7
|
-
reject(new Error(`Command failed with code ${code}`));
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
resolve();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export async function execAsync(command, options) {
|
|
15
|
-
return await new Promise((resolve, reject) => {
|
|
16
|
-
exec(command, options, (error, stdout, stderr) => {
|
|
17
|
-
if (error) {
|
|
18
|
-
reject(error);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
resolve({
|
|
22
|
-
stdout,
|
|
23
|
-
stderr
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
1
|
+
export * from "./utils/execAsync";
|
|
2
|
+
export * from "./utils/spawnAsync";
|
|
28
3
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@utils/execAsync\"\nexport * from \"@utils/spawnAsync\"\n"],"mappings":"AAAA;AACA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { ExecOptions } from "child_process";
|
|
5
|
+
import { ObjectEncodingOptions } from "fs";
|
|
6
|
+
export type ExecResult<T> = {
|
|
7
|
+
stdout: T;
|
|
8
|
+
stderr: T;
|
|
9
|
+
};
|
|
10
|
+
export declare function execAsync(command: string): Promise<ExecResult<string>>;
|
|
11
|
+
export declare function execAsync(command: string, options: {
|
|
12
|
+
encoding: "buffer" | null;
|
|
13
|
+
} & ExecOptions): Promise<ExecResult<Buffer>>;
|
|
14
|
+
export declare function execAsync(command: string, options: {
|
|
15
|
+
encoding: BufferEncoding;
|
|
16
|
+
} & ExecOptions): Promise<ExecResult<string>>;
|
|
17
|
+
export declare function execAsync(command: string, options: {
|
|
18
|
+
encoding: BufferEncoding;
|
|
19
|
+
} & ExecOptions): Promise<ExecResult<string | Buffer>>;
|
|
20
|
+
export declare function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>;
|
|
21
|
+
export declare function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { exec } from "child_process";
|
|
2
|
+
export async function execAsync(command, options) {
|
|
3
|
+
return await new Promise((resolve, reject) => {
|
|
4
|
+
exec(command, options, (error, stdout, stderr) => {
|
|
5
|
+
if (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
resolve({
|
|
10
|
+
stdout,
|
|
11
|
+
stderr
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=execAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["exec","execAsync","command","options","Promise","resolve","reject","error","stdout","stderr"],"sources":["../../../src/utils/execAsync.ts"],"sourcesContent":["import { exec, ExecOptions } from \"child_process\"\r\nimport { ObjectEncodingOptions } from \"fs\"\r\n\r\nexport type ExecResult<T> = {\r\n stdout: T\r\n stderr: T\r\n}\r\n\r\nexport async function execAsync(command: string): Promise<ExecResult<string>>\r\nexport async function execAsync(command: string, options: { encoding: \"buffer\" | null } & ExecOptions): Promise<ExecResult<Buffer>>\r\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string>>\r\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string | Buffer>>\r\nexport async function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>\r\nexport async function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>\r\nexport async function execAsync(command: string, options?: any) {\r\n return await new Promise<ExecResult<string | Buffer>>((resolve, reject) => {\r\n exec(command, options, (error, stdout, stderr) => {\r\n if (error) {\r\n reject(error)\r\n return\r\n }\r\n resolve({ stdout, stderr })\r\n })\r\n })\r\n}\r\n"],"mappings":"AAAA,SAASA,IAAI,QAAqB,eAAe;AAcjD,OAAO,eAAeC,SAASA,CAACC,OAAe,EAAEC,OAAa,EAAE;EAC5D,OAAO,MAAM,IAAIC,OAAO,CAA8B,CAACC,OAAO,EAAEC,MAAM,KAAK;IACvEN,IAAI,CAACE,OAAO,EAAEC,OAAO,EAAE,CAACI,KAAK,EAAEC,MAAM,EAAEC,MAAM,KAAK;MAC9C,IAAIF,KAAK,EAAE;QACPD,MAAM,CAACC,KAAK,CAAC;QACb;MACJ;MACAF,OAAO,CAAC;QAAEG,MAAM;QAAEC;MAAO,CAAC,CAAC;IAC/B,CAAC,CAAC;EACN,CAAC,CAAC;AACN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process";
|
|
3
|
+
export declare function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
4
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
5
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
6
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
7
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
8
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
9
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
10
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
11
|
+
export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
12
|
+
export declare function spawnAsync(command: string, options: SpawnOptions): Promise<void>;
|
|
13
|
+
export declare function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>;
|
|
14
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
|
|
15
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
|
|
16
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>;
|
|
17
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>;
|
|
18
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>;
|
|
19
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>;
|
|
20
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>;
|
|
21
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>;
|
|
22
|
+
export declare function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
export async function spawnAsync(command, args, options) {
|
|
3
|
+
await new Promise((resolve, reject) => {
|
|
4
|
+
const child = spawn(command, args, options);
|
|
5
|
+
child.on("exit", code => {
|
|
6
|
+
if (code !== 0) {
|
|
7
|
+
reject(new Error(`Command failed with code ${code}`));
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
resolve();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=spawnAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["spawn","spawnAsync","command","args","options","Promise","resolve","reject","child","on","code","Error"],"sources":["../../../src/utils/spawnAsync.ts"],"sourcesContent":["import { spawn, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from \"child_process\"\r\n\r\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, options: SpawnOptions): Promise<void>\r\nexport function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\r\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>\r\nexport async function spawnAsync(command: string, args?: any, options?: any) {\r\n await new Promise<void>((resolve, reject) => {\r\n const child = spawn(command, args, options)\r\n child.on(\"exit\", code => {\r\n if (code !== 0) {\r\n reject(new Error(`Command failed with code ${code}`))\r\n return\r\n }\r\n resolve()\r\n })\r\n })\r\n}\r\n"],"mappings":"AAAA,SAASA,KAAK,QAAkG,eAAe;AAsB/H,OAAO,eAAeC,UAAUA,CAACC,OAAe,EAAEC,IAAU,EAAEC,OAAa,EAAE;EACzE,MAAM,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;IACzC,MAAMC,KAAK,GAAGR,KAAK,CAACE,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC;IAC3CI,KAAK,CAACC,EAAE,CAAC,MAAM,EAAEC,IAAI,IAAI;MACrB,IAAIA,IAAI,KAAK,CAAC,EAAE;QACZH,MAAM,CAAC,IAAII,KAAK,CAAE,4BAA2BD,IAAK,EAAC,CAAC,CAAC;QACrD;MACJ;MACAJ,OAAO,CAAC,CAAC;IACb,CAAC,CAAC;EACN,CAAC,CAAC;AACN"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"@types/node": "^20.11.30",
|
|
32
|
-
"father": "^4.4.0"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
2
|
+
"name": "soda-nodejs",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"authors": [],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"files": [
|
|
12
|
+
"compiled",
|
|
13
|
+
"dist",
|
|
14
|
+
"src"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"registry": "https://registry.npmjs.org/"
|
|
19
|
+
},
|
|
20
|
+
"repository": "https://github.com/1adybug/deepsea/tree/main/packages/soda-nodejs",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^20.14.10",
|
|
23
|
+
"father": "^4.5.0-rc.2"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "father dev",
|
|
27
|
+
"build": "father build",
|
|
28
|
+
"build:deps": "father prebundle"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>
|
|
5
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>
|
|
6
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>
|
|
7
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>
|
|
8
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>
|
|
9
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>
|
|
10
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>
|
|
11
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>
|
|
12
|
-
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>
|
|
13
|
-
export function spawnAsync(command: string, options: SpawnOptions): Promise<void>
|
|
14
|
-
export function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>
|
|
15
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>
|
|
16
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>
|
|
17
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>
|
|
18
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>
|
|
19
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>
|
|
20
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>
|
|
21
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>
|
|
22
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>
|
|
23
|
-
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>
|
|
24
|
-
export async function spawnAsync(command: string, args?: any, options?: any) {
|
|
25
|
-
await new Promise<void>((resolve, reject) => {
|
|
26
|
-
const child = spawn(command, args, options)
|
|
27
|
-
child.on("exit", code => {
|
|
28
|
-
if (code !== 0) {
|
|
29
|
-
reject(new Error(`Command failed with code ${code}`))
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
resolve()
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type ExecResult<T> = {
|
|
38
|
-
stdout: T
|
|
39
|
-
stderr: T
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export async function execAsync(command: string): Promise<ExecResult<string>>
|
|
43
|
-
export async function execAsync(command: string, options: { encoding: "buffer" | null } & ExecOptions): Promise<ExecResult<Buffer>>
|
|
44
|
-
export async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string>>
|
|
45
|
-
export async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string | Buffer>>
|
|
46
|
-
export async function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>
|
|
47
|
-
export async function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>
|
|
48
|
-
export async function execAsync(command: string, options?: any) {
|
|
49
|
-
return await new Promise<ExecResult<string | Buffer>>((resolve, reject) => {
|
|
50
|
-
exec(command, options, (error, stdout, stderr) => {
|
|
51
|
-
if (error) {
|
|
52
|
-
reject(error)
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
resolve({ stdout, stderr })
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
}
|
|
1
|
+
export * from "@utils/execAsync"
|
|
2
|
+
export * from "@utils/spawnAsync"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { exec, ExecOptions } from "child_process"
|
|
2
|
+
import { ObjectEncodingOptions } from "fs"
|
|
3
|
+
|
|
4
|
+
export type ExecResult<T> = {
|
|
5
|
+
stdout: T
|
|
6
|
+
stderr: T
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function execAsync(command: string): Promise<ExecResult<string>>
|
|
10
|
+
export async function execAsync(command: string, options: { encoding: "buffer" | null } & ExecOptions): Promise<ExecResult<Buffer>>
|
|
11
|
+
export async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string>>
|
|
12
|
+
export async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<ExecResult<string | Buffer>>
|
|
13
|
+
export async function execAsync(command: string, options: ExecOptions): Promise<ExecResult<string>>
|
|
14
|
+
export async function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<ExecResult<string | Buffer>>
|
|
15
|
+
export async function execAsync(command: string, options?: any) {
|
|
16
|
+
return await new Promise<ExecResult<string | Buffer>>((resolve, reject) => {
|
|
17
|
+
exec(command, options, (error, stdout, stderr) => {
|
|
18
|
+
if (error) {
|
|
19
|
+
reject(error)
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
resolve({ stdout, stderr })
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { spawn, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process"
|
|
2
|
+
|
|
3
|
+
export function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>
|
|
4
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>
|
|
5
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>
|
|
6
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>
|
|
7
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>
|
|
8
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>
|
|
9
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>
|
|
10
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>
|
|
11
|
+
export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>
|
|
12
|
+
export function spawnAsync(command: string, options: SpawnOptions): Promise<void>
|
|
13
|
+
export function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>
|
|
14
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>
|
|
15
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>
|
|
16
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>
|
|
17
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>
|
|
18
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>
|
|
19
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>
|
|
20
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>
|
|
21
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>
|
|
22
|
+
export function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>
|
|
23
|
+
export async function spawnAsync(command: string, args?: any, options?: any) {
|
|
24
|
+
await new Promise<void>((resolve, reject) => {
|
|
25
|
+
const child = spawn(command, args, options)
|
|
26
|
+
child.on("exit", code => {
|
|
27
|
+
if (code !== 0) {
|
|
28
|
+
reject(new Error(`Command failed with code ${code}`))
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
resolve()
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
}
|