zarro 1.126.0 → 1.126.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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
(function () {
|
|
4
|
-
const PLUGIN_NAME = __filename.replace(/\.js$/, ""), gutil = requireModule("gulp-util"), loadXmlFile = requireModule("load-xml-file"), es = require("event-stream"), gitTag = requireModule("git-tag"), gitPushTags = requireModule("git-push-tags"), gitPush = requireModule("git-push"), { ZarroError } = requireModule("zarro-error"), defaultOptions = {
|
|
4
|
+
const PLUGIN_NAME = __filename.replace(/\.js$/, ""), gutil = requireModule("gulp-util"), loadXmlFile = requireModule("load-xml-file"), es = require("event-stream"), gitTag = requireModule("git-tag"), gitPushTags = requireModule("git-push-tags"), gitPush = requireModule("git-push"), { ZarroError } = requireModule("zarro-error"), { parseNugetVersion } = requireModule("parse-nuget-version"), defaultOptions = {
|
|
5
5
|
push: true,
|
|
6
|
-
dryRun: false
|
|
6
|
+
dryRun: false,
|
|
7
|
+
ignorePreRelease: true
|
|
7
8
|
};
|
|
8
9
|
module.exports = function gitTagFromCsProj(options) {
|
|
9
10
|
const opts = Object.assign({}, defaultOptions, options);
|
|
@@ -18,11 +19,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
19
|
if (csprojFiles.length > 1) {
|
|
19
20
|
throw new ZarroError(`too many csproj files! specify the one to use for creating a versioned tag!\n${csprojFiles.join("\n- ")}`);
|
|
20
21
|
}
|
|
21
|
-
const xml = await loadXmlFile(csprojFiles[0]), version = findPackageVersion(xml, csprojFiles[0]);
|
|
22
|
+
const xml = await loadXmlFile(csprojFiles[0]), version = findPackageVersion(xml, csprojFiles[0]), versionInfo = parseNugetVersion(version);
|
|
22
23
|
if (opts.dryRun) {
|
|
23
24
|
console.log(`Dry run: would have tagged at ${version}`);
|
|
24
25
|
return this.emit("end");
|
|
25
26
|
}
|
|
27
|
+
if (versionInfo.isPreRelease && opts.ignorePreRelease) {
|
|
28
|
+
console.log(`Not tagging: this is a pre-release. Set ignorePreRelease: false on options to tag pre-releases.`);
|
|
29
|
+
return this.emit("end");
|
|
30
|
+
}
|
|
26
31
|
try {
|
|
27
32
|
await gitTag({
|
|
28
33
|
tag: `v${version}`,
|
|
@@ -1,55 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
await gitPush();
|
|
47
|
-
gutil.log(gutil.colors.green("-> all commits and tags pushed!"));
|
|
48
|
-
}
|
|
49
|
-
this.emit("end");
|
|
50
|
-
} catch (e) {
|
|
51
|
-
this.emit("error", new gutil.PluginError(PLUGIN_NAME, e));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
(function () {
|
|
4
|
+
const PLUGIN_NAME = __filename.replace(/\.js$/, ""), gutil = requireModule("gulp-util"), loadXmlFile = requireModule("load-xml-file"), es = require("event-stream"), gitTag = requireModule("git-tag"), gitPushTags = requireModule("git-push-tags"), gitPush = requireModule("git-push"), { parseNugetVersion } = requireModule("parse-nuget-version"), { ZarroError } = requireModule("zarro-error"), defaultOptions = {
|
|
5
|
+
push: true,
|
|
6
|
+
dryRun: false,
|
|
7
|
+
ignorePreRelease: true
|
|
8
|
+
};
|
|
9
|
+
module.exports = function gitTagFromPackageNuspec(options) {
|
|
10
|
+
options = Object.assign({}, defaultOptions, options);
|
|
11
|
+
const nuspecs = [];
|
|
12
|
+
return es.through(async function write(file) {
|
|
13
|
+
nuspecs.push(file.path);
|
|
14
|
+
this.emit("data", file);
|
|
15
|
+
}, async function end() {
|
|
16
|
+
if (nuspecs.length == 0) {
|
|
17
|
+
throw new ZarroError("no nuspecs found to tag from?");
|
|
18
|
+
}
|
|
19
|
+
if (nuspecs.length > 1) {
|
|
20
|
+
throw new ZarroError(`too many nuspecs! specify the one to use for creating a versioned tag!\n${nuspecs.join("\n- ")}`);
|
|
21
|
+
}
|
|
22
|
+
const xml = await loadXmlFile(nuspecs[0]), version = xml.package.metadata[0].version[0].trim(), versionInfo = parseNugetVersion(version);
|
|
23
|
+
if (options.dryRun) {
|
|
24
|
+
console.log(`Dry run: would have tagged at ${version}`);
|
|
25
|
+
return this.emit("end");
|
|
26
|
+
}
|
|
27
|
+
if (versionInfo.isPreRelease && options.ignorePreRelease) {
|
|
28
|
+
console.log(`Not tagging: this is a pre-release. Set ignorePreRelease: false on options to tag pre-releases.`);
|
|
29
|
+
return this.emit("end");
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
await gitTag(`v${version}`, `:bookmark: ${version}`);
|
|
33
|
+
if (options.push) {
|
|
34
|
+
await gitPushTags();
|
|
35
|
+
await gitPush();
|
|
36
|
+
gutil.log(gutil.colors.green("-> all commits and tags pushed!"));
|
|
37
|
+
}
|
|
38
|
+
this.emit("end");
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
this.emit("error", new gutil.PluginError(PLUGIN_NAME, e));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
class VersionInfo {
|
|
4
|
+
constructor(major, minor, patch, tag) {
|
|
5
|
+
this.major = major;
|
|
6
|
+
this.minor = minor;
|
|
7
|
+
this.patch = patch;
|
|
8
|
+
this.tag = tag;
|
|
9
|
+
}
|
|
10
|
+
get isPreRelease() {
|
|
11
|
+
return !!this.tag;
|
|
12
|
+
}
|
|
13
|
+
toString() {
|
|
14
|
+
const version = `${this.major}.${this.minor}.${this.patch}`;
|
|
15
|
+
return this.tag
|
|
16
|
+
? `${version}-${this.tag}`
|
|
17
|
+
: version;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function parseNugetVersion(versionStringOrFileName) {
|
|
21
|
+
const withoutExtension = versionStringOrFileName.replace(/\.nupkg$/, ""), packageWithVersionAndTag = withoutExtension.split("-"), packageWithVersionParts = packageWithVersionAndTag[0].split("."), idAndVersion = collect(packageWithVersionParts);
|
|
22
|
+
return new PackageVersionInfo(idAndVersion.id, new VersionInfo(idAndVersion.version[0] || 0, idAndVersion.version[1] || 0, idAndVersion.version[2] || 0, packageWithVersionAndTag[1] || ""));
|
|
23
|
+
}
|
|
24
|
+
class PackageVersionInfo {
|
|
25
|
+
constructor(id, version) {
|
|
26
|
+
this.id = id;
|
|
27
|
+
this.version = version;
|
|
28
|
+
}
|
|
29
|
+
get isPreRelease() {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return (_b = (_a = this.version) === null || _a === void 0 ? void 0 : _a.isPreRelease) !== null && _b !== void 0 ? _b : true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function collect(stringParts) {
|
|
35
|
+
// moving in from the right, any pure number becomes part of the version, then the
|
|
36
|
+
// rest is package identifier parts
|
|
37
|
+
const idParts = [], versionParts = [];
|
|
38
|
+
stringParts.reverse();
|
|
39
|
+
let inVersion = true;
|
|
40
|
+
for (const part of stringParts) {
|
|
41
|
+
if (inVersion) {
|
|
42
|
+
const asNum = parseInt(part);
|
|
43
|
+
if (isNaN(asNum)) {
|
|
44
|
+
idParts.push(part);
|
|
45
|
+
inVersion = false;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
versionParts.push(asNum);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
idParts.push(part);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
idParts.reverse();
|
|
56
|
+
versionParts.reverse();
|
|
57
|
+
return {
|
|
58
|
+
id: idParts.join("."),
|
|
59
|
+
version: versionParts
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
module.exports = {
|
|
63
|
+
parseNugetVersion
|
|
64
|
+
};
|
|
65
|
+
})();
|