zarro 1.167.0 → 1.168.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.
@@ -12,8 +12,10 @@
12
12
  debug(JSON.stringify(xml, null, 2));
13
13
  const packageVersionPropGroup = xml.Project.PropertyGroup.filter((g) => !!g.PackageVersion)[0];
14
14
  if (!packageVersionPropGroup) {
15
- debug("No PropertyGroup found with PackageVersion node");
16
- return xml;
15
+ // if we got in here, then something wants to increment
16
+ // the package version, but we can't unless the correct
17
+ // structure is found in the project
18
+ throw new ZarroError(`Unable to increment package version in '${file.path}': no PropertyGroup containing a PackageVersion node was found.`);
17
19
  }
18
20
  const node = packageVersionPropGroup.PackageVersion;
19
21
  const newVersion = incrementVersion(node[0], env.resolveFlag("BETA")
@@ -10,10 +10,11 @@
10
10
  await dotnetCli.nugetPush(opts);
11
11
  }
12
12
  async function nugetPush(packageFile, sourceName, options) {
13
+ var _a;
13
14
  const nugetPushSource = sourceName ||
14
15
  env.resolve(env.NUGET_PUSH_SOURCE, env.NUGET_SOURCE) ||
15
16
  "nuget.org";
16
- const apiKey = resolveNugetApiKey(nugetPushSource);
17
+ const apiKey = (_a = options === null || options === void 0 ? void 0 : options.apiKey) !== null && _a !== void 0 ? _a : resolveNugetApiKey(nugetPushSource);
17
18
  options = options || {};
18
19
  options.skipDuplicates = options.skipDuplicates === undefined
19
20
  ? env.resolveFlag("NUGET_IGNORE_DUPLICATE_PACKAGES")
@@ -12,7 +12,7 @@
12
12
  });
