zarro 1.130.3 → 1.130.4
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.
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
(function () {
|
|
3
3
|
const spawn = requireModule("spawn");
|
|
4
4
|
const q = requireModule("quote-if-required");
|
|
5
|
+
let defaultNugetSource;
|
|
6
|
+
async function determineDefaultNugetSource() {
|
|
7
|
+
if (defaultNugetSource) {
|
|
8
|
+
return defaultNugetSource;
|
|
9
|
+
}
|
|
10
|
+
const args = [
|
|
11
|
+
"nuget",
|
|
12
|
+
"list",
|
|
13
|
+
"source"
|
|
14
|
+
];
|
|
15
|
+
const lines = [];
|
|
16
|
+
await spawn("dotnet", args, {
|
|
17
|
+
stdout: line => {
|
|
18
|
+
lines.push(line);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const enabledSources = lines
|
|
22
|
+
.join("\n") // can't guarantee we got lines individually
|
|
23
|
+
.split("\n")
|
|
24
|
+
.map(l => l.trim())
|
|
25
|
+
.filter(l => l.indexOf("[Enabled]") > -1)
|
|
26
|
+
// lines should come through like " 1. nuget.org [Enabled]"
|
|
27
|
+
.map(l => l.replace(/^\s*\d+\.\s*/, "").replace("[Enabled]", "").trim())
|
|
28
|
+
.sort((a, b) => {
|
|
29
|
+
// try to sort such that nuget.org is at the top, if in the list
|
|
30
|
+
if (a.toLowerCase().indexOf("nuget.org") > -1) {
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
if (b.toLowerCase().indexOf("nuget.org") > -1) {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
37
|
+
});
|
|
38
|
+
const result = enabledSources[0];
|
|
39
|
+
if (!result) {
|
|
40
|
+
throw new Error(`Unable to determine default nuget source. Please specify 'source' on your options.`);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
5
44
|
async function nugetPush(opts) {
|
|
6
45
|
validate(opts);
|
|
7
46
|
if (!opts.apiKey) {
|
|
@@ -14,8 +53,12 @@
|
|
|
14
53
|
"--api-key",
|
|
15
54
|
opts.apiKey
|
|
16
55
|
];
|
|
17
|
-
|
|
56
|
+
if (!opts.source) {
|
|
57
|
+
// dotnet core _demands_ that the source be set.
|
|
58
|
+
opts.source = await determineDefaultNugetSource();
|
|
59
|
+
}
|
|
18
60
|
pushIfSet(args, opts.source, "--source");
|
|
61
|
+
pushIfSet(args, opts.symbolApiKey, "--symbol-api-key");
|
|
19
62
|
pushIfSet(args, opts.symbolSource, "--symbol-source");
|
|
20
63
|
pushIfSet(args, opts.timeout, "--timeout");
|
|
21
64
|
pushFlag(args, opts.disableBuffering, "--disable-buffering");
|