zarro 1.213.0 → 1.213.1

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,7 +2,7 @@
2
2
  (function () {
3
3
  const gulp = requireModule("gulp");
4
4
  gulp.task("auto-release-nuget", async () => {
5
- const env = requireModule("env"), log = requireModule("log"), { runTask } = requireModule("run-task"), Git = require("simple-git"), git = Git("."), branchInfo = await git.branch(), mainBranch = env.resolve(env.GIT_MAIN_BRANCH);
5
+ const env = requireModule("env"), log = requireModule("log"), { runTask } = requireModule("run-task"), { simpleGit } = require("simple-git"), git = simpleGit("."), branchInfo = await git.branch(), mainBranch = env.resolve(env.GIT_MAIN_BRANCH);
6
6
  if (branchInfo.current !== mainBranch) {
7
7
  log.info(`auto-releasing beta package: current branch is ${branchInfo.current} and main branch is ${mainBranch}`);
8
8
  process.env["BETA"] = "1";
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  (function () {
3
3
  async function commitAll(where, comment, dryRun) {
4
- const log = requireModule("log"), gitFactory = require("simple-git");
4
+ const log = requireModule("log"), { simpleGit } = require("simple-git");
5
5
  if (dryRun) {
6
6
  log.info(`would add & commit all from: ${where}`);
7
7
  }
8
8
  else {
9
- const git = gitFactory(where || ".");
9
+ const git = simpleGit(where || ".");
10
10
  await git.add(":/");
11
11
  await git.commit(comment);
12
12
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  (function () {
3
- const gitFactory = require("simple-git"), gutil = requireModule("gulp-util"), resolveGitRemote = requireModule("resolve-git-remote");
3
+ const { simpleGit } = require("simple-git"), gutil = requireModule("gulp-util"), resolveGitRemote = requireModule("resolve-git-remote");
4
4
  async function gitPushTags(dryRun, where) {
5
5
  if (dryRun === undefined) {
6
6
  dryRun = {};
@@ -15,7 +15,7 @@
15
15
  gutil.log.warn(gutil.colors.red("depreciation warning: options for git-push-tags should be sent via an object"));
16
16
  }
17
17
  where = where || ".";
18
- const git = gitFactory(where), more = where && where !== "." ? ` (${where})` : "";
18
+ const git = simpleGit(where), more = where && where !== "." ? ` (${where})` : "";
19
19
  if (dryRun) {
20
20
  if (!quiet) {
21
21
  gutil.log(gutil.colors.green(`dry run: should push tags now${more}...`));
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
  const
3
- gitFactory = require("simple-git"),
3
+ { simpleGit } = require("simple-git"),
4
4
  resolveGitBranch = requireModule("resolve-git-branch"),
5
5
  resolveGitRemote = requireModule("resolve-git-remote"),
6
6
  gutil = requireModule("gulp-util");
@@ -27,7 +27,7 @@
27
27
  where = where || ".";
28
28
  quiet = !!quiet;
29
29
  const
30
- git = gitFactory(where),
30
+ git = simpleGit(where),
31
31
  more = (where && where !== ".") ? ` (${ where })` : "";
32
32
  if (dryRun) {
33
33
  gutil.log(gutil.colors.green(`dry run: whould push local commits now${ more }...`));
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  (function () {
3
- const Git = require("simple-git");
3
+ const { simpleGit } = require("simple-git");
4
4
  async function fetchGitSha(forRepo, short) {
5
- const git = new Git(forRepo);
5
+ const git = simpleGit(forRepo);
6
6
  const log = await git.log({ maxCount: 1 });
7
7
  return !!short
8
8
  ? log.latest.hash.substring(0, 7)
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  (function () {
3
- const ZarroError = requireModule("zarro-error"), gitFactory = require("simple-git"), env = requireModule("env"), gutil = requireModule("gulp-util");
3
+ const ZarroError = requireModule("zarro-error"), { simpleGit } = require("simple-git"), env = requireModule("env"), gutil = requireModule("gulp-util");
4
4
  async function gitTag(tag, comment, where) {
5
5
  let dryRun = false;
6
6
  if (typeof tag === "object") {
@@ -22,7 +22,7 @@
22
22
  gutil.log(gutil.colors.green(`dry run: would tag${more} at ${tag} with comment: ${comment}`));
23
23
  }
24
24
  else {
25
- const git = gitFactory(where);
25
+ const git = simpleGit(where);
26
26
  gutil.log(gutil.colors.cyan(`Tagging${more} at: "${tag}"`));
27
27
  await git.addAnnotatedTag(tag, comment);
28
28
  }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  (function () {
3
- const safeGit = requireModule("safe-git"), gitFactory = require("simple-git");
3
+ const safeGit = requireModule("safe-git"), { simpleGit } = require("simple-git");
4
4
  module.exports = async function readAllBranches(at) {
5
5
  return safeGit(async () => {
6
- const git = gitFactory(at !== null && at !== void 0 ? at : "."), branches = await git.branch(["-a"]);
6
+ const git = simpleGit(at !== null && at !== void 0 ? at : "."), branches = await git.branch(["-a"]);
7
7
  return branches.all;
8
8
  }, []);
9
9
  };
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  (function () {
4
- const gitFactory = require("simple-git"), safeGit = requireModule("safe-git");
4
+ const { simpleGit } = require("simple-git"), safeGit = requireModule("safe-git");
5
5
  module.exports = async function readAllRemotes(at) {
6
6
  return safeGit(async () => {
7
7
  // technically, a remote can have different urls for fetch and push,
8
8
  // but that's an edge-case which just complicates things
9
- const git = gitFactory(at !== null && at !== void 0 ? at : "."), result = await git.getRemotes(true);
9
+ const git = simpleGit(at !== null && at !== void 0 ? at : "."), result = await git.getRemotes(true);
10
10
  return result.map((r) => {
11
11
  const url = r.refs.fetch || r.refs.push, usage = resolveUsage(!!r.refs.fetch, !!r.refs.push), name = r.name;
12
12
  return {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  (function () {
3
- const safeGit = requireModule("safe-git"), gitFactory = require("simple-git");
3
+ const safeGit = requireModule("safe-git"), { simpleGit } = require("simple-git");
4
4
  module.exports = async function readCurrentBranch(at) {
5
5
  return safeGit(async () => {
6
- const git = gitFactory(at !== null && at !== void 0 ? at : "."), branchInfo = await git.branch();
6
+ const git = simpleGit(at !== null && at !== void 0 ? at : "."), branchInfo = await git.branch();
7
7
  return branchInfo.current === ""
8
8
  ? undefined
9
9
  : branchInfo.current; // also returns sha if detached!
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  (function () {
3
- const safeGit = requireModule("safe-git"), gitFactory = require("simple-git");
3
+ const safeGit = requireModule("safe-git"), { simpleGit } = require("simple-git");
4
4
  module.exports = async function readGitRemote(at) {
5
- const git = gitFactory(at || ".");
5
+ const git = simpleGit(at || ".");
6
6
  git._silentLogging = true;
7
7
  const all = await safeGit(() => git.getRemotes(true), []), first = all[0];
8
8
  if (first === undefined) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  (function () {
3
- const os = require("os"), chalk = requireModule("ansi-colors"), gitFactory = require("simple-git"), readGitRemote = requireModule("read-git-remote"), exec = requireModule("exec");
3
+ const os = require("os"), chalk = requireModule("ansi-colors"), { simpleGit } = require("simple-git"), readGitRemote = requireModule("read-git-remote"), exec = requireModule("exec");
4
4
  module.exports = async function readMainBranchName() {
5
5
  const all = await listBranchesRaw("*"), headRef = all.map(b => {
6
6
  const match = b.match(/HEAD -> (.*)/);
@@ -15,7 +15,7 @@
15
15
  "master",
16
16
  "main",
17
17
  "default"
18
- ], probableRemote = await readGitRemote(), git = gitFactory(), branchesResult = await git.branch(["-a"]), allBranches = new Set(branchesResult.all);
18
+ ], probableRemote = await readGitRemote(), git = simpleGit(), branchesResult = await git.branch(["-a"]), allBranches = new Set(branchesResult.all);
19
19
  for (const branch of possibles) {
20
20
  const test = `remotes/${probableRemote}/${branch}`;
21
21
  if (allBranches.has(test)) {
@@ -2,18 +2,57 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const exec_step_1 = require("exec-step");
4
4
  (function () {
5
+ const versionRe = /^(?<id>[A-Za-z0-9.]+?)\.(?<version>\d+\.\d+\.\d+(?:\.\d+)?)(-(?<tag>.*))?\.nupkg$/;
6
+ function parseFileVersionInfo(fileName) {
7
+ var _a;
8
+ const groups = (_a = fileName.match(versionRe)) === null || _a === void 0 ? void 0 : _a.groups;
9
+ if (!groups) {
10
+ throw new Error(`Unable to determine version info from file name: '${fileName}'`);
11
+ }
12
+ const { id, version, tag } = groups, versionNumbers = version.split(".").map(Number);
13
+ while (versionNumbers.length < 4) {
14
+ versionNumbers.push(0);
15
+ }
16
+ return {
17
+ id,
18
+ version: versionNumbers,
19
+ tag
20
+ };
21
+ }
22
+ function compareVersions(a, b) {
23
+ const x = parseFileVersionInfo(a), y = parseFileVersionInfo(b);
24
+ for (let i = 0; i < 4; i++) {
25
+ if (x.version[i] !== y.version[i]) {
26
+ return x.version[i] - y.version[i];
27
+ }
28
+ }
29
+ if (x.tag === y.tag) {
30
+ return 0;
31
+ }
32
+ if (x.tag === undefined) {
33
+ return 1;
34
+ }
35
+ if (y.tag === undefined) {
36
+ return -1;
37
+ }
38
+ return x.tag.localeCompare(y.tag, undefined, { numeric: true });
39
+ }
5
40
  gulp.task("nuget-push", "Pushes the latest versions of packages in the package build dir", async () => {
6
- const { system } = require("system-wrapper"), { ctx } = require("exec-step"), debug = requireModule("debug")(__filename), path = require("path"), nugetPush = requireModule("nuget-push"), { ls, FsEntities } = require("yafs"), env = requireModule("env"), folder = env.resolve(env.PACK_TARGET_FOLDER), versionRe = /^(?<id>[A-Za-z\.]+)\.(?<version>\d\.\d\.\d)(-(?<tag>.*))?\.nupkg$/, packages = await ls(folder, {
41
+ const { system } = require("system-wrapper"), { ctx } = require("exec-step"), debug = requireModule("debug")(__filename), path = require("path"), nugetPush = requireModule("nuget-push"), { ls, FsEntities } = require("yafs"), env = requireModule("env"), folder = env.resolve(env.PACK_TARGET_FOLDER), packages = await ls(folder, {
7
42
  recurse: false,
8
43
  entities: FsEntities.files,
9
- match: versionRe
10
- }), sorted = packages.sort().reverse(), seen = new Set();
11
- if (sorted.length === 0) {
44
+ match: /\.nupkg$/
45
+ });
46
+ if (packages.length === 0) {
12
47
  throw new Error(`No .nupkg files found in ${path.resolve(folder)}`);
13
48
  }
14
- const toPush = [];
49
+ const unparseable = packages.filter(p => !versionRe.test(p));
50
+ if (unparseable.length > 0) {
51
+ throw new Error(`Unable to determine package id / version from: ${unparseable.join(", ")}`);
52
+ }
53
+ const sorted = [...packages].sort((a, b) => compareVersions(b, a)), seen = new Set(), toPush = [];
15
54
  for (const file of sorted) {
16
- const match = file.match(versionRe), id = match === null || match === void 0 ? void 0 : match.groups["id"];
55
+ const { id } = parseFileVersionInfo(file);
17
56
  if (seen.has(id)) {
18
57
  debug(`already seen ${id}, skipping ${file}`);
19
58
  continue;
@@ -38,27 +77,20 @@ const exec_step_1 = require("exec-step");
38
77
  if (system.isResult(result)) {
39
78
  const res = result;
40
79
  if (looksLikeNugetConflict(res)) {
41
- throw new exec_step_1.ExecStepOverrideMessage(`${path.basename(file)} NOT pushed: this version already exists at the registry.`, new Error('dummy'), false);
80
+ throw new exec_step_1.ExecStepOverrideMessage(`${path.basename(file)} NOT pushed: this version already exists at the registry.`, undefined, false);
42
81
  }
43
82
  }
44
83
  });
45
84
  }
46
85
  });
47
86
  const conflictMarkers = [
48
- "409",
49
- "already been pushed",
50
- "conflict http"
87
+ /already been pushed/i,
88
+ /conflict\s+http/i,
89
+ /\b409\b.*\bconflict\b/i
51
90
  ];
52
91
  function looksLikeNugetConflict(result) {
53
- const io = result.stderr
92
+ return result.stderr
54
93
  .concat(result.stdout)
55
- .map(line => line.toLowerCase());
56
- for (const line of io) {
57
- const current = conflictMarkers.reduce((acc, cur) => acc || line.includes(cur), false);
58
- if (current) {
59
- return true;
60
- }
61
- }
62
- return false;
94
+ .some(line => conflictMarkers.some(marker => marker.test(line)));
63
95
  }
64
96
  })();
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  (function () {
3
- const gitFactory = require("simple-git"), { system } = require("system-wrapper"), gulp = requireModule("gulp"), gutil = requireModule("gulp-util"), log = requireModule("log"), ZarroError = requireModule("zarro-error"), { ask } = requireModule("ask"), readGitInfo = requireModule("read-git-info"), env = requireModule("env"), readPackageVersion = requireModule("read-package-version"), { runTask } = requireModule("run-task"), { withEnvironment } = requireModule("temporary-environment"), alterPackageJsonVersion = requireModule("alter-package-json-version");
3
+ const { simpleGit } = require("simple-git"), { system } = require("system-wrapper"), gulp = requireModule("gulp"), gutil = requireModule("gulp-util"), log = requireModule("log"), ZarroError = requireModule("zarro-error"), { ask } = requireModule("ask"), readGitInfo = requireModule("read-git-info"), env = requireModule("env"), readPackageVersion = requireModule("read-package-version"), { runTask } = requireModule("run-task"), { withEnvironment } = requireModule("temporary-environment"), alterPackageJsonVersion = requireModule("alter-package-json-version");
4
4
  async function rollBackPackageJson() {
5
5
  await alterPackageJsonVersion({ loadUnsetFromEnvironment: true, incrementBy: -1 });
6
6
  }
7
7
  gulp.task("release-npm", ["increment-package-json-version"], async () => {
8
- const dryRun = env.resolveFlag("DRY_RUN"), git = gitFactory(), version = await readPackageVersion(), isBeta = env.resolveFlag("BETA"), releaseTag = env.resolve("TAG"), tag = `v${version}`, gitInfo = await readGitInfo();
8
+ const dryRun = env.resolveFlag("DRY_RUN"), git = simpleGit(), version = await readPackageVersion(), isBeta = env.resolveFlag("BETA"), releaseTag = env.resolve("TAG"), tag = `v${version}`, gitInfo = await readGitInfo();
9
9
  if (version === undefined) {
10
10
  throw new ZarroError(`unable to read version from package.json`);
11
11
  }
@@ -6,7 +6,7 @@
6
6
  env.NUGET_SOURCE
7
7
  ], taskName);
8
8
  gulp.task(taskName, ["clear-packages-folder", "pack"], async () => {
9
- const { ctx } = require("exec-step"), log = requireModule("log"), Git = require("simple-git"), git = new Git("."), ZarroError = requireModule("zarro-error"), resolveNugetApiKey = requireModule("resolve-nuget-api-key"), { FsEntities, ls } = require("yafs"), { nugetPush } = require("dotnet-cli"), packageDir = env.resolve(env.PACK_TARGET_FOLDER), packageFiles = await ls(packageDir, {
9
+ const { ctx } = require("exec-step"), log = requireModule("log"), { simpleGit } = require("simple-git"), git = simpleGit("."), ZarroError = requireModule("zarro-error"), resolveNugetApiKey = requireModule("resolve-nuget-api-key"), { FsEntities, ls } = require("yafs"), { nugetPush } = require("dotnet-cli"), packageDir = env.resolve(env.PACK_TARGET_FOLDER), packageFiles = await ls(packageDir, {
10
10
  fullPaths: true,
11
11
  recurse: false,
12
12
  entities: FsEntities.files,
@@ -8,7 +8,7 @@
8
8
  const log = requireModule("log");
9
9
  log.warn(`Not updating submodules: env var ${env.UPDATE_SUBMODULES_TO_LATEST} is set to ${process.env[env.UPDATE_SUBMODULES_TO_LATEST]}`);
10
10
  }
11
- const { ExecStepContext } = require("exec-step"), ctx = new ExecStepContext(), gitFactory = require("simple-git"), git = gitFactory(".");
11
+ const { ExecStepContext } = require("exec-step"), ctx = new ExecStepContext(), { simpleGit } = require("simple-git"), git = simpleGit(".");
12
12
  await ctx.exec("Ensure submodules are initialized...", async () => await git.subModule(["update", "--init"]));
13
13
  await ctx.exec("Check out master on all submodules...", async () => await git.subModule(["foreach", "git", "checkout", "master"]));
14
14
  await ctx.exec("Update to latest commit on each submodule...", async () => await git.subModule(["foreach", "git", "pull", "--rebase"]));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  (function () {
3
- const os = require("os"), chalk = requireModule("ansi-colors"), log = requireModule("log"), env = requireModule("env"), gitFactory = require("simple-git"), failAfter = requireModule("fail-after"), readMainBranchName = requireModule("read-main-branch-name"), readAllGitRemotes = requireModule("read-all-git-remotes"), readCurrentBranch = requireModule("read-current-git-branch"), readGitCommitDeltaCount = requireModule("read-git-commit-delta-count"), readLastFetchTime = requireModule("read-last-fetch-time"), gulp = requireModule("gulp"), gitBroadcastConfigFile = ".git-broadcast", { heredoc } = require("heredoc-ts"), { fileExists, readTextFile } = require("yafs"), ZarroError = requireModule("zarro-error"), taskName = "verify-up-to-date";
3
+ const os = require("os"), chalk = requireModule("ansi-colors"), log = requireModule("log"), env = requireModule("env"), { simpleGit } = require("simple-git"), failAfter = requireModule("fail-after"), readMainBranchName = requireModule("read-main-branch-name"), readAllGitRemotes = requireModule("read-all-git-remotes"), readCurrentBranch = requireModule("read-current-git-branch"), readGitCommitDeltaCount = requireModule("read-git-commit-delta-count"), readLastFetchTime = requireModule("read-last-fetch-time"), gulp = requireModule("gulp"), gitBroadcastConfigFile = ".git-broadcast", { heredoc } = require("heredoc-ts"), { fileExists, readTextFile } = require("yafs"), ZarroError = requireModule("zarro-error"), taskName = "verify-up-to-date";
4
4
  env.associate([
5
5
  "SKIP_FETCH_ON_VERIFY",
6
6
  "ENFORCE_VERIFICATION",
@@ -33,7 +33,7 @@
33
33
  }
34
34
  if (!recentEnough) {
35
35
  log.info(`${taskName} :: fetching all remotes...`);
36
- const git = gitFactory(), timeout = env.resolveNumber("GIT_FETCH_TIMEOUT");
36
+ const git = simpleGit(), timeout = env.resolveNumber("GIT_FETCH_TIMEOUT");
37
37
  try {
38
38
  const fail = failAfter(timeout);
39
39
  await Promise.race([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.213.0",
3
+ "version": "1.213.1",
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"
@@ -66,7 +66,7 @@
66
66
  "del": "^5.1.0",
67
67
  "dotnet-cli": "^1.6.0",
68
68
  "event-stream": "^4.0.1",
69
- "exec-step": "^0.17.0",
69
+ "exec-step": "^0.21.0",
70
70
  "fancy-log": "^1.3.3",
71
71
  "gulp": "^5.0.0",
72
72
  "gulp-debug": "^4.0.0",
@@ -86,7 +86,7 @@
86
86
  "run-sequence": "^2.2.1",
87
87
  "sax": "^1.2.4",
88
88
  "semver": "^7.5.4",
89
- "simple-git": "^3.25.0",
89
+ "simple-git": "^4.0.1",
90
90
  "system-wrapper": "^1.8.0",
91
91
  "temp": "^0.9.4",
92
92
  "through2": "^3.0.2",
@@ -114,7 +114,7 @@
114
114
  },
115
115
  "license": "BSD-3-Clause",
116
116
  "devDependencies": {
117
- "@faker-js/faker": "^8.0.2",
117
+ "@faker-js/faker": "^9.9.0",
118
118
  "@jest/types": "^29.6.1",
119
119
  "@types/decompress": "^4.2.4",
120
120
  "@types/event-stream": "^3.3.34",