zarro 1.136.1 → 1.136.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.
@@ -5,8 +5,6 @@ const
5
5
  gulp = requireModule("gulp"),
6
6
  debug = require("debug")("build"),
7
7
  promisifyStream = requireModule("promisify"),
8
- dotnetCli = require("gulp-dotnet-cli"),
9
- dotnetBuild = dotnetCli.build,
10
8
  throwIfNoFiles = requireModule("throw-if-no-files"),
11
9
  xbuild = requireModule("gulp-xbuild"),
12
10
  gutil = requireModule("gulp-util"),
@@ -90,7 +88,7 @@ function buildForNetCore(solutions) {
90
88
  const options = {
91
89
  target: "[not set]",
92
90
  verbosity: env.resolve("BUILD_VERBOSITY"),
93
- configuration,
91
+ configurations: configuration,
94
92
  additionalArguments: msbuildArgs
95
93
  };
96
94
  return promisifyStream(
@@ -5,7 +5,7 @@ const
5
5
  debug = require("debug")("clean"),
6
6
  throwIfNoFiles = requireModule("throw-if-no-files"),
7
7
  msbuild = require("gulp-msbuild"),
8
- dotnetClean = require("gulp-dotnet-cli").clean,
8
+ dotnetClean = requireModule("gulp-dotnet-cli").clean,
9
9
  resolveMasks = requireModule("resolve-masks"),
10
10
  env = requireModule("env");
11
11
  const chalk = require("ansi-colors");
@@ -19,7 +19,8 @@ const myVars = [
19
19
  "BUILD_PLATFORM",
20
20
  "BUILD_ARCHITECTURE",
21
21
  "BUILD_MSBUILD_NODE_REUSE",
22
- "BUILD_RETRIES"
22
+ "BUILD_RETRIES",
23
+ "BUILD_TARGETS"
23
24
  ];
24
25
  env.associate(myVars, "clean");
25
26
 
@@ -49,9 +50,11 @@ function clean() {
49
50
  async function cleanWithDotnet() {
50
51
  const
51
52
  configuration = env.resolve("BUILD_CONFIGURATION"),
52
- slnMasks = resolveBuildSolutionMasks();
53
+ slnMasks = resolveBuildSolutionMasks(),
54
+ targets = env.resolveArray("BUILD_TARGETS");
53
55
  debug({
54
56
  slnMasks,
57
+ targets,
55
58
  cwd: process.cwd()
56
59
  });
57
60
  const solutions = gulp
@@ -1,9 +1,137 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  (function () {
3
- // TODO: perhaps one day, this should become an npm module of its own
4
4
  const spawn = requireModule("spawn");
5
+ const { isSpawnError } = spawn;
5
6
  const q = requireModule("quote-if-required");
6
7
  let defaultNugetSource;
8
+ async function clean(opts) {
9
+ return runOnAllConfigurations(opts, configuration => {
10
+ const args = [
11
+ "clean",
12
+ q(opts.target)
13
+ ];
14
+ pushFramework(args, opts);
15
+ pushRuntime(args, opts);
16
+ pushConfiguration(args, configuration);
17
+ pushVerbosity(args, opts);
18
+ pushOutput(args, opts);
19
+ return runDotNetWith(args, opts);
20
+ });
21
+ }
22
+ async function build(opts) {
23
+ return runOnAllConfigurations(opts, configuration => {
24
+ const args = [
25
+ "build",
26
+ q(opts.target)
27
+ ];
28
+ pushCommonBuildArgs(args, opts, configuration);
29
+ pushFlag(args, opts.disableBuildServers, "--disable-build-servers");
30
+ pushFlag(args, opts.noIncremental, "--no-incremental");
31
+ pushFlag(args, opts.noDependencies, "--no-dependencies");
32
+ pushFlag(args, opts.noRestore, "--no-restore");
33
+ pushFlag(args, opts.selfContained, "--self-contained");
34
+ pushVersionSuffix(args, opts);
35
+ pushMsbuildProperties(args, opts);
36
+ pushAdditionalArgs(args, opts);
37
+ return runDotNetWith(args, opts);
38
+ });
39
+ }
40
+ async function test(opts) {
41
+ return runOnAllConfigurations(opts, configuration => {
42
+ const args = [
43
+ "test",
44
+ q(opts.target)
45
+ ];
46
+ pushCommonBuildArgs(args, opts, configuration);
47
+ pushIfSet(args, opts.settingsFile, "--settings");
48
+ pushIfSet(args, opts.filter, "--filter");
49
+ pushIfSet(args, opts.diagnostics, "--diag");
50
+ pushNoBuild(args, opts);
51
+ pushNoRestore(args, opts);
52
+ pushLoggers(args, opts.loggers);
53
+ pushMsbuildProperties(args, opts);
54
+ pushEnvVars(args, opts.env);
55
+ pushAdditionalArgs(args, opts);
56
+ // there's a lot of stdio/stderr from tests, and it
57
+ // should be shown already - including it in the
58
+ // error dump is not only unnecessary, it confuses
59
+ // the test handler wrt quackers output handling
60
+ opts.suppressStdIoInErrors = true;
61
+ return runDotNetWith(args, opts);
62
+ });
63
+ }
64
+ async function pack(opts) {
65
+ return runOnAllConfigurations(opts, configuration => {
66
+ const copy = Object.assign(Object.assign({}, opts), { msbuildProperties: Object.assign({}, opts.msbuildProperties) });
67
+ const args = [
68
+ "pack",
69
+ q(copy.target)
70
+ ];
71
+ pushConfiguration(args, configuration);
72
+ pushVerbosity(args, copy);
73
+ pushOutput(args, copy);
74
+ pushNoBuild(args, copy);
75
+ pushFlag(args, copy.includeSymbols, "--include-symbols");
76
+ pushFlag(args, copy.includeSource, "--include-source");
77
+ pushNoRestore(args, copy);
78
+ pushVersionSuffix(args, copy);
79
+ if (copy.nuspec) {
80
+ copy.msbuildProperties = copy.msbuildProperties || {};
81
+ copy.msbuildProperties["NuspecFile"] = copy.nuspec;
82
+ }
83
+ pushMsbuildProperties(args, copy);
84
+ return runDotNetWith(args, copy);
85
+ });
86
+ }
87
+ async function nugetPush(opts) {
88
+ validate(opts);
89
+ if (!opts.apiKey) {
90
+ throw new Error("apiKey was not specified");
91
+ }
92
+ const args = [
93
+ "nuget",
94
+ "push",
95
+ opts.target,
96
+ "--api-key",
97
+ opts.apiKey
98
+ ];
99
+ if (!opts.source) {
100
+ // dotnet core _demands_ that the source be set.
101
+ opts.source = await determineDefaultNugetSource();
102
+ }
103
+ pushIfSet(args, opts.source, "--source");
104
+ pushIfSet(args, opts.symbolApiKey, "--symbol-api-key");
105
+ pushIfSet(args, opts.symbolSource, "--symbol-source");
106
+ pushIfSet(args, opts.timeout, "--timeout");
107
+ pushFlag(args, opts.disableBuffering, "--disable-buffering");
108
+ pushFlag(args, opts.noSymbols, "--no-symbols");
109
+ pushFlag(args, opts.skipDuplicate, "--skip-duplicate");
110
+ pushFlag(args, opts.noServiceEndpoint, "--no-service-endpoint");
111
+ pushFlag(args, opts.forceEnglishOutput, "--force-english-output");
112
+ return runDotNetWith(args, opts);
113
+ }
114
+ async function runOnAllConfigurations(opts, toRun) {
115
+ validate(opts);
116
+ let configurations = resolveConfigurations(opts);
117
+ if (configurations.length < 1) {
118
+ configurations = [...defaultConfigurations];
119
+ }
120
+ let lastResult;
121
+ for (const configuration of configurations) {
122
+ const thisResult = await toRun(configuration);
123
+ if (isSpawnError(thisResult)) {
124
+ return thisResult;
125
+ }
126
+ lastResult = thisResult;
127
+ }
128
+ // for simplicity: return the last spawn result (at least for now, until there's a reason to get clever)
129
+ if (lastResult === undefined) {
130
+ // this is really here for TS
131
+ throw new Error(`No build configurations could be determined, which is odd, because there's even a fallback.`);
132
+ }
133
+ return lastResult;
134
+ }
7
135
  async function determineDefaultNugetSource() {
8
136
  if (defaultNugetSource) {
9
137
  return defaultNugetSource;
@@ -42,100 +170,42 @@
42
170
  }
43
171
  return result;
44
172
  }
45
- async function nugetPush(opts) {
46
- validate(opts);
47
- if (!opts.apiKey) {
48
- throw new Error("apiKey was not specified");
173
+ // this is actually a viable configuration... but we're going to use
174
+ // it as a flag to not put in -c at all
175
+ const defaultConfigurations = ["default"];
176
+ function resolveConfigurations(opts) {
177
+ if (!opts.configuration) {
178
+ return defaultConfigurations;
49
179
  }
50
- const args = [
51
- "nuget",
52
- "push",
53
- opts.target,
54
- "--api-key",
55
- opts.apiKey
56
- ];
57
- if (!opts.source) {
58
- // dotnet core _demands_ that the source be set.
59
- opts.source = await determineDefaultNugetSource();
60
- }
61
- pushIfSet(args, opts.source, "--source");
62
- pushIfSet(args, opts.symbolApiKey, "--symbol-api-key");
63
- pushIfSet(args, opts.symbolSource, "--symbol-source");
64
- pushIfSet(args, opts.timeout, "--timeout");
65
- pushFlag(args, opts.disableBuffering, "--disable-buffering");
66
- pushFlag(args, opts.noSymbols, "--no-symbols");
67
- pushFlag(args, opts.skipDuplicate, "--skip-duplicate");
68
- pushFlag(args, opts.noServiceEndpoint, "--no-service-endpoint");
69
- pushFlag(args, opts.forceEnglishOutput, "--force-english-output");
70
- return runDotNetWith(args, opts);
71
- }
72
- async function build(opts) {
73
- validate(opts);
74
- const args = [
75
- "build",
76
- q(opts.target)
77
- ];
78
- pushCommonBuildArgs(args, opts);
79
- pushFlag(args, opts.disableBuildServers, "--disable-build-servers");
80
- pushFlag(args, opts.noIncremental, "--no-incremental");
81
- pushFlag(args, opts.noDependencies, "--no-dependencies");
82
- pushFlag(args, opts.noRestore, "--no-restore");
83
- pushFlag(args, opts.selfContained, "--self-contained");
84
- pushVersionSuffix(args, opts);
85
- pushMsbuildProperties(args, opts);
86
- pushAdditionalArgs(args, opts);
87
- return runDotNetWith(args, opts);
88
- }
89
- async function test(opts) {
90
- const args = [
91
- "test",
92
- q(opts.target)
93
- ];
94
- pushCommonBuildArgs(args, opts);
95
- pushIfSet(args, opts.settingsFile, "--settings");
96
- pushIfSet(args, opts.filter, "--filter");
97
- pushIfSet(args, opts.diagnostics, "--diag");
98
- pushNoBuild(args, opts);
99
- pushNoRestore(args, opts);
100
- pushLoggers(args, opts.loggers);
101
- pushMsbuildProperties(args, opts);
102
- pushEnvVars(args, opts.env);
103
- pushAdditionalArgs(args, opts);
104
- // there's a lot of stdio/stderr from tests, and it
105
- // should be shown already - including it in the
106
- // error dump is not only unnecessary, it confuses
107
- // the test handler wrt quackers output handling
108
- opts.suppressStdIoInErrors = true;
109
- return runDotNetWith(args, opts);
180
+ return Array.isArray(opts.configuration)
181
+ ? opts.configuration
182
+ : [opts.configuration];
110
183
  }
111
- async function pack(opts) {
112
- validate(opts);
113
- const copy = Object.assign(Object.assign({}, opts), { msbuildProperties: Object.assign({}, opts.msbuildProperties) });
114
- const args = [
115
- "pack",
116
- q(copy.target)
117
- ];
118
- pushVerbosity(args, copy);
119
- pushOutput(args, copy);
120
- pushConfiguration(args, copy);
121
- pushNoBuild(args, copy);
122
- pushFlag(args, copy.includeSymbols, "--include-symbols");
123
- pushFlag(args, copy.includeSource, "--include-source");
124
- pushNoRestore(args, copy);
125
- pushVersionSuffix(args, copy);
126
- if (copy.nuspec) {
127
- copy.msbuildProperties = copy.msbuildProperties || {};
128
- copy.msbuildProperties["NuspecFile"] = copy.nuspec;
129
- }
130
- pushMsbuildProperties(args, copy);
131
- return runDotNetWith(args, copy);
132
- }
133
- function pushCommonBuildArgs(args, opts) {
134
- pushVerbosity(args, opts);
135
- pushConfiguration(args, opts);
184
+ function pushFramework(args, opts) {
136
185
  pushIfSet(args, opts.framework, "--framework");
186
+ }
187
+ function pushRuntime(args, opts) {
137
188
  pushIfSet(args, opts.runtime, "--runtime");
189
+ }
190
+ function pushArch(args, opts) {
138
191
  pushIfSet(args, opts.arch, "--arch");
192
+ }
193
+ function pushConfiguration(args, configuration) {
194
+ debugger;
195
+ if (!configuration) {
196
+ return;
197
+ }
198
+ if (configuration.toLowerCase() === "default") {
199
+ return;
200
+ }
201
+ args.push.call(args, "--configuration", configuration);
202
+ }
203
+ function pushCommonBuildArgs(args, opts, configuration) {
204
+ pushVerbosity(args, opts);
205
+ pushConfiguration(args, configuration);
206
+ pushFramework(args, opts);
207
+ pushRuntime(args, opts);
208
+ pushArch(args, opts);
139
209
  pushIfSet(args, opts.os, "--os");
140
210
  pushOutput(args, opts);
141
211
  }
@@ -162,9 +232,6 @@
162
232
  function pushVerbosity(args, opts) {
163
233
  pushIfSet(args, opts.verbosity, "--verbosity");
164
234
  }
165
- function pushConfiguration(args, opts) {
166
- pushIfSet(args, opts.configuration, "--configuration");
167
- }
168
235
  function pushAdditionalArgs(args, opts) {
169
236
  if (opts.additionalArguments) {
170
237
  args.push.apply(args, opts.additionalArguments);
@@ -230,6 +297,7 @@
230
297
  test,
231
298
  build,
232
299
  pack,
300
+ clean,
233
301
  nugetPush
234
302
  };
235
303
  })();
@@ -14,24 +14,19 @@
14
14
  // otherwise, discard the result
15
15
  };
16
16
  }
17
- function pack(opts) {
18
- return streamify(wrap(dotnetCli.pack), async (f) => {
17
+ function build(opts) {
18
+ return streamify(wrap(dotnetCli.build), f => {
19
19
  const copy = Object.assign({}, opts);
20
20
  copy.target = f.path;
21
- const containingFolder = path.dirname(f.path);
22
- const supplementaryNuspec = path.resolve(path.join(containingFolder, env.resolve(env.PACK_SUPPLEMENTARY_NUSPEC)));
23
- if (await fileExists(supplementaryNuspec)) {
24
- copy.nuspec = supplementaryNuspec;
25
- }
26
21
  return copy;
27
- }, "gulp-dotnet-cli-pack", "creating nuget package");
22
+ }, "gulp-dotnet-cli-build", "building project or solution");
28
23
  }
29
- function build(opts) {
30
- return streamify(wrap(dotnetCli.build), f => {
24
+ function clean(opts) {
25
+ return streamify(wrap(dotnetCli.clean), f => {
31
26
  const copy = Object.assign({}, opts);
32
27
  copy.target = f.path;
33
28
  return copy;
34
- }, "gulp-dotnet-cli-build", "building project or solution");
29
+ }, "gulp-dotnet-cli-clean", "cleaning project or solution");
35
30
  }
36
31
  function test(opts) {
37
32
  return streamify(wrap(dotnetCli.test), f => {
@@ -40,6 +35,18 @@
40
35
  return copy;
41
36
  }, "gulp-dotnet-cli-pack", "creating nuget package");
42
37
  }
38
+ function pack(opts) {
39
+ return streamify(wrap(dotnetCli.pack), async (f) => {
40
+ const copy = Object.assign({}, opts);
41
+ copy.target = f.path;
42
+ const containingFolder = path.dirname(f.path);
43
+ const supplementaryNuspec = path.resolve(path.join(containingFolder, env.resolve(env.PACK_SUPPLEMENTARY_NUSPEC)));
44
+ if (await fileExists(supplementaryNuspec)) {
45
+ copy.nuspec = supplementaryNuspec;
46
+ }
47
+ return copy;
48
+ }, "gulp-dotnet-cli-pack", "creating nuget package");
49
+ }
43
50
  function nugetPush(opts) {
44
51
  return streamify(wrap(dotnetCli.nugetPush), f => {
45
52
  const copy = Object.assign({}, opts);
@@ -49,6 +56,7 @@
49
56
  }
50
57
  module.exports = {
51
58
  build,
59
+ clean,
52
60
  test,
53
61
  pack,
54
62
  nugetPush
@@ -243,5 +243,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
243
243
  }
244
244
  spawn.SpawnError = SpawnError;
245
245
  spawn.SpawnResult = SpawnResult;
246
+ spawn.isSpawnError = function (o) {
247
+ return o instanceof SpawnError;
248
+ };
249
+ spawn.isSpawnResult = function (o) {
250
+ return o instanceof SpawnResult;
251
+ };
246
252
  module.exports = spawn;
247
253
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.136.1",
3
+ "version": "1.136.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"
package/types.d.ts CHANGED
@@ -541,6 +541,8 @@ declare global {
541
541
  interface Spawn extends SpawnFunction {
542
542
  SpawnResult: Function;
543
543
  SpawnError: Function;
544
+ isSpawnError: (o: any) => o is SpawnError;
545
+ isSpawnResult: (o: any) => o is SpawnResult;
544
546
  }
545
547
 
546
548
  type AskOptions = {}
@@ -575,7 +577,7 @@ declare global {
575
577
 
576
578
  interface DotNetCommonBuildOptions extends DotNetBaseOptions {
577
579
  target: string;
578
- configuration?: string;
580
+ configuration?: string | string[];
579
581
  framework?: string;
580
582
  runtime?: string;
581
583
  output?: string;
@@ -586,7 +588,7 @@ declare global {
586
588
  interface DotNetPackOptions extends DotNetBaseOptions {
587
589
  target: string;
588
590
  output?: string;
589
- configuration?: string;
591
+ configuration?: string | string[];
590
592
  noBuild?: boolean;
591
593
  includeSymbols?: boolean;
592
594
  includeSource?: boolean;
@@ -604,6 +606,14 @@ declare global {
604
606
  versionSuffix?: string;
605
607
  }
606
608
 
609
+ interface DotNetCleanOptions extends DotNetBaseOptions {
610
+ target: string;
611
+ framework?: string;
612
+ runtime?: string;
613
+ configuration?: string | string[],
614
+ output?: string;
615
+ }
616
+
607
617
  interface DotNetNugetPushOptions extends DotNetBaseOptions {
608
618
  target: string;
609
619
  apiKey: string;
@@ -637,14 +647,31 @@ declare global {
637
647
  type DotNetBuildFunction = (opts: DotNetBuildOptions) => Promise<SpawnResult | SpawnError>;
638
648
  type DotNetPackFunction = (opts: DotNetPackOptions) => Promise<SpawnResult | SpawnError>;
639
649
  type DotNetNugetPushFunction = (opts: DotNetNugetPushOptions) => Promise<SpawnResult | SpawnError>;
650
+ type DotNetCleanFunction = (opts: DotNetCleanOptions) => Promise<SpawnResult | SpawnError>;
640
651
 
641
652
  interface DotNetCli {
642
- test: DotNetTestFunction;
653
+ clean: DotNetCleanFunction;
643
654
  build: DotNetBuildFunction;
655
+ test: DotNetTestFunction;
644
656
  pack: DotNetPackFunction;
645
657
  nugetPush: DotNetNugetPushFunction;
646
658
  }
647
659
 
660
+ type TransformFunction<T> = (opts: T) => Transform;
661
+ type GulpDotNetTestFunction = TransformFunction<DotNetTestOptions>;
662
+ type GulpDotNetBuildFunction = TransformFunction<DotNetBuildOptions>;
663
+ type GulpDotNetPackFunction = TransformFunction<DotNetPackOptions>;
664
+ type GulpDotNetNugetPushFunction = TransformFunction<DotNetNugetPushOptions>;
665
+ type GulpDotNetCleanFunction = TransformFunction<DotNetCleanOptions>;
666
+
667
+ interface GulpDotNetCli {
668
+ build: GulpDotNetBuildFunction;
669
+ clean: GulpDotNetCleanFunction;
670
+ test: GulpDotNetTestFunction;
671
+ pack: GulpDotNetPackFunction;
672
+ nugetPush: GulpDotNetNugetPushFunction;
673
+ }
674
+
648
675
  // scraped from https://spdx.org/licenses/
649
676
  // with the following fragment from FF dev console
650
677
  // copy(Array.from(document.querySelector("table").querySelectorAll("tr")).map(tr => {