zarro 1.124.2 → 1.124.3

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.
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  }
20
20
  validateVersioningStrategy(opts.strategy);
21
21
  try {
22
- const json = await readTextFile(opts.packageJsonPath), indent = guessIndent(json), index = JSON.parse(json), currentVersion = index.version || "0.0.0", incremented = await incrementVersion(currentVersion, opts.strategy, opts.zero, opts.incrementBy);
22
+ const json = await readTextFile(opts.packageJsonPath), indent = guessIndent(json), index = JSON.parse(json), currentVersion = index.version || "0.0.0", incremented = incrementVersion(currentVersion, opts.strategy, opts.zero, opts.incrementBy);
23
23
  index.version = incremented;
24
24
  const newJson = JSON.stringify(index, null, indent);
25
25
  if (opts.dryRun) {
@@ -1,14 +1,22 @@
1
1
  "use strict";
2
2
  (function () {
3
3
  const Git = require("simple-git");
4
- async function gitSha(forRepo) {
4
+ async function fetchGitSha(forRepo) {
5
5
  const git = new Git(forRepo);
6
6
  const log = await git.log({ maxCount: 1 });
7
7
  return log.latest.hash;
8
8
  }
9
- async function shortSha(forRepo) {
10
- const fullHash = await gitSha(forRepo);
11
- return fullHash.substring(0, 7);
9
+ // this is a bit of an hax: we're hoping that we get some
10
+ // time between when this is fired off and when it's required
11
+ // but the consumers of this can't do async :| so this is
12
+ // as good as it gets, I guess.
13
+ let currentGitSha = "";
14
+ fetchGitSha().then(result => currentGitSha = result);
15
+ function currentGitSHA() {
16
+ return currentGitSha;
12
17
  }
13
- module.exports = { shortSha, gitSha };
18
+ function currentShortSHA() {
19
+ return currentGitSha.substring(0, 7);
20
+ }
21
+ module.exports = { currentShortSHA, currentGitSHA, fetchGitSha };
14
22
  })();
@@ -13,7 +13,7 @@
13
13
  return;
14
14
  }
15
15
  if ((dependency.$.id || "").match(packageMatch)) {
16
- const newVersion = await incrementVersion(dependency.$.version, env.resolve("VERSION_INCREMENT_STRATEGY"), env.resolveFlag("VERSION_INCREMENT_ZERO"), env.resolveNumber("PACK_INCREMENT_VERSION_BY"));
16
+ const newVersion = incrementVersion(dependency.$.version, env.resolve("VERSION_INCREMENT_STRATEGY"), env.resolveFlag("VERSION_INCREMENT_ZERO"), env.resolveNumber("PACK_INCREMENT_VERSION_BY"));
17
17
  gutil.log(gutil.colors.yellow(`${packageId}: dependency ${dependency.$.id} version incremented to: ${newVersion}`));
18
18
  dependency.$.version = newVersion;
19
19
  }
@@ -8,7 +8,7 @@
8
8
  }
9
9
  };
10
10
  // FIXME: proper types plz
11
- function incrementPackageVersionInCsProj(xml, file) {
11
+ async function incrementPackageVersionInCsProj(xml, file) {
12
12
  debug(JSON.stringify(xml, null, 2));
13
13
  const packageVersionPropGroup = xml.Project.PropertyGroup.filter((g) => !!g.PackageVersion)[0];
14
14
  if (!packageVersionPropGroup) {
@@ -63,7 +63,7 @@
63
63
  });
64
64
  return xml;
65
65
  }
66
- function incrementPackageVersionInNuspec(xml, file) {
66
+ async function incrementPackageVersionInNuspec(xml, file) {
67
67
  const meta = xml.package.metadata[0], packageName = meta.id[0], node = meta.version, current = node[0];
68
68
  const newVersion = incrementVersion(current);
69
69
  node[0] = newVersion;
@@ -71,12 +71,12 @@
71
71
  return xml;
72
72
  }
73
73
  function incrementPackageVersion() {
74
- return editXml((xml, file) => {
74
+ return editXml(async (xml, file) => {
75
75
  if (xml.package) {
76
- return incrementPackageVersionInNuspec(xml, file);
76
+ return await incrementPackageVersionInNuspec(xml, file);
77
77
  }
78
78
  else if (xml.Project) {
79
- return incrementPackageVersionInCsProj(xml, file);
79
+ return await incrementPackageVersionInCsProj(xml, file);
80
80
  }
81
81
  throw new ZarroError(`Don't know how to increment package version in document:\n\n${JSON.stringify(xml)}`);
82
82
  }, xmlOpts);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  (function () {
3
3
  const { ZarroError } = requireModule("zarro-error");
4
- const { shortSha } = requireModule("git-sha");
4
+ const { currentShortSHA } = requireModule("git-sha");
5
5
  function zeroFrom(parts, startIndex) {
6
6
  for (let i = startIndex; i < parts.length; i++) {
7
7
  parts[i] = 0;
@@ -19,7 +19,7 @@
19
19
  "minor": 1,
20
20
  "patch": 2
21
21
  };
22
- module.exports = async function incrementVersion(version, strategy, zeroLowerOrder = true, incrementBy = 1) {
22
+ module.exports = function incrementVersion(version, strategy, zeroLowerOrder = true, incrementBy = 1) {
23
23
  const dashedParts = version.split("-"), parts = dashedParts[0].split(".").map(i => parseInt(i));
24
24
  let toIncrement = incrementLookup[(strategy || "").toLowerCase()];
25
25
  if (toIncrement === undefined) {
@@ -35,7 +35,7 @@
35
35
  if (strategy != "prerelease") {
36
36
  return result;
37
37
  }
38
- const sha = await shortSha();
38
+ const sha = currentShortSHA();
39
39
  return `${result}-${timestamp()}-${sha}`;
40
40
  };
41
41
  function timestamp() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.124.2",
3
+ "version": "1.124.3",
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"
@@ -61,7 +61,7 @@
61
61
  "undertaker-forward-reference": "^1.0.2",
62
62
  "vinyl": "^2.2.1",
63
63
  "which": "^2.0.2",
64
- "xml2js": "^0.4.23",
64
+ "xml2js": "^0.5.0",
65
65
  "yafs": "^1.23.0"
66
66
  },
67
67
  "files": [