autorel 2.2.5 → 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/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.5",
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)",