13
13
  env.register({
14
14
  name: "BUILD_TOOLS_INSTALL_FORCE_NUGET_EXE",
15
- help: `Flag: when set, revert to the original behavior for downloading tooling via nuget.exe
15
+ help: `Flag: when set, revert to the original behavior for downloading tooling via nuget.exe
16
16
  (default is to use node-nuget-client since nuget.exe now refuses to download packages marked as tools)`,
17
17
  default: "false"
18
18
  });
@@ -157,8 +157,8 @@
157
157
  default: "auto",
158
158
  help: "process model for nunit-runner to use"
159
159
  });
160
- const extra = `
161
- - globs match dotnet core projects or .net framework built assemblies
160
+ const extra = `
161
+ - globs match dotnet core projects or .net framework built assemblies
162
162
  - elements surrounded with () are treated as pure gulp.src masks`, defaultTestInclude = "*.Tests,*.Tests.*,Tests,Test,Test.*", defaultTestExclude = `{!**/node_modules/**/*},{!./${getToolsFolder(env)}/**/*}`;
163
163
  env.register({
164
164
  name: "TEST_INCLUDE",
@@ -656,9 +656,9 @@
656
656
  env.register({
657
657
  name: "ZARRO_ALLOW_FILE_RESOLUTION",
658
658
  default: "true",
659
- help: `when enabled, the value provided by an environment variable may be the path
660
- to a file to use for that configuration; for example MSBUILD_PROPERTIES=foo.json will
661
- instruct Zarro to read the mapping in foo.json for extra msbuild properties to pass on
659
+ help: `when enabled, the value provided by an environment variable may be the path
660
+ to a file to use for that configuration; for example MSBUILD_PROPERTIES=foo.json will
661
+ instruct Zarro to read the mapping in foo.json for extra msbuild properties to pass on
662
662
  where applicable.`
663
663
  });
664
664
  env.register({
@@ -720,6 +720,11 @@
720
720
  help: "comma-delimited list of nuget sources if you don't want to use the defaults",
721
721
  default: env.resolve("NUGET_SOURCE")
722
722
  });
723
+ env.register({
724
+ name: "NUGET_PUSH_PACKAGES",
725
+ help: "comma-delimited list of packages to push, either relative to the PACK_TARGET_FOLDER, or relative to the project root. If left empty, assume all packages under PACK_TARGET_FOLDER.",
726
+ default: ""
727
+ });
723
728
  env.register({
724
729
  name: "NUGET_PUSH_SOURCE",
725
730
  help: "Specifically: nuget source to push to. Will fall back on NUGET_SOURCE or first of NUGET_SOURCES.",
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ (function () {
3
+ const { ls, FsEntities, fileExists } = require("yafs"), path = require("path");
4
+ async function resolveNugetPushPackageFiles() {
5
+ const env = requireModule("env"), packRoot = env.resolve(env.PACK_TARGET_FOLDER), pushMask = env.resolveArray(env.NUGET_PUSH_PACKAGES);
6
+ if (pushMask.length === 0) {
7
+ return await enumeratePackagesIn(packRoot);
8
+ }
9
+ const collected = [];
10
+ for (const mask of pushMask) {
11
+ const maskFiles = await findFilesFor(mask);
12
+ collected.push(...maskFiles);
13
+ }
14
+ return collected;
15
+ }
16
+ async function findFilesFor(mask) {
17
+ if (await fileExists(mask)) {
18
+ return [path.resolve(mask)];
19
+ }
20
+ const env = requireModule("env"), maskContainer = path.dirname(mask), searchContainers = path.isAbsolute(mask)
21
+ ? [maskContainer]
22
+ : [maskContainer, `${env.resolve(env.PACK_TARGET_FOLDER)}/${maskContainer}`], files = await lsAll(searchContainers);
23
+ const maskHasFolders = mask.includes("/") || mask.includes("\\"), leaf = path.basename(mask), start = leaf.startsWith("*") ? ".*" : "^", end = leaf.endsWith("*") ? ".*" : "", regexed = mask.replace(/\*/g, ".*").replace(/\\/g, "\\/"), nupkgRe = /\.nupkg$/i, maskRe = new RegExp(`${start}${regexed}${end}`);
24
+ return files.filter((f) => {
25
+ const toTest = maskHasFolders
26
+ ? f
27
+ : path.basename(f);
28
+ return nupkgRe.test(toTest) && maskRe.test(toTest);
29
+ });
30
+ }
31
+ async function lsAll(dirs) {
32
+ const result = [];
33
+ for (const dir of dirs) {
34
+ const files = await ls(dir, {
35
+ entities: FsEntities.files,
36
+ recurse: false,
37
+ fullPaths: true
38
+ });
39
+ result.push(...files);
40
+ }
41
+ return result;
42
+ }
43
+ async function enumeratePackagesIn(packRoot) {
44
+ return await ls(packRoot, {
45
+ entities: FsEntities.files,
46
+ match: /\.nupkg$/,
47
+ recurse: false,
48
+ fullPaths: true
49
+ });
50
+ }
51
+ module.exports = {
52
+ resolveNugetPushPackageFiles
53
+ };
54
+ })();
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ (function () {
3
+ const gulp = requireModule("gulp");
4
+ gulp.task("nuget-push", async () => {
5
+ const env = requireModule("env"), runInParallel = requireModule("run-in-parallel"), nugetPush = requireModule("nuget-push"), { resolveNugetPushPackageFiles } = requireModule("resolve-nuget-push-package-files"), packageFiles = await resolveNugetPushPackageFiles(), nugetSrc = env.resolve("NUGET_PUSH_SOURCE");
6
+ const actions = packageFiles.map(file => {
7
+ return async () => await nugetPush(file, nugetSrc);
8
+ });
9
+ await runInParallel(2, ...actions);
10
+ });
11
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.167.0",
3
+ "version": "1.168.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"
@@ -13,7 +13,7 @@
13
13
  "verify-submodules": "node index.js verify-submodules",
14
14
  "verify-no-debugger": "node index.js @",
15
15
  "clean-cache": "rimraf .jest-cache",
16
- "pretest": "run-s clean-cache build verify-submodules",
16
+ "pretest": "run-s clean-cache build",
17
17
  "test": "jest",
18
18
  "quick-test": "jest -o --no-cache",
19
19
  "clear-console": "console-cls",