@thisismanta/semantic-version 2.0.0-6 → 2.0.0-8

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.
@@ -33,7 +33,8 @@ const index_1 = require("./index");
33
33
  const debug_1 = require("./debug");
34
34
  main();
35
35
  async function main() {
36
- const lastVersion = semver_1.default.valid(JSON.parse(await run('npm pkg get version')));
36
+ const lastVersion = semver_1.default.valid(await run('git describe --tags --abbrev=0').catch(() => '') ||
37
+ JSON.parse(await run('npm pkg get version')));
37
38
  (0, debug_1.debug)('lastVersion »', JSON.stringify(lastVersion));
38
39
  if (!lastVersion) {
39
40
  throw new Error('Expect to have a valid "version" field in package.json.');
@@ -47,7 +48,7 @@ async function main() {
47
48
  }))
48
49
  .filter(({ message }) => semver_1.default.valid(message) === null)
49
50
  .map(({ hash, message }) => {
50
- const { type, breaking, subject } = (0, index_1.checkConventionalMessage)(message, { debug: debug_1.debug });
51
+ const { type, breaking, subject } = (0, index_1.checkConventionalMessage)(message, { debug: () => { } });
51
52
  return {
52
53
  hash,
53
54
  type,
@@ -57,7 +58,6 @@ async function main() {
57
58
  });
58
59
  console.log(`Found ${commits.length} commits since v${lastVersion}`);
59
60
  (0, debug_1.debug)('commits »', JSON.stringify(commits, null, 2));
60
- return;
61
61
  const releaseType = commits.reduce((releaseType, { type, breaking }) => {
62
62
  if (releaseType === 'major' || breaking) {
63
63
  return 'major';
@@ -78,7 +78,7 @@ async function main() {
78
78
  const nextVersion = await run(`npm version --json --no-commit-hooks ${releaseType}`);
79
79
  (0, debug_1.debug)('nextVersion »', nextVersion);
80
80
  console.log(`Created version ${releaseType}`);
81
- await run(`git push --follow-tags origin master`);
81
+ await run(`git push --follow-tags origin`);
82
82
  console.log(`Pushed Git tags`);
83
83
  if (semver_1.default.valid(nextVersion) && process.env.GITHUB_TOKEN) {
84
84
  const commitGroups = {
@@ -108,6 +108,7 @@ async function main() {
108
108
  .join('\n\n');
109
109
  (0, debug_1.debug)('releaseNote »', releaseNote);
110
110
  const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
111
+ github.context.payload.ref;
111
112
  // See https://octokit.github.io/rest.js/v19#repos-create-release
112
113
  const releaseRespond = await octokit.rest.repos.createRelease({
113
114
  ...github.context.repo,
package/lib/index.js CHANGED
@@ -9,7 +9,7 @@ function checkConventionalMessage(message, { debug }) {
9
9
  debug('type »', type);
10
10
  debug('scope »', scope);
11
11
  debug('breaking »', breaking);
12
- debug('subject »', subject);
12
+ debug('subject »', subject?.trim());
13
13
  const errors = [
14
14
  !type &&
15
15
  'The pull request title must match the pattern of "<type>[!]: <subject>" which is a reduced set of https://www.conventionalcommits.org/en/v1.0.0/',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisismanta/semantic-version",
3
- "version": "2.0.0-6",
3
+ "version": "2.0.0-8",
4
4
  "author": "Anantachai Saothong <thisismanta@gmail.com>",
5
5
  "license": "ISC",
6
6
  "engines": {