autorel 2.3.1 → 2.3.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.
- package/dist/index.js +16 -14
- package/dist/semver/compare.d.ts +12 -3
- package/dist/semver/compare.js +16 -7
- package/dist/services/git.d.ts +5 -1
- package/dist/services/git.js +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,20 +57,22 @@ async function autorel(args) {
|
|
|
57
57
|
}
|
|
58
58
|
const commitTypeMap = new Map(args.commitTypes.map((type) => [type.type, type]));
|
|
59
59
|
git.gitFetch();
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
? semver.
|
|
60
|
+
const recentTags = git.getRecentTags();
|
|
61
|
+
const highestTag = semver.highestTag(recentTags);
|
|
62
|
+
const highestStableTag = semver.highestStableTag(recentTags);
|
|
63
|
+
const highestChannelTag = prereleaseChannel
|
|
64
|
+
? semver.highestChannelTag(recentTags, prereleaseChannel)
|
|
65
65
|
: undefined;
|
|
66
66
|
// Determine the starting Git tag to compare against when generating
|
|
67
67
|
// release notes or changelogs (i.e. the point “since” which to find commits).
|
|
68
|
-
// If a pre-release channel is specified and
|
|
69
|
-
//
|
|
70
|
-
const tagFromWhichToFindCommits =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
logger_1.default.info(`The
|
|
68
|
+
// If a pre-release channel is specified, and that channel has a tag, and
|
|
69
|
+
// it is higher than the stable tag, use that tag. Otherwise, use the stable tag.
|
|
70
|
+
const tagFromWhichToFindCommits = highestChannelTag
|
|
71
|
+
? semver.highestTag([highestChannelTag, highestStableTag ?? 'v0.0.0'])
|
|
72
|
+
: highestStableTag;
|
|
73
|
+
!!highestChannelTag && logger_1.default.info(`The last pre-release channel version (${prereleaseChannel}) is: ${(0, colorette_1.bold)(highestChannelTag)}`);
|
|
74
|
+
logger_1.default.info(`The last stable/production version is: ${highestStableTag ? (0, colorette_1.bold)(highestStableTag) : (0, colorette_1.gray)('none')}`);
|
|
75
|
+
logger_1.default.info(`The current/highest version is: ${highestTag ? (0, colorette_1.bold)(highestTag) : (0, colorette_1.gray)('none')}`);
|
|
74
76
|
logger_1.default.info(`Fetching commits since ${tagFromWhichToFindCommits ?? 'the beginning of the repository'}...`);
|
|
75
77
|
const commits = git.getCommitsFromTag(tagFromWhichToFindCommits);
|
|
76
78
|
logger_1.default.info(`Found ${(0, colorette_1.bold)(commits.length.toString())} commit(s).`);
|
|
@@ -102,11 +104,11 @@ async function autorel(args) {
|
|
|
102
104
|
const nextTag = args.useVersion
|
|
103
105
|
? `v${args.useVersion}`
|
|
104
106
|
: semver.toTag(semver.incrVer({
|
|
105
|
-
latestVer: semver.fromTag(
|
|
106
|
-
latestStableVer: semver.fromTag(
|
|
107
|
+
latestVer: semver.fromTag(highestTag || 'v0.0.0'),
|
|
108
|
+
latestStableVer: semver.fromTag(highestStableTag || 'v0.0.0'),
|
|
107
109
|
releaseType,
|
|
108
110
|
prereleaseChannel,
|
|
109
|
-
latestChannelVer:
|
|
111
|
+
latestChannelVer: highestChannelTag ? semver.fromTag(highestChannelTag) ?? undefined : undefined,
|
|
110
112
|
}));
|
|
111
113
|
const changelog = (0, changelog_1.generateChangelog)(parsedCommits, commitTypeMap, args.breakingChangeTitle);
|
|
112
114
|
logger_1.default.info(`The next version is: ${(0, colorette_1.bold)(nextTag)}`);
|
package/dist/semver/compare.d.ts
CHANGED
|
@@ -11,9 +11,18 @@ export declare function compareVersions(version1: SemVer, version2: SemVer): num
|
|
|
11
11
|
* Returns the highest version of two SemVer objects (nomalized).
|
|
12
12
|
*/
|
|
13
13
|
export declare function highestVersion(version1: SemVer, version2: SemVer): SemVer;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Returns the tag with the highest version.
|
|
16
|
+
*/
|
|
17
|
+
export declare function highestTag(tags: string[]): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the tag with the highest version for a specific channel.
|
|
20
|
+
*/
|
|
21
|
+
export declare function highestChannelTag(tags: string[], channel: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the tag with the highest version that does not have a channel.
|
|
24
|
+
*/
|
|
25
|
+
export declare function highestStableTag(tags: string[]): string | undefined;
|
|
17
26
|
/**
|
|
18
27
|
* Returns the raw tag string with the highest version.
|
|
19
28
|
*/
|
package/dist/semver/compare.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.highest = exports.
|
|
3
|
+
exports.highest = exports.highestStableTag = exports.highestChannelTag = exports.highestTag = exports.highestVersion = exports.compareVersions = void 0;
|
|
4
4
|
const parse_1 = require("./parse");
|
|
5
5
|
/**
|
|
6
6
|
* Compares two versions and returns:
|
|
@@ -52,29 +52,38 @@ function highestVersion(version1, version2) {
|
|
|
52
52
|
return (0, parse_1.normalizeVer)(comparison > 0 ? version1 : version2);
|
|
53
53
|
}
|
|
54
54
|
exports.highestVersion = highestVersion;
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Returns the tag with the highest version.
|
|
57
|
+
*/
|
|
58
|
+
function highestTag(tags) {
|
|
56
59
|
const parsed = (0, parse_1.parseTags)(tags);
|
|
57
60
|
if (parsed.length === 0)
|
|
58
61
|
return undefined;
|
|
59
62
|
return highest(parsed).raw;
|
|
60
63
|
}
|
|
61
|
-
exports.
|
|
62
|
-
|
|
64
|
+
exports.highestTag = highestTag;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the tag with the highest version for a specific channel.
|
|
67
|
+
*/
|
|
68
|
+
function highestChannelTag(tags, channel) {
|
|
63
69
|
const parsed = (0, parse_1.parseTags)(tags)
|
|
64
70
|
.filter((entry) => entry.version.channel === channel);
|
|
65
71
|
if (parsed.length === 0)
|
|
66
72
|
return undefined;
|
|
67
73
|
return highest(parsed).raw;
|
|
68
74
|
}
|
|
69
|
-
exports.
|
|
70
|
-
|
|
75
|
+
exports.highestChannelTag = highestChannelTag;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the tag with the highest version that does not have a channel.
|
|
78
|
+
*/
|
|
79
|
+
function highestStableTag(tags) {
|
|
71
80
|
const parsed = (0, parse_1.parseTags)(tags)
|
|
72
81
|
.filter((entry) => !entry.version.channel);
|
|
73
82
|
if (parsed.length === 0)
|
|
74
83
|
return undefined;
|
|
75
84
|
return highest(parsed).raw;
|
|
76
85
|
}
|
|
77
|
-
exports.
|
|
86
|
+
exports.highestStableTag = highestStableTag;
|
|
78
87
|
/**
|
|
79
88
|
* Returns the raw tag string with the highest version.
|
|
80
89
|
*/
|
package/dist/services/git.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ export type Commit = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare function gitFetch(): void;
|
|
6
6
|
export declare function createAndPushTag(tag: string): void;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns the most recent 100 tags in the repository loosely sorted by version
|
|
9
|
+
* (does not take into account pre-release tags).
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRecentTags(): string[];
|
|
8
12
|
export declare function getRepo(): {
|
|
9
13
|
owner: string;
|
|
10
14
|
repository: string;
|
package/dist/services/git.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentBranch = exports.getCommitsFromTag = exports.getRepo = exports.
|
|
3
|
+
exports.getCurrentBranch = exports.getCommitsFromTag = exports.getRepo = exports.getRecentTags = exports.createAndPushTag = exports.gitFetch = void 0;
|
|
4
4
|
const sh_1 = require("./sh");
|
|
5
5
|
function gitFetch() {
|
|
6
6
|
(0, sh_1.$) `git fetch`;
|
|
@@ -11,11 +11,15 @@ function createAndPushTag(tag) {
|
|
|
11
11
|
(0, sh_1.$) `git push origin ${tag}`;
|
|
12
12
|
}
|
|
13
13
|
exports.createAndPushTag = createAndPushTag;
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Returns the most recent 100 tags in the repository loosely sorted by version
|
|
16
|
+
* (does not take into account pre-release tags).
|
|
17
|
+
*/
|
|
18
|
+
function getRecentTags() {
|
|
15
19
|
const tags = (0, sh_1.$) `git tag --sort=-v:refname | head -n 100`;
|
|
16
20
|
return tags.split('\n').filter((tag) => tag.trim() !== '');
|
|
17
21
|
}
|
|
18
|
-
exports.
|
|
22
|
+
exports.getRecentTags = getRecentTags;
|
|
19
23
|
function getRepo() {
|
|
20
24
|
if (process.env.GITHUB_REPOSITORY) {
|
|
21
25
|
const [owner, repository] = process.env.GITHUB_REPOSITORY.split('/');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autorel",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Automate semantic releases based on conventional commits. Similar to semantic-release but much simpler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc H. Weiner <mhweiner234@gmail.com> (https://mhweiner.com)",
|