autorel 2.2.4 → 2.2.6
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 +3 -3
- package/dist/lib/git.d.ts +10 -0
- package/dist/lib/git.js +11 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ async function autorel(args) {
|
|
|
81
81
|
output_1.default.log('No release is needed. Have a nice day (^_^)/');
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
let nextTagCalculated = '';
|
|
85
85
|
if (args.useVersion) {
|
|
86
86
|
if (/^v(.+)$/.test(args.useVersion))
|
|
87
87
|
throw new Error('useVersion should not start with a "v".');
|
|
@@ -91,11 +91,11 @@ async function autorel(args) {
|
|
|
91
91
|
output_1.default.warn(`We didn't find any commmits that would create a release, but you have set 'useVersion', which will force a release as: ${color.bold(args.useVersion)}.`);
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
output_1.default.warn(`The next version
|
|
94
|
+
output_1.default.warn(`The next version was set by useVersion to be: ${color.bold(args.useVersion)}.`);
|
|
95
95
|
}
|
|
96
|
-
output_1.default.warn('I hope you know what you\'re doing. (=^・ω・^=)');
|
|
97
96
|
}
|
|
98
97
|
else {
|
|
98
|
+
nextTagCalculated = semver.incrementVersion(lastProdTag || 'v0.0.1', lastTag || 'v0.0.1', releaseType, prereleaseChannel);
|
|
99
99
|
output_1.default.log(`The next version is: ${color.bold(nextTagCalculated)}`);
|
|
100
100
|
}
|
|
101
101
|
const nextTag = args.useVersion ? `v${args.useVersion}` : nextTagCalculated;
|
package/dist/lib/git.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ export type Commit = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare function gitFetchTags(): void;
|
|
6
6
|
export declare function createAndPushTag(tag: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Get the last tag. It does this by:
|
|
9
|
+
* 1. Getting all tags
|
|
10
|
+
* 2. Filtering out tags that are not in the format v1.2.3
|
|
11
|
+
* 3. Sorting the tags by version number by tricking the sort -V command by appending an
|
|
12
|
+
* underscore to tags that do not have a hyphen in them (i.e. they are not pre-release tags)
|
|
13
|
+
* Thanks to this StackOverflow answer: https://stackoverflow.com/questions/40390957/how-to-sort-semantic-versions-in-bash
|
|
14
|
+
* 4. Removing the underscore from the sorted tags
|
|
15
|
+
* 5. Getting the last tag
|
|
16
|
+
*/
|
|
7
17
|
export declare function getLastTag(): string;
|
|
8
18
|
export declare function getLastProdTag(): string;
|
|
9
19
|
export declare function getRepo(): {
|
package/dist/lib/git.js
CHANGED
|
@@ -11,8 +11,18 @@ function createAndPushTag(tag) {
|
|
|
11
11
|
(0, sh_1.$) `git push origin ${tag}`;
|
|
12
12
|
}
|
|
13
13
|
exports.createAndPushTag = createAndPushTag;
|
|
14
|
+
/**
|
|
15
|
+
* Get the last tag. It does this by:
|
|
16
|
+
* 1. Getting all tags
|
|
17
|
+
* 2. Filtering out tags that are not in the format v1.2.3
|
|
18
|
+
* 3. Sorting the tags by version number by tricking the sort -V command by appending an
|
|
19
|
+
* underscore to tags that do not have a hyphen in them (i.e. they are not pre-release tags)
|
|
20
|
+
* Thanks to this StackOverflow answer: https://stackoverflow.com/questions/40390957/how-to-sort-semantic-versions-in-bash
|
|
21
|
+
* 4. Removing the underscore from the sorted tags
|
|
22
|
+
* 5. Getting the last tag
|
|
23
|
+
*/
|
|
14
24
|
function getLastTag() {
|
|
15
|
-
return (0, sh_1.$) `git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1` || '';
|
|
25
|
+
return (0, sh_1.$) `git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1` || '';
|
|
16
26
|
}
|
|
17
27
|
exports.getLastTag = getLastTag;
|
|
18
28
|
function getLastProdTag() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autorel",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
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)",
|