@w5s/conventional-changelog 1.0.1 → 1.0.3
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/git-raw-commit-opts.d.ts +3 -0
- package/lib/git-raw-commit-opts.js +6 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +6 -0
- package/lib/recommended-bump-opts.d.ts +9 -0
- package/lib/recommended-bump-opts.js +30 -0
- package/lib/writer-opts.js +1 -1
- package/package.json +3 -2
- package/src/git-raw-commit-opts.ts +3 -0
- package/src/index.ts +6 -0
- package/src/recommended-bump-opts.ts +33 -0
- package/src/writer-opts.ts +2 -2
- package/template/author.hbs +1 -0
- package/template/commit.hbs +64 -0
- package/template/footer.hbs +11 -0
- package/template/header.hbs +25 -0
- package/template/template.hbs +14 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
parserOpts: import("./parser-opts").ParserOptions;
|
|
3
|
+
writerOpts: import("./writer-opts").WriterOptions;
|
|
4
|
+
recommendedBumpOpts: {
|
|
5
|
+
parserOpts: import("./parser-opts").ParserOptions;
|
|
6
|
+
whatBump: (commits: readonly import("./recommended-bump-opts").Commit[]) => {
|
|
7
|
+
level: number;
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
gitRawCommitOpts: {
|
|
12
|
+
format: string;
|
|
13
|
+
};
|
|
3
14
|
};
|
|
4
15
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const git_raw_commit_opts_1 = require("./git-raw-commit-opts");
|
|
3
4
|
const parser_opts_1 = require("./parser-opts");
|
|
5
|
+
const recommended_bump_opts_1 = require("./recommended-bump-opts");
|
|
6
|
+
const writer_opts_1 = require("./writer-opts");
|
|
4
7
|
exports.default = {
|
|
5
8
|
parserOpts: parser_opts_1.parserOpts,
|
|
9
|
+
writerOpts: writer_opts_1.writerOpts,
|
|
10
|
+
recommendedBumpOpts: recommended_bump_opts_1.recommendedBumpOpts,
|
|
11
|
+
gitRawCommitOpts: git_raw_commit_opts_1.gitRawCommitOpts,
|
|
6
12
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Commit as CommitBase } from 'conventional-commits-parser';
|
|
2
|
+
export type Commit = CommitBase;
|
|
3
|
+
export declare const recommendedBumpOpts: {
|
|
4
|
+
parserOpts: import("./parser-opts").ParserOptions;
|
|
5
|
+
whatBump: (commits: ReadonlyArray<Commit>) => {
|
|
6
|
+
level: number;
|
|
7
|
+
reason: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recommendedBumpOpts = void 0;
|
|
4
|
+
const parser_opts_1 = require("./parser-opts");
|
|
5
|
+
exports.recommendedBumpOpts = {
|
|
6
|
+
parserOpts: parser_opts_1.parserOpts,
|
|
7
|
+
whatBump: (commits) => {
|
|
8
|
+
let level = 2;
|
|
9
|
+
let breakings = 0;
|
|
10
|
+
let features = 0;
|
|
11
|
+
for (const commit of commits) {
|
|
12
|
+
if (commit.notes.length > 0) {
|
|
13
|
+
breakings += commit.notes.length;
|
|
14
|
+
level = 0;
|
|
15
|
+
}
|
|
16
|
+
else if (commit.type === 'feat') {
|
|
17
|
+
features += 1;
|
|
18
|
+
if (level === 2) {
|
|
19
|
+
level = 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
level,
|
|
25
|
+
reason: breakings === 1
|
|
26
|
+
? `There is ${breakings} BREAKING CHANGE and ${features} features`
|
|
27
|
+
: `There are ${breakings} BREAKING CHANGES and ${features} features`,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
};
|
package/lib/writer-opts.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.writerOpts = void 0;
|
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const transform_js_1 = require("./transform.js");
|
|
7
|
-
const basePath = (0, node_path_1.resolve)(__dirname, './
|
|
7
|
+
const basePath = (0, node_path_1.resolve)((0, node_path_1.dirname)(__dirname), './template');
|
|
8
8
|
const template = (0, node_fs_1.readFileSync)(`${basePath}/template.hbs`, 'utf8');
|
|
9
9
|
const header = (0, node_fs_1.readFileSync)(`${basePath}/header.hbs`, 'utf8');
|
|
10
10
|
const commit = (0, node_fs_1.readFileSync)(`${basePath}/commit.hbs`, 'utf8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/conventional-changelog",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"typings": "./lib/index.d.ts",
|
|
23
23
|
"files": [
|
|
24
|
+
"template/*",
|
|
24
25
|
"lib/**/!(*.spec).d.ts",
|
|
25
26
|
"lib/**/!(*.spec).d.ts.map",
|
|
26
27
|
"lib/**/!(*.spec).js.map",
|
|
@@ -62,5 +63,5 @@
|
|
|
62
63
|
"publishConfig": {
|
|
63
64
|
"access": "public"
|
|
64
65
|
},
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "8dd55a7518db456cdaa696f873204962e177aa13"
|
|
66
67
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { gitRawCommitOpts } from './git-raw-commit-opts';
|
|
1
2
|
import { parserOpts } from './parser-opts';
|
|
3
|
+
import { recommendedBumpOpts } from './recommended-bump-opts';
|
|
4
|
+
import { writerOpts } from './writer-opts';
|
|
2
5
|
|
|
3
6
|
export default {
|
|
4
7
|
parserOpts,
|
|
8
|
+
writerOpts,
|
|
9
|
+
recommendedBumpOpts,
|
|
10
|
+
gitRawCommitOpts,
|
|
5
11
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Commit as CommitBase } from 'conventional-commits-parser';
|
|
2
|
+
import { parserOpts } from './parser-opts';
|
|
3
|
+
|
|
4
|
+
export type Commit = CommitBase;
|
|
5
|
+
|
|
6
|
+
export const recommendedBumpOpts = {
|
|
7
|
+
parserOpts,
|
|
8
|
+
whatBump: (commits: ReadonlyArray<Commit>) => {
|
|
9
|
+
let level = 2;
|
|
10
|
+
let breakings = 0;
|
|
11
|
+
let features = 0;
|
|
12
|
+
|
|
13
|
+
for (const commit of commits) {
|
|
14
|
+
if (commit.notes.length > 0) {
|
|
15
|
+
breakings += commit.notes.length;
|
|
16
|
+
level = 0;
|
|
17
|
+
} else if (commit.type === 'feat') {
|
|
18
|
+
features += 1;
|
|
19
|
+
if (level === 2) {
|
|
20
|
+
level = 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
level,
|
|
27
|
+
reason:
|
|
28
|
+
breakings === 1
|
|
29
|
+
? `There is ${breakings} BREAKING CHANGE and ${features} features`
|
|
30
|
+
: `There are ${breakings} BREAKING CHANGES and ${features} features`,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
package/src/writer-opts.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Options } from 'conventional-changelog-writer';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
3
|
+
import { resolve, dirname } from 'node:path';
|
|
4
4
|
import { createTransform } from './transform.js';
|
|
5
5
|
|
|
6
6
|
export interface WriterOptions extends Options {}
|
|
7
7
|
|
|
8
|
-
const basePath = resolve(__dirname, './
|
|
8
|
+
const basePath = resolve(dirname(__dirname), './template');
|
|
9
9
|
|
|
10
10
|
const template = readFileSync(`${basePath}/template.hbs`, 'utf8');
|
|
11
11
|
const header = readFileSync(`${basePath}/header.hbs`, 'utf8');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{#if authorName}}by: **{{authorName}}**{{#if authorEmail}}<{{authorEmail}}>{{/if}}{{/if}}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
*{{#if scope}} **{{scope}}**:
|
|
2
|
+
{{~/if}} {{#if subject}}
|
|
3
|
+
{{~subject}}
|
|
4
|
+
{{~else}}
|
|
5
|
+
{{~header}}
|
|
6
|
+
{{~/if}}
|
|
7
|
+
|
|
8
|
+
{{~!-- commit link --}} {{#if @root.linkReferences~}}
|
|
9
|
+
([{{hash}}](
|
|
10
|
+
{{~#if @root.repository}}
|
|
11
|
+
{{~#if @root.host}}
|
|
12
|
+
{{~@root.host}}/
|
|
13
|
+
{{~/if}}
|
|
14
|
+
{{~#if @root.owner}}
|
|
15
|
+
{{~@root.owner}}/
|
|
16
|
+
{{~/if}}
|
|
17
|
+
{{~@root.repository}}
|
|
18
|
+
{{~else}}
|
|
19
|
+
{{~@root.repoUrl}}
|
|
20
|
+
{{~/if}}/
|
|
21
|
+
{{~@root.commit}}/{{hash}})) {{gitUserInfo}}
|
|
22
|
+
{{~else}}
|
|
23
|
+
{{~hash}}
|
|
24
|
+
{{~/if}}
|
|
25
|
+
|
|
26
|
+
{{~!-- commit references --}}
|
|
27
|
+
{{~#if references~}}
|
|
28
|
+
, closes
|
|
29
|
+
{{~#each references}} {{#if @root.linkReferences~}}
|
|
30
|
+
[
|
|
31
|
+
{{~#if this.owner}}
|
|
32
|
+
{{~this.owner}}/
|
|
33
|
+
{{~/if}}
|
|
34
|
+
{{~this.repository}}#{{this.issue}}](
|
|
35
|
+
{{~#if this.bugsUrl}}
|
|
36
|
+
{{~this.bugsUrl}}{{this.issue}}
|
|
37
|
+
{{~else}}
|
|
38
|
+
{{~#if @root.repository}}
|
|
39
|
+
{{~#if @root.host}}
|
|
40
|
+
{{~@root.host}}/
|
|
41
|
+
{{~/if}}
|
|
42
|
+
{{~#if this.repository}}
|
|
43
|
+
{{~#if this.owner}}
|
|
44
|
+
{{~this.owner}}/
|
|
45
|
+
{{~/if}}
|
|
46
|
+
{{~this.repository}}
|
|
47
|
+
{{~else}}
|
|
48
|
+
{{~#if @root.owner}}
|
|
49
|
+
{{~@root.owner}}/
|
|
50
|
+
{{~/if}}
|
|
51
|
+
{{~@root.repository}}
|
|
52
|
+
{{~/if}}
|
|
53
|
+
{{~else}}
|
|
54
|
+
{{~@root.repoUrl}}
|
|
55
|
+
{{~/if}}/
|
|
56
|
+
{{~@root.issue}}/{{this.issue}}
|
|
57
|
+
{{~/if}})
|
|
58
|
+
{{~else}}
|
|
59
|
+
{{~#if this.owner}}
|
|
60
|
+
{{~this.owner}}/
|
|
61
|
+
{{~/if}}
|
|
62
|
+
{{~this.repository}}#{{this.issue}}
|
|
63
|
+
{{~/if}}{{/each}}
|
|
64
|
+
{{~/if}}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{{#if isPatch~}}
|
|
2
|
+
##
|
|
3
|
+
{{~else~}}
|
|
4
|
+
#
|
|
5
|
+
{{~/if}} {{#if @root.linkCompare~}}
|
|
6
|
+
[{{version}}](
|
|
7
|
+
{{~#if @root.repository~}}
|
|
8
|
+
{{~#if @root.host}}
|
|
9
|
+
{{~@root.host}}/
|
|
10
|
+
{{~/if}}
|
|
11
|
+
{{~#if @root.owner}}
|
|
12
|
+
{{~@root.owner}}/
|
|
13
|
+
{{~/if}}
|
|
14
|
+
{{~@root.repository}}
|
|
15
|
+
{{~else}}
|
|
16
|
+
{{~@root.repoUrl}}
|
|
17
|
+
{{~/if~}}
|
|
18
|
+
/compare/{{previousTag}}...{{currentTag}})
|
|
19
|
+
{{~else}}
|
|
20
|
+
{{~version}}
|
|
21
|
+
{{~/if}}
|
|
22
|
+
{{~#if title}} "{{title}}"
|
|
23
|
+
{{~/if}}
|
|
24
|
+
{{~#if date}} ({{date}})
|
|
25
|
+
{{/if}}
|