autorel 2.1.14 → 2.2.1

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/README.md CHANGED
@@ -21,7 +21,7 @@ Autorel automatically does the following, if appropriate:
21
21
 
22
22
  _Currently only has built-in support for `GitHub` and `NPM`, but you can write your own scripts to support other systems and languages._
23
23
 
24
- **✅ Conventional Commit and SemVer Compliant**
24
+ **✅ Conventional Commit and SemVer Compliant**
25
25
  - 100% compliant with Conventional Commits and SemVer out of the box, including "!" for breaking changes
26
26
 
27
27
  **😃 Simple & Easy to Use**
package/dist/index.js CHANGED
@@ -61,10 +61,12 @@ async function autorel(args) {
61
61
  output_1.default.log(`Using prerelease channel: ${color.bold(prereleaseChannel)}`);
62
62
  }
63
63
  const commitTypeMap = new Map(args.commitTypes.map((type) => [type.type, type]));
64
+ // fetch latest tags
65
+ git.gitFetchTags();
64
66
  const lastTag = git.getLastTag();
65
67
  const lastProdTag = git.getLastProdTag();
66
68
  output_1.default.log(`The last tag is: ${lastTag ? lastTag : color.grey('none')}`);
67
- output_1.default.log(`The last release tag is: ${lastProdTag ? lastProdTag : color.grey('none')}`);
69
+ output_1.default.log(`The last production tag is: ${lastProdTag ? lastProdTag : color.grey('none')}`);
68
70
  const commits = git.getCommitsSinceLastTag(lastTag);
69
71
  output_1.default.log(`Found ${color.bold(commits.length.toString())} commit(s) ${lastTag ? `since ${lastTag}` : 'in the repository'}.`);
70
72
  const parsedCommits = commits.map((commit) => convCom.parseConventionalCommit(commit.message, commit.hash))
package/dist/lib/git.d.ts CHANGED
@@ -2,6 +2,7 @@ export type Commit = {
2
2
  hash: string;
3
3
  message: string;
4
4
  };
5
+ export declare function gitFetchTags(): void;
5
6
  export declare function createAndPushTag(tag: string): void;
6
7
  export declare function getLastTag(): string;
7
8
  export declare function getLastProdTag(): string;
package/dist/lib/git.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCurrentBranch = exports.getCommitsSinceLastTag = exports.getRepo = exports.getLastProdTag = exports.getLastTag = exports.createAndPushTag = void 0;
3
+ exports.getCurrentBranch = exports.getCommitsSinceLastTag = exports.getRepo = exports.getLastProdTag = exports.getLastTag = exports.createAndPushTag = exports.gitFetchTags = void 0;
4
4
  const sh_1 = require("./sh");
5
+ function gitFetchTags() {
6
+ (0, sh_1.$) `git fetch --tags`;
7
+ }
8
+ exports.gitFetchTags = gitFetchTags;
5
9
  function createAndPushTag(tag) {
6
10
  (0, sh_1.$) `git tag ${tag}`;
7
11
  (0, sh_1.$) `git push origin ${tag}`;
package/dist/semver.js CHANGED
@@ -38,14 +38,20 @@ function incrementVersion(lastProductionTag, lastTag, releaseType, prereleaseCha
38
38
  throw new Error('lastProductionTag is not a valid semver tag');
39
39
  const { major: prodMajor, minor: prodMinor, patch: prodPatch } = lastProductionVersion;
40
40
  // some sanity checks
41
+ const lastVersionLessThanLastProdError = 'Something must have gone wrong, as the current version is less than the last production version.\n\nTo fix this, we recommend using the --useVersion flag to specify the version you want to use.';
41
42
  if (major < prodMajor)
42
- throw new Error('The current version must be greater than or equal to the last production version following SemVer rules.');
43
+ throw new Error(lastVersionLessThanLastProdError);
43
44
  if (major === prodMajor && minor < prodMinor)
44
- throw new Error('The current version must be greater than or equal to the last production version following SemVer rules.');
45
- if (major === prodMajor && minor === prodMinor && patch < prodPatch)
46
- throw new Error('The current version must be greater than or equal to the last production version following SemVer rules.');
47
- if (!!channel && major === prodMajor && minor === prodMinor && patch === prodPatch)
48
- throw new Error('The current version must be greater than or equal to the last production version following SemVer rules.');
45
+ throw new Error(lastVersionLessThanLastProdError);
46
+ if (major === prodMajor
47
+ && minor === prodMinor
48
+ && patch < prodPatch)
49
+ throw new Error(lastVersionLessThanLastProdError);
50
+ if (!!channel
51
+ && major === prodMajor
52
+ && minor === prodMinor
53
+ && patch === prodPatch)
54
+ throw new Error(lastVersionLessThanLastProdError);
49
55
  if (!channel && !prereleaseChannel) {
50
56
  // prod to prod
51
57
  // ex: v1.0.1 -> v1.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autorel",
3
- "version": "2.1.14",
3
+ "version": "2.2.1",
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)",