zarro 1.164.0 → 1.165.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.
@@ -19,7 +19,7 @@
19
19
  "patch": 2
20
20
  };
21
21
  module.exports = function incrementVersion(version, strategy, zeroLowerOrder = true, incrementBy = 1) {
22
- const dashedParts = version.split("-"), currentVersionIsPreRelease = dashedParts.length > 1, parts = dashedParts[0].split(".").map(i => parseInt(i));
22
+ const dashedParts = version.split("-"), currentVersionIsPreRelease = dashedParts.length > 1, prefix = removePrefix(dashedParts), parts = dashedParts[0].split(".").map(i => parseInt(i));
23
23
  let toIncrement = incrementLookup[(strategy || "").toLowerCase()];
24
24
  if (toIncrement === undefined) {
25
25
  throw new ZarroError(`Unknown version increment strategy: ${strategy}\n try one of 'major', 'minor' or 'patch'`);
@@ -43,8 +43,17 @@
43
43
  }
44
44
  const result = parts.join(".");
45
45
  if (strategy != "prerelease") {
46
- return result;
46
+ return `${prefix}${result}`;
47
47
  }
48
- return `${result}-${generateVersionSuffix()}`;
48
+ return `${prefix}${result}-${generateVersionSuffix()}`;
49
49
  };
50
+ function removePrefix(parts) {
51
+ var _a, _b, _c;
52
+ const match = parts[0].match(/^(?<prefix>[^.\d]+)?(?<version>[.\d]+)/), prefix = (_b = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a["prefix"]) !== null && _b !== void 0 ? _b : "", version = (_c = match === null || match === void 0 ? void 0 : match.groups) === null || _c === void 0 ? void 0 : _c["version"];
53
+ if (!version) {
54
+ throw new Error(`'${parts[0]}' doesn't look like a version string?`);
55
+ }
56
+ parts[0] = version;
57
+ return prefix;
58
+ }
50
59
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.164.0",
3
+ "version": "1.165.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"