@w5s/conventional-changelog 1.0.10 → 1.0.12
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/lib/gitmoji.d.ts +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +6 -6
- package/lib/recommended-bump-opts.d.ts +1 -1
- package/lib/recommended-bump-opts.js +16 -6
- package/lib/transform.js +2 -1
- package/lib/writer-opts.js +1 -0
- package/package.json +2 -2
- package/src/gitmoji.ts +1 -1
- package/src/index.ts +3 -3
- package/src/recommended-bump-opts.ts +16 -5
- package/src/transform.ts +2 -1
- package/src/writer-opts.ts +1 -0
package/lib/gitmoji.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
parserOpts: import("./parser-opts").ParserOptions;
|
|
3
|
-
writerOpts: import("./writer-opts").WriterOptions;
|
|
2
|
+
parserOpts: import("./parser-opts.js").ParserOptions;
|
|
3
|
+
writerOpts: import("./writer-opts.js").WriterOptions;
|
|
4
4
|
recommendedBumpOpts: {
|
|
5
|
-
parserOpts: import("./parser-opts").ParserOptions;
|
|
6
|
-
whatBump: (commits: readonly import("./recommended-bump-opts").Commit[]) => {
|
|
5
|
+
parserOpts: import("./parser-opts.js").ParserOptions;
|
|
6
|
+
whatBump: (commits: readonly import("./recommended-bump-opts.js").Commit[]) => {
|
|
7
7
|
level: number;
|
|
8
8
|
reason: string;
|
|
9
9
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const git_raw_commit_opts_1 = require("./git-raw-commit-opts");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const parser_opts_js_1 = require("./parser-opts.js");
|
|
5
|
+
const recommended_bump_opts_js_1 = require("./recommended-bump-opts.js");
|
|
6
|
+
const writer_opts_js_1 = require("./writer-opts.js");
|
|
7
7
|
exports.default = {
|
|
8
|
-
parserOpts:
|
|
9
|
-
writerOpts:
|
|
10
|
-
recommendedBumpOpts:
|
|
8
|
+
parserOpts: parser_opts_js_1.parserOpts,
|
|
9
|
+
writerOpts: writer_opts_js_1.writerOpts,
|
|
10
|
+
recommendedBumpOpts: recommended_bump_opts_js_1.recommendedBumpOpts,
|
|
11
11
|
gitRawCommitOpts: git_raw_commit_opts_1.gitRawCommitOpts,
|
|
12
12
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Commit as CommitBase } from 'conventional-commits-parser';
|
|
2
2
|
export type Commit = CommitBase;
|
|
3
3
|
export declare const recommendedBumpOpts: {
|
|
4
|
-
parserOpts: import("./parser-opts").ParserOptions;
|
|
4
|
+
parserOpts: import("./parser-opts.js").ParserOptions;
|
|
5
5
|
whatBump: (commits: ReadonlyArray<Commit>) => {
|
|
6
6
|
level: number;
|
|
7
7
|
reason: string;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.recommendedBumpOpts = void 0;
|
|
4
|
-
const
|
|
4
|
+
const parser_opts_js_1 = require("./parser-opts.js");
|
|
5
|
+
const data_js_1 = require("./data.js");
|
|
6
|
+
const gitmoji_js_1 = require("./gitmoji.js");
|
|
7
|
+
function toConventionalCommitType(text) {
|
|
8
|
+
return gitmoji_js_1.GitmojiCode.isValid(text)
|
|
9
|
+
? gitmoji_js_1.GitmojiCode.toConventionalCommitType(text)
|
|
10
|
+
: data_js_1.CommitConventionalType.hasInstance(text)
|
|
11
|
+
? text
|
|
12
|
+
: undefined;
|
|
13
|
+
}
|
|
5
14
|
exports.recommendedBumpOpts = {
|
|
6
|
-
parserOpts:
|
|
15
|
+
parserOpts: parser_opts_js_1.parserOpts,
|
|
7
16
|
whatBump: (commits) => {
|
|
8
17
|
let level = 2;
|
|
9
18
|
let breakings = 0;
|
|
10
19
|
let features = 0;
|
|
11
|
-
for (const
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
for (const { type, notes } of commits) {
|
|
21
|
+
const conventionalType = type == null ? type : toConventionalCommitType(type);
|
|
22
|
+
if (notes.length > 0) {
|
|
23
|
+
breakings += notes.length;
|
|
14
24
|
level = 0;
|
|
15
25
|
}
|
|
16
|
-
else if (
|
|
26
|
+
else if (conventionalType === data_js_1.CommitConventionalType.Feat) {
|
|
17
27
|
features += 1;
|
|
18
28
|
if (level === 2) {
|
|
19
29
|
level = 1;
|
package/lib/transform.js
CHANGED
|
@@ -54,6 +54,7 @@ function createTransform(config) {
|
|
|
54
54
|
if (url != null) {
|
|
55
55
|
const issueURL = `${url}/issues/`;
|
|
56
56
|
// Issue URLs.
|
|
57
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
57
58
|
returnValue = returnValue.replace(/#(\d+)/g, (_, issue) => {
|
|
58
59
|
issues.add(issue);
|
|
59
60
|
return `[#${issue}](${issueURL}${issue})`;
|
|
@@ -61,7 +62,7 @@ function createTransform(config) {
|
|
|
61
62
|
}
|
|
62
63
|
if (host != null) {
|
|
63
64
|
// User URLs.
|
|
64
|
-
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
65
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex, unicorn/prefer-string-replace-all
|
|
65
66
|
returnValue = returnValue.replace(/\B@([\da-z](?:-?[\d/a-z]){0,38})/g, (_, username) => username.includes('/') ? `@${username}` : `[@${username}](${host}/${username})`);
|
|
66
67
|
}
|
|
67
68
|
return returnValue;
|
package/lib/writer-opts.js
CHANGED
|
@@ -22,6 +22,7 @@ exports.writerOpts = {
|
|
|
22
22
|
noteGroupsSort: 'title',
|
|
23
23
|
mainTemplate: template,
|
|
24
24
|
headerPartial: header,
|
|
25
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
25
26
|
commitPartial: commit.replace(/{{gitUserInfo}}/g, author),
|
|
26
27
|
footerPartial: footer,
|
|
27
28
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/conventional-changelog",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Conventional changelog plugin for @w5s",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/w5s/project-config/blob/main/packages/conventional-changelog#readme",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "96f078864a6f139a2ff4d77060f94b59100e8e80"
|
|
67
67
|
}
|
package/src/gitmoji.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import emojiRegexp from 'emoji-regex';
|
|
2
2
|
import { type Gitmoji, gitmojis } from 'gitmojis';
|
|
3
|
-
import type { CommitConventionalType } from './data';
|
|
3
|
+
import type { CommitConventionalType } from './data.js';
|
|
4
4
|
|
|
5
5
|
export type Emoji = Emoji.Unicode | Emoji.Text;
|
|
6
6
|
export namespace Emoji {
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gitRawCommitOpts } from './git-raw-commit-opts';
|
|
2
|
-
import { parserOpts } from './parser-opts';
|
|
3
|
-
import { recommendedBumpOpts } from './recommended-bump-opts';
|
|
4
|
-
import { writerOpts } from './writer-opts';
|
|
2
|
+
import { parserOpts } from './parser-opts.js';
|
|
3
|
+
import { recommendedBumpOpts } from './recommended-bump-opts.js';
|
|
4
|
+
import { writerOpts } from './writer-opts.js';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
parserOpts,
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { Commit as CommitBase } from 'conventional-commits-parser';
|
|
2
|
-
import { parserOpts } from './parser-opts';
|
|
2
|
+
import { parserOpts } from './parser-opts.js';
|
|
3
|
+
import { CommitConventionalType } from './data.js';
|
|
4
|
+
import { GitmojiCode } from './gitmoji.js';
|
|
5
|
+
|
|
6
|
+
function toConventionalCommitType(text: string) {
|
|
7
|
+
return GitmojiCode.isValid(text)
|
|
8
|
+
? GitmojiCode.toConventionalCommitType(text)
|
|
9
|
+
: CommitConventionalType.hasInstance(text)
|
|
10
|
+
? text
|
|
11
|
+
: undefined;
|
|
12
|
+
}
|
|
3
13
|
|
|
4
14
|
export type Commit = CommitBase;
|
|
5
15
|
|
|
@@ -10,11 +20,12 @@ export const recommendedBumpOpts = {
|
|
|
10
20
|
let breakings = 0;
|
|
11
21
|
let features = 0;
|
|
12
22
|
|
|
13
|
-
for (const
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
for (const { type, notes } of commits) {
|
|
24
|
+
const conventionalType = type == null ? type : toConventionalCommitType(type);
|
|
25
|
+
if (notes.length > 0) {
|
|
26
|
+
breakings += notes.length;
|
|
16
27
|
level = 0;
|
|
17
|
-
} else if (
|
|
28
|
+
} else if (conventionalType === CommitConventionalType.Feat) {
|
|
18
29
|
features += 1;
|
|
19
30
|
if (level === 2) {
|
|
20
31
|
level = 1;
|
package/src/transform.ts
CHANGED
|
@@ -81,6 +81,7 @@ export function createTransform(config: TransformConfig): WriterOptions.Transfor
|
|
|
81
81
|
if (url != null) {
|
|
82
82
|
const issueURL = `${url}/issues/`;
|
|
83
83
|
// Issue URLs.
|
|
84
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
84
85
|
returnValue = returnValue.replace(/#(\d+)/g, (_, issue: string) => {
|
|
85
86
|
issues.add(issue);
|
|
86
87
|
|
|
@@ -89,7 +90,7 @@ export function createTransform(config: TransformConfig): WriterOptions.Transfor
|
|
|
89
90
|
}
|
|
90
91
|
if (host != null) {
|
|
91
92
|
// User URLs.
|
|
92
|
-
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
93
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex, unicorn/prefer-string-replace-all
|
|
93
94
|
returnValue = returnValue.replace(/\B@([\da-z](?:-?[\d/a-z]){0,38})/g, (_, username: string) =>
|
|
94
95
|
username.includes('/') ? `@${username}` : `[@${username}](${host}/${username})`
|
|
95
96
|
);
|
package/src/writer-opts.ts
CHANGED
|
@@ -26,6 +26,7 @@ export const writerOpts: WriterOptions = {
|
|
|
26
26
|
noteGroupsSort: 'title',
|
|
27
27
|
mainTemplate: template,
|
|
28
28
|
headerPartial: header,
|
|
29
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
29
30
|
commitPartial: commit.replace(/{{gitUserInfo}}/g, author),
|
|
30
31
|
footerPartial: footer,
|
|
31
32
|
};
|