@zoodogood/utils 1.0.2-1 → 1.0.2-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.
|
@@ -17,8 +17,8 @@ interface IParams {
|
|
|
17
17
|
logger?: boolean;
|
|
18
18
|
}
|
|
19
19
|
declare const _default: ({ root, logger }: IParams) => {
|
|
20
|
-
run: (command: string, params: string[]) =>
|
|
21
|
-
info: (string: string) =>
|
|
20
|
+
run: (command: string, params: string[]) => IContext;
|
|
21
|
+
info: (string: string) => void;
|
|
22
22
|
_npm: string;
|
|
23
23
|
};
|
|
24
24
|
export default _default;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { spawn } from "child_process";
|
|
11
2
|
import EventsEmitter from "events";
|
|
12
3
|
export default ({ root, logger = false }) => {
|
|
@@ -65,8 +56,8 @@ export default ({ root, logger = false }) => {
|
|
|
65
56
|
},
|
|
66
57
|
},
|
|
67
58
|
];
|
|
68
|
-
const info = (string) =>
|
|
69
|
-
const run = (command, params) =>
|
|
59
|
+
const info = (string) => console.info(`\x1b[1m${string}\x1b[22m`);
|
|
60
|
+
const run = (command, params) => {
|
|
70
61
|
const child = spawn(command, params, { cwd: root });
|
|
71
62
|
const exitter = { resolve: null, reject: null };
|
|
72
63
|
const promise = new Promise((resolve, reject) => Object.assign(exitter, { resolve, reject }));
|
|
@@ -90,7 +81,7 @@ export default ({ root, logger = false }) => {
|
|
|
90
81
|
child.stderr.on("data", events.stderrData);
|
|
91
82
|
child.on("error", events.error);
|
|
92
83
|
child.on("message", events.message);
|
|
93
|
-
child.on("
|
|
84
|
+
child.on("exit", events.exit);
|
|
94
85
|
})();
|
|
95
86
|
promise.finally(() => {
|
|
96
87
|
child.stdout.removeListener("error", events.stdoutError);
|
|
@@ -99,9 +90,9 @@ export default ({ root, logger = false }) => {
|
|
|
99
90
|
child.stderr.removeListener("data", events.stderrData);
|
|
100
91
|
child.removeListener("error", events.error);
|
|
101
92
|
child.removeListener("message", events.message);
|
|
102
|
-
child.removeListener("
|
|
93
|
+
child.removeListener("exit", events.exit);
|
|
103
94
|
});
|
|
104
95
|
return context;
|
|
105
|
-
}
|
|
96
|
+
};
|
|
106
97
|
return { run, info, _npm };
|
|
107
98
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoodogood/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.2-
|
|
4
|
+
"version": "1.0.2-3",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "node index",
|
|
11
11
|
"docs-build": "cd ./docs & retype build --output ./public",
|
|
12
|
-
"
|
|
12
|
+
"prepack": "tsc"
|
|
13
13
|
},
|
|
14
14
|
"typings": "lib/index",
|
|
15
15
|
"exports": {
|
|
@@ -40,11 +40,21 @@
|
|
|
40
40
|
],
|
|
41
41
|
"typesVersions": {
|
|
42
42
|
">=4.2": {
|
|
43
|
-
"*": [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
43
|
+
"*": [
|
|
44
|
+
"lib/index.d.ts"
|
|
45
|
+
],
|
|
46
|
+
"primitives": [
|
|
47
|
+
"lib/primitives/mod.d.ts"
|
|
48
|
+
],
|
|
49
|
+
"objectives": [
|
|
50
|
+
"lib/objectives/mod.d.ts"
|
|
51
|
+
],
|
|
52
|
+
"discordjs": [
|
|
53
|
+
"lib/discordjs/mod.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"nodejs": [
|
|
56
|
+
"lib/nodejs/mod.d.ts"
|
|
57
|
+
]
|
|
48
58
|
}
|
|
49
59
|
}
|
|
50
60
|
}
|