zarro 1.141.1 → 1.141.2
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.
|
@@ -571,6 +571,36 @@
|
|
|
571
571
|
instruct Zarro to read the mapping in foo.json for extra msbuild properties to pass on
|
|
572
572
|
where applicable.`
|
|
573
573
|
});
|
|
574
|
+
env.register({
|
|
575
|
+
name: "DEV_SMTP_PORT",
|
|
576
|
+
help: `the port to start the smtp dev server on`,
|
|
577
|
+
default: "25"
|
|
578
|
+
});
|
|
579
|
+
env.register({
|
|
580
|
+
name: "DEV_SMTP_INTERFACE_PORT",
|
|
581
|
+
help: "the port to start the http interface on for the dev smtp server",
|
|
582
|
+
default: "8025"
|
|
583
|
+
});
|
|
584
|
+
env.register({
|
|
585
|
+
name: "DEV_SMTP_DETACHED",
|
|
586
|
+
help: "start the dev smtp server in the background (ie, don't wait on it); you'll have to stop it yourself",
|
|
587
|
+
default: "false"
|
|
588
|
+
});
|
|
589
|
+
env.register({
|
|
590
|
+
name: "DEV_SMTP_IGNORE_ERRORS",
|
|
591
|
+
help: "when set true, don't break on being unable to download or run the dev smtp server software - just log it and move on",
|
|
592
|
+
default: "false"
|
|
593
|
+
});
|
|
594
|
+
env.register({
|
|
595
|
+
name: "DEV_SMTP_BIND_IP",
|
|
596
|
+
help: "IP to listen on for SMTP connections; default is to bind to all available interfaces",
|
|
597
|
+
default: ""
|
|
598
|
+
});
|
|
599
|
+
env.register({
|
|
600
|
+
name: "DEV_SMTP_INTERFACE_BIND_IP",
|
|
601
|
+
help: "IP to listen on for the interface; default is to bind to all available interfaces",
|
|
602
|
+
default: ""
|
|
603
|
+
});
|
|
574
604
|
debug("-- env registration complete --");
|
|
575
605
|
};
|
|
576
606
|
})();
|
|
@@ -124,24 +124,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
124
124
|
opts.stdio = [...defaultOptions.stdio];
|
|
125
125
|
}
|
|
126
126
|
let stdOutWriter = nullConsumer, stdErrWriter = nullConsumer, stdoutFnSpecified = typeof opts.stdout === "function", stderrFnSpecified = typeof opts.stderr === "function";
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
opts.
|
|
131
|
-
}
|
|
132
|
-
if (stdoutFnSpecified) {
|
|
133
|
-
stdOutWriter = opts.stdout;
|
|
134
|
-
opts.stdio[1] = "pipe";
|
|
135
|
-
}
|
|
136
|
-
else if (Array.isArray(opts.stdio)) {
|
|
137
|
-
opts.stdio[1] = "inherit";
|
|
138
|
-
}
|
|
139
|
-
if (stderrFnSpecified) {
|
|
140
|
-
stdErrWriter = opts.stderr;
|
|
141
|
-
opts.stdio[2] = "pipe";
|
|
127
|
+
if (opts.detached) {
|
|
128
|
+
opts.stdio = "ignore";
|
|
129
|
+
opts.stdout = undefined;
|
|
130
|
+
opts.stderr = undefined;
|
|
142
131
|
}
|
|
143
|
-
else
|
|
144
|
-
|
|
132
|
+
else {
|
|
133
|
+
if ((stdoutFnSpecified || stderrFnSpecified) &&
|
|
134
|
+
!Array.isArray(opts.stdio) &&
|
|
135
|
+
!!defaultOptions.stdio /* just to make ts happy */) {
|
|
136
|
+
opts.stdio = [...defaultOptions.stdio];
|
|
137
|
+
}
|
|
138
|
+
if (stdoutFnSpecified) {
|
|
139
|
+
stdOutWriter = opts.stdout;
|
|
140
|
+
opts.stdio[1] = "pipe";
|
|
141
|
+
}
|
|
142
|
+
else if (Array.isArray(opts.stdio)) {
|
|
143
|
+
opts.stdio[1] = "inherit";
|
|
144
|
+
}
|
|
145
|
+
if (stderrFnSpecified) {
|
|
146
|
+
stdErrWriter = opts.stderr;
|
|
147
|
+
opts.stdio[2] = "pipe";
|
|
148
|
+
}
|
|
149
|
+
else if (Array.isArray(opts.stdio)) {
|
|
150
|
+
opts.stdio[2] = "inherit";
|
|
151
|
+
}
|
|
145
152
|
}
|
|
146
153
|
const result = new SpawnResult(executable, args, -1, [], []);
|
|
147
154
|
executable = quoteIfRequired(executable);
|
|
@@ -152,7 +159,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
152
159
|
try {
|
|
153
160
|
const child = child_process.spawn(executable, quotedArgs, opts);
|
|
154
161
|
if (!child) {
|
|
155
|
-
reject(new Error(`unable to spawn ${executable} with args [${args.join(",")}]`));
|
|
162
|
+
return reject(new Error(`unable to spawn ${executable} with args [${args.join(",")}]`));
|
|
163
|
+
}
|
|
164
|
+
if (opts.detached) {
|
|
165
|
+
return resolve(result);
|
|
156
166
|
}
|
|
157
167
|
debug(child);
|
|
158
168
|
const stdout = [];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
const { ZarroError } = requireModule("zarro-error"), { redBright } = requireModule("ansi-colors"), env = requireModule("env"), debug = require("debug")("start-smtp-server"), gulp = requireModule("gulp");
|
|
4
|
+
env.associate([
|
|
5
|
+
env.DEV_SMTP_DETACHED,
|
|
6
|
+
env.DEV_SMTP_PORT,
|
|
7
|
+
env.DEV_SMTP_BIND_IP,
|
|
8
|
+
env.DEV_SMTP_INTERFACE_PORT,
|
|
9
|
+
env.DEV_SMTP_INTERFACE_BIND_IP,
|
|
10
|
+
env.DEV_SMTP_IGNORE_ERRORS
|
|
11
|
+
], "start-dev-smtp-server");
|
|
12
|
+
gulp.task("start-dev-smtp-server", async () => {
|
|
13
|
+
const spawn = requireModule("spawn"), mailpitBinary = await downloadMailPitToToolsFolder(), mailpitAllIps = "[::]", smtpPort = env.resolveNumber(env.DEV_SMTP_PORT), smtpIp = env.resolveWithFallback(env.DEV_SMTP_BIND_IP, mailpitAllIps), smtpInterfacePort = env.resolveNumber(env.DEV_SMTP_INTERFACE_PORT), smtpInterfaceIp = env.resolveWithFallback(env.DEV_SMTP_INTERFACE_BIND_IP, mailpitAllIps), raiseErrors = !env.resolveFlag(env.DEV_SMTP_IGNORE_ERRORS);
|
|
14
|
+
if (mailpitBinary === undefined) {
|
|
15
|
+
const downloadError = `Unable to download mailpit from GitHub`;
|
|
16
|
+
if (raiseErrors) {
|
|
17
|
+
throw new ZarroError(downloadError);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
console.error(redBright(downloadError));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const args = [];
|
|
25
|
+
pushSmtpBind(args, smtpIp, smtpPort);
|
|
26
|
+
pushSmtpInterfacePort(args, smtpInterfaceIp, smtpInterfacePort);
|
|
27
|
+
try {
|
|
28
|
+
await spawn(mailpitBinary, args, {
|
|
29
|
+
detached: env.resolveFlag(env.DEV_SMTP_DETACHED)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
if (raiseErrors) {
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
const err = e;
|
|
37
|
+
logError(err.message || `${e}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
function logError(err) {
|
|
41
|
+
console.error(redBright(err));
|
|
42
|
+
}
|
|
43
|
+
function pushSmtpBind(args, ip, port) {
|
|
44
|
+
args.push("--smtp");
|
|
45
|
+
args.push(`${validateIp(ip)}:${port}`);
|
|
46
|
+
}
|
|
47
|
+
function pushSmtpInterfacePort(args, ip, port) {
|
|
48
|
+
args.push("--listen");
|
|
49
|
+
args.push(`${validateIp(ip)}:${port}`);
|
|
50
|
+
}
|
|
51
|
+
function validateIp(ip) {
|
|
52
|
+
if (ip.match(/^(\d{1,3}\.){3}\d{1,3}$/)) {
|
|
53
|
+
return ip;
|
|
54
|
+
}
|
|
55
|
+
throw new ZarroError(`provided value is not a valid IP: ${ip}`);
|
|
56
|
+
}
|
|
57
|
+
async function downloadMailPitToToolsFolder() {
|
|
58
|
+
const os = require("os"), { ls } = require("yafs"), path = require("path"), getToolsFolder = requireModule("get-tools-folder"), { fetchLatestRelease } = require("fetch-github-release");
|
|
59
|
+
const target = path.join(getToolsFolder(), "mailpit");
|
|
60
|
+
await fetchLatestRelease({
|
|
61
|
+
owner: "axllent",
|
|
62
|
+
repo: "mailpit",
|
|
63
|
+
destination: target,
|
|
64
|
+
shouldExtract: true
|
|
65
|
+
});
|
|
66
|
+
const contents = await ls(target, { fullPaths: true });
|
|
67
|
+
const seek = os.platform() === "win32"
|
|
68
|
+
? "mailpit.exe"
|
|
69
|
+
: "mailpit";
|
|
70
|
+
for (const item of contents) {
|
|
71
|
+
const fn = path.basename(item);
|
|
72
|
+
if (fn.toLowerCase() === seek) {
|
|
73
|
+
debug(`will start smtp server at: ${item}`);
|
|
74
|
+
return item;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
console.error(redBright(`Unable to find mailpit binary under ${target}`));
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zarro",
|
|
3
|
-
"version": "1.141.
|
|
3
|
+
"version": "1.141.2",
|
|
4
4
|
"description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
|
|
5
5
|
"bin": {
|
|
6
6
|
"zarro": "./index.js"
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"del": "^5.1.0",
|
|
45
45
|
"event-stream": "^4.0.1",
|
|
46
46
|
"fancy-log": "^1.3.3",
|
|
47
|
+
"fetch-github-release": "^1.0.0",
|
|
47
48
|
"gulp": "^4.0.2",
|
|
48
49
|
"gulp-debug": "^4.0.0",
|
|
49
50
|
"gulp-dotnet-cli": "^1.1.0",
|
package/types.d.ts
CHANGED
|
@@ -148,7 +148,9 @@ declare global {
|
|
|
148
148
|
"DOTNET_TEST_PREFIXES" |
|
|
149
149
|
"VERSION_INCREMENT_STRATEGY" |
|
|
150
150
|
"BUILD_TOOLS_FOLDER" |
|
|
151
|
-
"MSBUILD_PROPERTIES"
|
|
151
|
+
"MSBUILD_PROPERTIES" |
|
|
152
|
+
"DEV_SMTP_BIND_IP" |
|
|
153
|
+
"DEV_SMTP_INTERFACE_BIND_IP";
|
|
152
154
|
|
|
153
155
|
type NumericEnvVar =
|
|
154
156
|
"BUILD_MAX_CPU_COUNT" |
|
|
@@ -161,7 +163,9 @@ declare global {
|
|
|
161
163
|
"MAX_RETRIES" |
|
|
162
164
|
"BUILD_RETRIES" |
|
|
163
165
|
"RESTORE_RETRIES" |
|
|
164
|
-
"MAX_CONCURRENCY"
|
|
166
|
+
"MAX_CONCURRENCY" |
|
|
167
|
+
"DEV_SMTP_PORT" |
|
|
168
|
+
"DEV_SMTP_INTERFACE_PORT";
|
|
165
169
|
|
|
166
170
|
type FlagEnvVar =
|
|
167
171
|
"ENABLE_NUGET_PARALLEL_PROCESSING" |
|
|
@@ -196,7 +200,9 @@ declare global {
|
|
|
196
200
|
"DOTNET_PUBLISH_USE_CURRENT_RUNTIME" |
|
|
197
201
|
"PACK_NO_BUILD" |
|
|
198
202
|
"PACK_NO_RESTORE" |
|
|
199
|
-
"ZARRO_ENABLE_CONFIGURATION_FILES"
|
|
203
|
+
"ZARRO_ENABLE_CONFIGURATION_FILES" |
|
|
204
|
+
"DEV_SMTP_DETACHED" |
|
|
205
|
+
"DEV_SMTP_IGNORE_ERRORS";
|
|
200
206
|
|
|
201
207
|
type AnyEnvVar = StringEnvVar | NumericEnvVar | FlagEnvVar | VersionIncrementStrategy;
|
|
202
208
|
type OverrideWhen = (existing: Optional<string>, potential: Optional<string>) => boolean;
|
|
@@ -284,6 +290,8 @@ declare global {
|
|
|
284
290
|
VERSION_INCREMENT_STRATEGY: VersionIncrementStrategy;
|
|
285
291
|
BUILD_TOOLS_FOLDER: StringEnvVar;
|
|
286
292
|
MSBUILD_PROPERTIES: StringEnvVar;
|
|
293
|
+
DEV_SMTP_BIND_IP: StringEnvVar;
|
|
294
|
+
DEV_SMTP_INTERFACE_BIND_IP: StringEnvVar;
|
|
287
295
|
|
|
288
296
|
ENABLE_NUGET_PARALLEL_PROCESSING: FlagEnvVar;
|
|
289
297
|
BUILD_SHOW_INFO: FlagEnvVar;
|
|
@@ -317,6 +325,8 @@ declare global {
|
|
|
317
325
|
PACK_NO_RESTORE: FlagEnvVar;
|
|
318
326
|
PACK_IGNORE_MISSING_DEFAULT_NUSPEC: FlagEnvVar;
|
|
319
327
|
ZARRO_ENABLE_CONFIGURATION_FILES: FlagEnvVar;
|
|
328
|
+
DEV_SMTP_DETACHED: FlagEnvVar;
|
|
329
|
+
DEV_SMTP_IGNORE_ERRORS: FlagEnvVar;
|
|
320
330
|
|
|
321
331
|
BUILD_MAX_CPU_COUNT: NumericEnvVar;
|
|
322
332
|
MAX_NUNIT_AGENTS: NumericEnvVar;
|
|
@@ -329,6 +339,8 @@ declare global {
|
|
|
329
339
|
BUILD_RETRIES: NumericEnvVar;
|
|
330
340
|
RESTORE_RETRIES: NumericEnvVar;
|
|
331
341
|
MAX_CONCURRENCY: NumericEnvVar;
|
|
342
|
+
DEV_SMTP_PORT: NumericEnvVar;
|
|
343
|
+
DEV_SMTP_INTERFACE_PORT: NumericEnvVar;
|
|
332
344
|
}
|
|
333
345
|
|
|
334
346
|
type StatFunction = (path: string) => Promise<fs.Stats | null>
|
|
@@ -587,6 +599,8 @@ declare global {
|
|
|
587
599
|
stderr?: ProcessIO;
|
|
588
600
|
lineBuffer?: boolean;
|
|
589
601
|
|
|
602
|
+
detached?: boolean;
|
|
603
|
+
|
|
590
604
|
/*
|
|
591
605
|
* when a process is marked as interactive, no stderr/stdout
|
|
592
606
|
* collection is done as the IO is left as "inherit"
|