zarro 1.184.0 → 1.186.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/gulp-tasks/modules/parse-flag.js +47 -0
- package/gulp-tasks/modules/system.js +15 -0
- package/package.json +1 -1
- package/types.d.ts +17 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
const positives = new Set([
|
|
4
|
+
"yes",
|
|
5
|
+
"y",
|
|
6
|
+
"1",
|
|
7
|
+
"true",
|
|
8
|
+
"on"
|
|
9
|
+
]);
|
|
10
|
+
const negatives = new Set([
|
|
11
|
+
"no",
|
|
12
|
+
"n",
|
|
13
|
+
"0",
|
|
14
|
+
"false",
|
|
15
|
+
"off"
|
|
16
|
+
]);
|
|
17
|
+
function parseFlag(value, fallback) {
|
|
18
|
+
const lower = (value || "").toLowerCase();
|
|
19
|
+
if (positives.has(lower)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (negatives.has(lower)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (fallback !== undefined) {
|
|
26
|
+
return fallback;
|
|
27
|
+
}
|
|
28
|
+
const possiblePositives = [];
|
|
29
|
+
for (const item of positives) {
|
|
30
|
+
possiblePositives.push(item);
|
|
31
|
+
}
|
|
32
|
+
const possibleNegatives = [];
|
|
33
|
+
for (const item of negatives) {
|
|
34
|
+
possibleNegatives.push(item);
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`${value} is not a valid flag value.
|
|
37
|
+
Try one of:
|
|
38
|
+
- accepted truthy values:
|
|
39
|
+
${possiblePositives.join(", ")}
|
|
40
|
+
- accepted falsey values:
|
|
41
|
+
${possibleNegatives.join(", ")}
|
|
42
|
+
`);
|
|
43
|
+
}
|
|
44
|
+
module.exports = {
|
|
45
|
+
parseFlag
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
@@ -91,6 +91,21 @@ ${tempFileContents}
|
|
|
91
91
|
const result = new SystemResult(`${exe}`, programArgs, undefined, [], []);
|
|
92
92
|
return new Promise((resolve, reject) => {
|
|
93
93
|
const child = child_process.spawn(exe, programArgs, spawnOptions);
|
|
94
|
+
if (!!options) {
|
|
95
|
+
const optsWithKill = options;
|
|
96
|
+
optsWithKill.kill = (signal) => {
|
|
97
|
+
destroyPipesOn(child);
|
|
98
|
+
child.kill(signal);
|
|
99
|
+
};
|
|
100
|
+
if (optsWithKill === null || optsWithKill === void 0 ? void 0 : optsWithKill.onChildSpawned) {
|
|
101
|
+
try {
|
|
102
|
+
optsWithKill.onChildSpawned(child, optsWithKill);
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
// suppress
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
94
109
|
const stdoutFn = typeof opts.stdout === "function" ? opts.stdout : noop;
|
|
95
110
|
const stderrFn = typeof opts.stderr === "function" ? opts.stderr : noop;
|
|
96
111
|
const stdoutLineBuffer = new LineBuffer(s => {
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { StatsBase } from "fs";
|
|
|
5
5
|
import { Stream, Transform } from "stream";
|
|
6
6
|
import ansiColors, { StyleFunction } from "ansi-colors";
|
|
7
7
|
import { RimrafOptions } from "./gulp-tasks/modules/rimraf";
|
|
8
|
-
import { ExecFileOptionsWithBufferEncoding } from "child_process";
|
|
8
|
+
import { ChildProcess, ExecFileOptionsWithBufferEncoding } from "child_process";
|
|
9
9
|
import * as vinyl from "vinyl";
|
|
10
10
|
import { BufferFile } from "vinyl";
|
|
11
11
|
// noinspection ES6PreferShortImport
|
|
@@ -546,6 +546,10 @@ declare global {
|
|
|
546
546
|
open(url: string): Promise<void>;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
+
interface ParseFlag {
|
|
550
|
+
parseFlag: (value: string, fallback?: boolean) => boolean;
|
|
551
|
+
}
|
|
552
|
+
|
|
549
553
|
type ResolveNugetApiKey = (forSource?: string) => Promise<Optional<string>>;
|
|
550
554
|
|
|
551
555
|
interface Env
|
|
@@ -1091,6 +1095,7 @@ declare global {
|
|
|
1091
1095
|
* io writer or the result from after spawn completes
|
|
1092
1096
|
*/
|
|
1093
1097
|
suppressOutput?: boolean;
|
|
1098
|
+
|
|
1094
1099
|
}
|
|
1095
1100
|
|
|
1096
1101
|
interface SystemOptions {
|
|
@@ -1130,6 +1135,17 @@ declare global {
|
|
|
1130
1135
|
* / error as the first argument, with the exe set to either cmd or sh
|
|
1131
1136
|
*/
|
|
1132
1137
|
keepTempFiles?: boolean;
|
|
1138
|
+
|
|
1139
|
+
// gain direct access to the child process as
|
|
1140
|
+
// soon as it spawns
|
|
1141
|
+
onChildSpawned?: (child: ChildProcess, originalOptions: SystemOptionsWithKill) => void;
|
|
1142
|
+
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
interface SystemOptionsWithKill extends SystemOptions {
|
|
1146
|
+
// this function will be filled in for you once the
|
|
1147
|
+
// child process has started
|
|
1148
|
+
kill: (signal?: NodeJS.Signals | number) => void;
|
|
1133
1149
|
}
|
|
1134
1150
|
|
|
1135
1151
|
/**
|