zarro 1.94.4 → 1.96.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.
@@ -7,7 +7,7 @@ const myVars = [
7
7
  "BUILD_CONFIGURATION",
8
8
  "BUILD_VERBOSITY",
9
9
  "BUILD_MAX_CPU_COUNT",
10
- "BUILD_ERROR_ON_FAIL",
10
+ "BUILD_FAIL_ON_ERROR",
11
11
  "BUILD_PLATFORM",
12
12
  "BUILD_ARCHITECTURE",
13
13
  "BUILD_MSBUILD_NODE_REUSE"
@@ -25,7 +25,7 @@ gulp.task(
25
25
  configuration: env.resolve("BUILD_CONFIGURATION"),
26
26
  stdout: true,
27
27
  logCommand: true,
28
- errorOnFail: env.resolveFlag("BUILD_ERROR_ON_FAIL"),
28
+ errorOnFail: env.resolveFlag("BUILD_FAIL_ON_ERROR"),
29
29
  solutionPlatfor: env.resolve("BUILD_PLATFORM"),
30
30
  architecture: env.resolve("BUILD_ARCHITECTURE"),
31
31
  verbosity: env.resolve("BUILD_VERBOSITY"),
@@ -14,7 +14,7 @@ gulp.task(
14
14
  };
15
15
 
16
16
  const testInclusionsInverted = env.resolveArray("TEST_INCLUDE")
17
- .map(p => `!${p}.csproj`)
17
+ .map(p => `!${p}.csproj`);
18
18
  return gulp
19
19
  .src(["**/*.csproj"].concat(testInclusionsInverted))
20
20
  .pipe(
@@ -1,5 +1,6 @@
1
- {
2
- "globals": {
3
- "Promise": true
4
- }
5
- }
1
+ {
2
+ "globals": {
3
+ "Promise": true
4
+ },
5
+ "esversion": 6
6
+ }
@@ -1,81 +1,50 @@
1
-
2
- const
3
- spawn = require("./spawn"),
4
- quoteIfRequired = require("./quote-if-required"),
5
- splitPath = require("./split-path"),
6
- env = require("./env"),
7
- exec = require("./exec"),
8
- findLocalNuget = require("./find-local-nuget");
9
-
10
- function isDotnetCore(binaryPath) {
11
- const
12
- trimmed = binaryPath.replace(/^"/, "")
13
- .replace(/"$/, ""),
14
- parts = splitPath(trimmed),
15
- executable = (parts[parts.length-1] || "");
16
- return !!executable.match(/^dotnet(:?\.exe)?$/i);
17
- }
18
-
19
- async function nugetPush(
20
- packageFile,
21
- sourceName,
22
- options
23
- ) {
24
- options = options || {};
25
- options.suppressDuplicateError = options.suppressDuplicateError === undefined
26
- ? env.resolveFlag("NUGET_IGNORE_DUPLICATE_PACKAGES")
27
- : options.suppressDuplicateError;
28
-
29
- const
30
- apiKey = env.resolve("NUGET_API_KEY"),
31
- nuget = await findLocalNuget(),
32
- dnc = isDotnetCore(nuget),
33
- sourceArg = dnc ? "--source" : "-Source",
34
- // ffs dotnet core breaks things that used to be simple
35
- // -> _some_ nuget commands require 'dotnet nuget ...'
36
- // -> _others_ don't, eg 'dotnet restore'
37
- start = dnc ? [ "nuget" ] : [],
38
- args = start.concat([
39
- "push",
40
- quoteIfRequired(packageFile),
41
- sourceArg,
42
- sourceName || "nuget.org"
43
- ]),
44
- apiKeyArg = dnc ? "-k" : "-ApiKey";
45
- if (apiKey) {
46
- args.push.call(args, apiKeyArg, apiKey);
47
- } else if (dnc) {
48
- const
49
- stdout = [],
50
- dncVersionResponse = await spawn("dotnet", [ "--version"], {
51
- stdout: line => stdout.push(line.trim())
52
- }),
53
- version = (stdout[0] || "").split(".").map(s => parseInt(s));
54
- if (isNaN(version[0])) {
55
- console.warn("Can't determine version for dotnet executable - please read any failure output carefully");
56
- } else if (version[0] > 5) {
57
- throw new Error("NUGET_API_KEY environment variable is required to push with dotnet > 5");
58
- }
59
- }
60
- if (env.resolveFlag("DRY_RUN")) {
61
- console.log(`nuget publish dry run: ${nuget} ${args.join(" ")}`);
62
- return;
63
- }
64
- console.log(`pushing package ${packageFile}`);
65
- try {
66
- return await spawn(nuget, args);
67
- } catch (e) {
68
- if (e.info && Array.isArray(e.info.stderr)) {
69
- const
70
- errors = e.stderr.join("\n").trim(),
71
- isDuplicatePackageError = errors.match(/: 409 /);
72
- if (isDuplicatePackageError && options.suppressDuplicateError) {
73
- console.warn(`ignoring duplicate package error: ${errors}`);
74
- return e.info;
75
- }
76
- }
77
- throw e;
78
- }
79
- }
80
-
81
- module.exports = nugetPush;
1
+ "use strict";
2
+ (function () {
3
+ const spawn = require("./spawn"), quoteIfRequired = require("./quote-if-required"), splitPath = require("./split-path"), env = require("./env"), exec = require("./exec"), findLocalNuget = require("./find-local-nuget");
4
+ function isDotnetCore(binaryPath) {
5
+ const trimmed = binaryPath.replace(/^"/, "")
6
+ .replace(/"$/, ""), parts = splitPath(trimmed), executable = (parts[parts.length - 1] || "");
7
+ return !!executable.match(/^dotnet(:?\.exe)?$/i);
8
+ }
9
+ async function nugetPush(packageFile, sourceName, options) {
10
+ options = options || {};
11
+ options.suppressDuplicateError = options.suppressDuplicateError === undefined
12
+ ? env.resolveFlag("NUGET_IGNORE_DUPLICATE_PACKAGES")
13
+ : options.suppressDuplicateError;
14
+ const apiKey = env.resolve("NUGET_API_KEY"), nuget = await findLocalNuget(), dnc = isDotnetCore(nuget), sourceArg = dnc ? "--source" : "-Source",
15
+ // ffs dotnet core breaks things that used to be simple
16
+ // -> _some_ nuget commands require 'dotnet nuget ...'
17
+ // -> _others_ don't, eg 'dotnet restore'
18
+ start = dnc ? ["nuget"] : [], args = start.concat([
19
+ "push",
20
+ quoteIfRequired(packageFile),
21
+ sourceArg,
22
+ sourceName || "nuget.org"
23
+ ]), apiKeyArg = dnc ? "-k" : "-ApiKey";
24
+ if (apiKey) {
25
+ args.push.call(args, apiKeyArg, apiKey);
26
+ }
27
+ else if (dnc) {
28
+ throw new Error("You must set the NUGET_API_KEY environment variable to be able to push packages with the dotnet executable");
29
+ }
30
+ if (env.resolveFlag("DRY_RUN")) {
31
+ console.log(`nuget publish dry run: ${nuget} ${args.join(" ")}`);
32
+ return;
33
+ }
34
+ console.log(`pushing package ${packageFile}`);
35
+ try {
36
+ return await spawn(nuget, args);
37
+ }
38
+ catch (e) {
39
+ if (e.info && Array.isArray(e.info.stderr)) {
40
+ const errors = e.stderr.join("\n").trim(), isDuplicatePackageError = errors.match(/: 409 /);
41
+ if (isDuplicatePackageError && options.suppressDuplicateError) {
42
+ console.warn(`ignoring duplicate package error: ${errors}`);
43
+ return e.info;
44
+ }
45
+ }
46
+ throw e;
47
+ }
48
+ }
49
+ module.exports = nugetPush;
50
+ })();
@@ -0,0 +1,72 @@
1
+ (function() {
2
+ const
3
+ spawn = require("./spawn"),
4
+ quoteIfRequired = require("./quote-if-required"),
5
+ splitPath = require("./split-path"),
6
+ env = require("./env"),
7
+ exec = require("./exec"),
8
+ findLocalNuget = require("./find-local-nuget");
9
+
10
+ function isDotnetCore(binaryPath: string) {
11
+ const
12
+ trimmed = binaryPath.replace(/^"/, "")
13
+ .replace(/"$/, ""),
14
+ parts = splitPath(trimmed),
15
+ executable = (parts[parts.length - 1] || "");
16
+ return !!executable.match(/^dotnet(:?\.exe)?$/i);
17
+ }
18
+
19
+ async function nugetPush(
20
+ packageFile: string,
21
+ sourceName: string,
22
+ options: NugetPushOpts
23
+ ) {
24
+ options = options || {};
25
+ options.suppressDuplicateError = options.suppressDuplicateError === undefined
26
+ ? env.resolveFlag("NUGET_IGNORE_DUPLICATE_PACKAGES")
27
+ : options.suppressDuplicateError;
28
+
29
+ const
30
+ apiKey = env.resolve("NUGET_API_KEY"),
31
+ nuget = await findLocalNuget(),
32
+ dnc = isDotnetCore(nuget),
33
+ sourceArg = dnc ? "--source" : "-Source",
34
+ // ffs dotnet core breaks things that used to be simple
35
+ // -> _some_ nuget commands require 'dotnet nuget ...'
36
+ // -> _others_ don't, eg 'dotnet restore'
37
+ start = dnc ? [ "nuget" ] : [],
38
+ args = start.concat([
39
+ "push",
40
+ quoteIfRequired(packageFile),
41
+ sourceArg,
42
+ sourceName || "nuget.org"
43
+ ]),
44
+ apiKeyArg = dnc ? "-k" : "-ApiKey";
45
+ if (apiKey) {
46
+ args.push.call(args, apiKeyArg, apiKey);
47
+ } else if (dnc) {
48
+ throw new Error("You must set the NUGET_API_KEY environment variable to be able to push packages with the dotnet executable");
49
+ }
50
+ if (env.resolveFlag("DRY_RUN")) {
51
+ console.log(`nuget publish dry run: ${ nuget } ${ args.join(" ") }`);
52
+ return;
53
+ }
54
+ console.log(`pushing package ${ packageFile }`);
55
+ try {
56
+ return await spawn(nuget, args);
57
+ } catch (e) {
58
+ if (e.info && Array.isArray(e.info.stderr)) {
59
+ const
60
+ errors = e.stderr.join("\n").trim(),
61
+ isDuplicatePackageError = errors.match(/: 409 /);
62
+ if (isDuplicatePackageError && options.suppressDuplicateError) {
63
+ console.warn(`ignoring duplicate package error: ${ errors }`);
64
+ return e.info;
65
+ }
66
+ }
67
+ throw e;
68
+ }
69
+ }
70
+
71
+ module.exports = nugetPush;
72
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.94.4",
3
+ "version": "1.96.0",
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"
package/types.d.ts CHANGED
@@ -184,6 +184,10 @@ declare global {
184
184
  encoding?: string | null;
185
185
  }
186
186
 
187
+ export interface NugetPushOpts {
188
+ suppressDuplicateError?: boolean;
189
+ }
190
+
187
191
  type PackOptions = {
188
192
  basePath?: string;
189
193
  excludeEmptyDirectories?: boolean;