git-release-manager 0.0.3 → 0.0.4
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/src/PackageJson.js +3 -0
- package/dist/src/PackageJson.js.map +1 -0
- package/dist/src/cli/types/ChangelogCliArgs.js +3 -0
- package/dist/src/cli/types/ChangelogCliArgs.js.map +1 -0
- package/dist/src/cli/types/ChnagelogCliArgs.js +3 -0
- package/dist/src/cli/types/ChnagelogCliArgs.js.map +1 -0
- package/dist/src/cli/types/CliArgs.js +3 -0
- package/dist/src/cli/types/CliArgs.js.map +1 -0
- package/dist/src/config/configLoader.js +61 -0
- package/dist/src/config/configLoader.js.map +1 -0
- package/dist/src/config/{index.js → configManager.js} +13 -33
- package/dist/src/config/configManager.js.map +1 -0
- package/dist/src/config/constants.js +10 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/types/ChannelType.js +3 -0
- package/dist/src/config/types/ChannelType.js.map +1 -0
- package/dist/src/config/types/CommitType.js +3 -0
- package/dist/src/config/types/CommitType.js.map +1 -0
- package/dist/src/config/types/Config.js +3 -0
- package/dist/src/config/types/Config.js.map +1 -0
- package/dist/src/config/types/FileGroups.js +3 -0
- package/dist/src/config/types/FileGroups.js.map +1 -0
- package/dist/src/config/types/LinkType.js +3 -0
- package/dist/src/config/types/LinkType.js.map +1 -0
- package/dist/src/config/types/MentionType.js +3 -0
- package/dist/src/config/types/MentionType.js.map +1 -0
- package/dist/src/config/types/NoteType.js +3 -0
- package/dist/src/config/types/NoteType.js.map +1 -0
- package/dist/src/config/types/Options.js +3 -0
- package/dist/src/config/types/Options.js.map +1 -0
- package/dist/src/core/app-old.js +35 -0
- package/dist/src/core/app-old.js.map +1 -0
- package/dist/src/core/app.js +7 -206
- package/dist/src/core/app.js.map +1 -1
- package/dist/src/core/changelog/app.js +19 -0
- package/dist/src/core/changelog/app.js.map +1 -0
- package/dist/src/core/gitOperations.js +95 -0
- package/dist/src/core/gitOperations.js.map +1 -0
- package/dist/src/core/rangeOperations.js +14 -0
- package/dist/src/core/rangeOperations.js.map +1 -0
- package/dist/src/core/templateOperations.js +157 -0
- package/dist/src/core/templateOperations.js.map +1 -0
- package/dist/src/core/types/ChangeInformation.js +3 -0
- package/dist/src/core/types/ChangeInformation.js.map +1 -0
- package/dist/src/core/types/Context.js +3 -0
- package/dist/src/core/types/Context.js.map +1 -0
- package/dist/src/core/types/RangeDetails.js +3 -0
- package/dist/src/core/types/RangeDetails.js.map +1 -0
- package/dist/src/core/types/RangeInfo.js +3 -0
- package/dist/src/core/types/RangeInfo.js.map +1 -0
- package/dist/src/core/types/ReferenceTypesEnum.js +12 -0
- package/dist/src/core/types/ReferenceTypesEnum.js.map +1 -0
- package/dist/src/core/types/Repository.js +3 -0
- package/dist/src/core/types/Repository.js.map +1 -0
- package/dist/src/git/commits/commitProcessor.js +52 -0
- package/dist/src/git/commits/commitProcessor.js.map +1 -0
- package/dist/src/git/commits/gitLogFetcher.js +27 -0
- package/dist/src/git/commits/gitLogFetcher.js.map +1 -0
- package/dist/src/git/commits/index.js +136 -0
- package/dist/src/git/commits/index.js.map +1 -0
- package/dist/src/git/commits/profileHandler.js +43 -0
- package/dist/src/git/commits/profileHandler.js.map +1 -0
- package/dist/src/git/commits/regexHandlers.js +27 -0
- package/dist/src/git/commits/regexHandlers.js.map +1 -0
- package/dist/src/git/commits.js +8 -109
- package/dist/src/git/commits.js.map +1 -1
- package/dist/src/git/context/branchHandler.js +23 -0
- package/dist/src/git/context/branchHandler.js.map +1 -0
- package/dist/src/git/context/commitHandler.js +30 -0
- package/dist/src/git/context/commitHandler.js.map +1 -0
- package/dist/src/git/context/index.js +31 -0
- package/dist/src/git/context/index.js.map +1 -0
- package/dist/src/git/context/remoteHandler.js +25 -0
- package/dist/src/git/context/remoteHandler.js.map +1 -0
- package/dist/src/git/context/statusHandler.js +21 -0
- package/dist/src/git/context/statusHandler.js.map +1 -0
- package/dist/src/git/context/tagHandler.js +21 -0
- package/dist/src/git/context/tagHandler.js.map +1 -0
- package/dist/src/git/context.js +2 -2
- package/dist/src/git/context.js.map +1 -1
- package/dist/src/git/types/Author.js +3 -0
- package/dist/src/git/types/Author.js.map +1 -0
- package/dist/src/git/types/BranchInfo.js +3 -0
- package/dist/src/git/types/BranchInfo.js.map +1 -0
- package/dist/src/git/types/CommitContent.js +3 -0
- package/dist/src/git/types/CommitContent.js.map +1 -0
- package/dist/src/git/types/CommitInfo.js +3 -0
- package/dist/src/git/types/CommitInfo.js.map +1 -0
- package/dist/src/git/types/CommitType.js +3 -0
- package/dist/src/git/types/CommitType.js.map +1 -0
- package/dist/src/git/types/CommitType2.js +3 -0
- package/dist/src/git/types/CommitType2.js.map +1 -0
- package/dist/src/git/types/GitCommit.js +3 -0
- package/dist/src/git/types/GitCommit.js.map +1 -0
- package/dist/src/git/types/GitContext.js +3 -0
- package/dist/src/git/types/GitContext.js.map +1 -0
- package/dist/src/{core/types.js → git/types/Link.js} +1 -1
- package/dist/src/git/types/Link.js.map +1 -0
- package/dist/src/git/types/LinkType-.js +3 -0
- package/dist/src/git/types/LinkType-.js.map +1 -0
- package/dist/src/git/types/LinkType.js +3 -0
- package/dist/src/git/types/LinkType.js.map +1 -0
- package/dist/src/git/types/Mention.js +3 -0
- package/dist/src/git/types/Mention.js.map +1 -0
- package/dist/src/git/types/MentionType-.js +3 -0
- package/dist/src/git/types/MentionType-.js.map +1 -0
- package/dist/src/git/types/MentionType.js +3 -0
- package/dist/src/git/types/MentionType.js.map +1 -0
- package/dist/src/{config/types.js → git/types/Note.js} +1 -1
- package/dist/src/git/types/Note.js.map +1 -0
- package/dist/src/git/types/RemoteInfo.js +3 -0
- package/dist/src/git/types/RemoteInfo.js.map +1 -0
- package/dist/src/git/types/StatusInfo.js +3 -0
- package/dist/src/git/types/StatusInfo.js.map +1 -0
- package/dist/src/git/types/TagInfo.js +3 -0
- package/dist/src/git/types/TagInfo.js.map +1 -0
- package/dist/src/git/utils/branchUtils.js +56 -0
- package/dist/src/git/utils/branchUtils.js.map +1 -0
- package/dist/src/git/utils/commitUtils.js +50 -0
- package/dist/src/git/utils/commitUtils.js.map +1 -0
- package/dist/src/git/utils/logUtils.js +18 -0
- package/dist/src/git/utils/logUtils.js.map +1 -0
- package/dist/src/git/utils/refUtils.js +41 -0
- package/dist/src/git/utils/refUtils.js.map +1 -0
- package/dist/src/git/utils/referenceUtils.js +138 -0
- package/dist/src/git/utils/referenceUtils.js.map +1 -0
- package/dist/src/git/utils/tagUtils.js +54 -0
- package/dist/src/git/utils/tagUtils.js.map +1 -0
- package/dist/src/index.js +11 -10
- package/dist/src/index.js.map +1 -1
- package/dist/src/main.js +3 -9
- package/dist/src/main.js.map +1 -1
- package/dist/src/modules/changelog/templateOperations.js +129 -0
- package/dist/src/modules/changelog/templateOperations.js.map +1 -0
- package/dist/src/modules/changes/types/ChangeInformation.js +3 -0
- package/dist/src/modules/changes/types/ChangeInformation.js.map +1 -0
- package/dist/src/modules/changes/types/Context.js +3 -0
- package/dist/src/modules/changes/types/Context.js.map +1 -0
- package/dist/src/modules/changes/types/RangeDetail.js +3 -0
- package/dist/src/modules/changes/types/RangeDetail.js.map +1 -0
- package/dist/src/modules/changes/types/RangeDetails.js +3 -0
- package/dist/src/modules/changes/types/RangeDetails.js.map +1 -0
- package/dist/src/modules/changes/types/RangeInfo.js +8 -0
- package/dist/src/modules/changes/types/RangeInfo.js.map +1 -0
- package/dist/src/modules/changes/types/RangeSummary.js +3 -0
- package/dist/src/modules/changes/types/RangeSummary.js.map +1 -0
- package/dist/src/modules/changes/types/ReferenceTypesEnum.js +12 -0
- package/dist/src/modules/changes/types/ReferenceTypesEnum.js.map +1 -0
- package/dist/src/modules/git/commits/commitProcessor.js +52 -0
- package/dist/src/modules/git/commits/commitProcessor.js.map +1 -0
- package/dist/src/modules/git/commits/gitLogFetcher.js +27 -0
- package/dist/src/modules/git/commits/gitLogFetcher.js.map +1 -0
- package/dist/src/modules/git/commits/index.js +136 -0
- package/dist/src/modules/git/commits/index.js.map +1 -0
- package/dist/src/modules/git/commits/profileHandler.js +45 -0
- package/dist/src/modules/git/commits/profileHandler.js.map +1 -0
- package/dist/src/modules/git/commits/regexHandlers.js +27 -0
- package/dist/src/modules/git/commits/regexHandlers.js.map +1 -0
- package/dist/src/modules/git/context/branchHandler.js +23 -0
- package/dist/src/modules/git/context/branchHandler.js.map +1 -0
- package/dist/src/modules/git/context/commitHandler.js +34 -0
- package/dist/src/modules/git/context/commitHandler.js.map +1 -0
- package/dist/src/modules/git/context/index.js +28 -0
- package/dist/src/modules/git/context/index.js.map +1 -0
- package/dist/src/modules/git/context/remoteHandler.js +25 -0
- package/dist/src/modules/git/context/remoteHandler.js.map +1 -0
- package/dist/src/modules/git/context/statusHandler.js +21 -0
- package/dist/src/modules/git/context/statusHandler.js.map +1 -0
- package/dist/src/modules/git/context/tagHandler.js +33 -0
- package/dist/src/modules/git/context/tagHandler.js.map +1 -0
- package/dist/src/modules/git/gitOperations.js +56 -0
- package/dist/src/modules/git/gitOperations.js.map +1 -0
- package/dist/src/modules/git/types/Author.js +3 -0
- package/dist/src/modules/git/types/Author.js.map +1 -0
- package/dist/src/modules/git/types/Branch.js +3 -0
- package/dist/src/modules/git/types/Branch.js.map +1 -0
- package/dist/src/modules/git/types/BranchInfo.js +3 -0
- package/dist/src/modules/git/types/BranchInfo.js.map +1 -0
- package/dist/src/modules/git/types/CommitContent.js +3 -0
- package/dist/src/modules/git/types/CommitContent.js.map +1 -0
- package/dist/src/modules/git/types/CommitInfo.js +3 -0
- package/dist/src/modules/git/types/CommitInfo.js.map +1 -0
- package/dist/src/modules/git/types/CommitType.js +3 -0
- package/dist/src/modules/git/types/CommitType.js.map +1 -0
- package/dist/src/modules/git/types/GitCommit.js +3 -0
- package/dist/src/modules/git/types/GitCommit.js.map +1 -0
- package/dist/src/modules/git/types/GitContext.js +3 -0
- package/dist/src/modules/git/types/GitContext.js.map +1 -0
- package/dist/src/modules/git/types/GitReference.js +3 -0
- package/dist/src/modules/git/types/GitReference.js.map +1 -0
- package/dist/src/modules/git/types/Link.js +3 -0
- package/dist/src/modules/git/types/Link.js.map +1 -0
- package/dist/src/modules/git/types/Mention.js +3 -0
- package/dist/src/modules/git/types/Mention.js.map +1 -0
- package/dist/src/modules/git/types/Note.js +3 -0
- package/dist/src/modules/git/types/Note.js.map +1 -0
- package/dist/src/modules/git/types/RemoteInfo.js +3 -0
- package/dist/src/modules/git/types/RemoteInfo.js.map +1 -0
- package/dist/src/modules/git/types/Repository.js +3 -0
- package/dist/src/modules/git/types/Repository.js.map +1 -0
- package/dist/src/modules/git/types/StatusInfo.js +3 -0
- package/dist/src/modules/git/types/StatusInfo.js.map +1 -0
- package/dist/src/{utils/cli.js → modules/git/types/Tag.js} +1 -1
- package/dist/src/modules/git/types/Tag.js.map +1 -0
- package/dist/src/modules/git/types/TagInfo.js +3 -0
- package/dist/src/modules/git/types/TagInfo.js.map +1 -0
- package/dist/src/modules/git/utils/branchUtils.js +56 -0
- package/dist/src/modules/git/utils/branchUtils.js.map +1 -0
- package/dist/src/modules/git/utils/commitUtils.js +50 -0
- package/dist/src/modules/git/utils/commitUtils.js.map +1 -0
- package/dist/src/modules/git/utils/logUtils.js +18 -0
- package/dist/src/modules/git/utils/logUtils.js.map +1 -0
- package/dist/src/modules/git/utils/rangeOperations.js +14 -0
- package/dist/src/modules/git/utils/rangeOperations.js.map +1 -0
- package/dist/src/modules/git/utils/refUtils.js +41 -0
- package/dist/src/modules/git/utils/refUtils.js.map +1 -0
- package/dist/src/modules/git/utils/referenceUtils.js +132 -0
- package/dist/src/modules/git/utils/referenceUtils.js.map +1 -0
- package/dist/src/modules/git/utils/tagUtils.js +54 -0
- package/dist/src/modules/git/utils/tagUtils.js.map +1 -0
- package/dist/src/modules/output/writer.js +46 -0
- package/dist/src/modules/output/writer.js.map +1 -0
- package/dist/src/modules/repository/types/Repository.js +3 -0
- package/dist/src/modules/repository/types/Repository.js.map +1 -0
- package/dist/src/modules/sections/contributors.js +50 -0
- package/dist/src/modules/sections/contributors.js.map +1 -0
- package/dist/src/modules/sections/grouping.js +64 -0
- package/dist/src/modules/sections/grouping.js.map +1 -0
- package/dist/src/modules/sections/index.js +19 -0
- package/dist/src/modules/sections/index.js.map +1 -0
- package/dist/src/modules/sections/summarizing.js +75 -0
- package/dist/src/modules/sections/summarizing.js.map +1 -0
- package/dist/src/modules/sections/types/Contributor.js +3 -0
- package/dist/src/modules/sections/types/Contributor.js.map +1 -0
- package/dist/src/modules/sections/types/Group.js +3 -0
- package/dist/src/modules/sections/types/Group.js.map +1 -0
- package/dist/src/modules/sections/types/SectionSummary.js +3 -0
- package/dist/src/modules/sections/types/SectionSummary.js.map +1 -0
- package/dist/src/modules/sections/types/Sections.js +3 -0
- package/dist/src/modules/sections/types/Sections.js.map +1 -0
- package/dist/src/modules/templates/constants.js +10 -0
- package/dist/src/modules/templates/constants.js.map +1 -0
- package/dist/src/modules/templates/templateRenderer.js +46 -0
- package/dist/src/modules/templates/templateRenderer.js.map +1 -0
- package/dist/src/modules/templates/templateResolver.js +70 -0
- package/dist/src/modules/templates/templateResolver.js.map +1 -0
- package/dist/src/sections/contributors.js +50 -0
- package/dist/src/sections/contributors.js.map +1 -0
- package/dist/src/sections/grouping.js +70 -0
- package/dist/src/sections/grouping.js.map +1 -0
- package/dist/src/sections/index.js +9 -196
- package/dist/src/sections/index.js.map +1 -1
- package/dist/src/sections/summarizing.js +79 -0
- package/dist/src/sections/summarizing.js.map +1 -0
- package/dist/src/sections/types/Contributor.js +15 -0
- package/dist/src/sections/types/Contributor.js.map +1 -0
- package/dist/src/sections/types/Group.js +3 -0
- package/dist/src/sections/types/Group.js.map +1 -0
- package/dist/src/sections/types/SectionSummary.js +13 -0
- package/dist/src/sections/types/SectionSummary.js.map +1 -0
- package/dist/src/sections/types/Sections.js +3 -0
- package/dist/src/sections/types/Sections.js.map +1 -0
- package/dist/src/templates/constants.js +10 -0
- package/dist/src/templates/constants.js.map +1 -0
- package/dist/src/templates/defaults/changelog.detailed.ejs +111 -0
- package/dist/src/templates/defaults/changelog.ejs +68 -0
- package/dist/src/templates/index.js +7 -8
- package/dist/src/templates/index.js.map +1 -1
- package/dist/src/templates/templateRenderer.js +46 -0
- package/dist/src/templates/templateRenderer.js.map +1 -0
- package/dist/src/templates/templateResolver.js +70 -0
- package/dist/src/templates/templateResolver.js.map +1 -0
- package/dist/src/types/PackageJson.js +3 -0
- package/dist/src/types/PackageJson.js.map +1 -0
- package/dist/src/utils/cmd.js +0 -30
- package/dist/src/utils/cmd.js.map +1 -1
- package/dist/src/utils/date.js +20 -0
- package/dist/src/utils/date.js.map +1 -0
- package/dist/src/utils/git-utils.js +7 -6
- package/dist/src/utils/git-utils.js.map +1 -1
- package/dist/src/utils/helpers.js +0 -40
- package/dist/src/utils/helpers.js.map +1 -1
- package/dist/test/config/{loadConfigFile.test.js → configLoader/loadConfigFile.test.js} +24 -24
- package/dist/test/config/configLoader/loadConfigFile.test.js.map +1 -0
- package/dist/test/config/{readConfig.test.js → configManager/readConfig.test.js} +37 -38
- package/dist/test/config/configManager/readConfig.test.js.map +1 -0
- package/package.json +3 -3
- package/dist/src/config/index.js.map +0 -1
- package/dist/src/config/types.js.map +0 -1
- package/dist/src/core/types.js.map +0 -1
- package/dist/src/utils/cli.js.map +0 -1
- package/dist/test/config/loadConfigFile.test.js.map +0 -1
- package/dist/test/config/readConfig.test.js.map +0 -1
- /package/dist/src/config/{defaultConfig.json → defaults/config.json} +0 -0
- /package/dist/src/{templates → modules/templates/defaults}/changelog.detailed.ejs +0 -0
- /package/dist/src/{templates → modules/templates/defaults}/changelog.ejs +0 -0
|
@@ -2,206 +2,19 @@
|
|
|
2
2
|
// Typescript version of your code
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.createSections = createSections;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.groupBy = groupBy;
|
|
9
|
-
exports.groupByNotes = groupByNotes;
|
|
10
|
-
exports.getContributors = getContributors;
|
|
5
|
+
const contributors_1 = require("./contributors");
|
|
6
|
+
const grouping_1 = require("./grouping");
|
|
7
|
+
const summarizing_1 = require("./summarizing");
|
|
11
8
|
function createSections(commits, config) {
|
|
12
9
|
const sections = {};
|
|
13
|
-
sections.commits = groupBy(commits, "type", config);
|
|
14
|
-
sections.notes = groupByNotes(commits, config, false);
|
|
15
|
-
sections.contributors = getContributors(commits, config);
|
|
10
|
+
sections.commits = (0, grouping_1.groupBy)(commits, "type", config);
|
|
11
|
+
sections.notes = (0, grouping_1.groupByNotes)(commits, config, false);
|
|
12
|
+
sections.contributors = (0, contributors_1.getContributors)(commits, config);
|
|
16
13
|
sections.summary = {
|
|
17
|
-
commits: summarizeCommits(sections.commits, config),
|
|
18
|
-
notes: summarizeNotes(sections.notes, config),
|
|
19
|
-
contributors: summarizeContributors(sections.contributors, config),
|
|
14
|
+
commits: (0, summarizing_1.summarizeCommits)(sections.commits, config),
|
|
15
|
+
notes: (0, summarizing_1.summarizeNotes)(sections.notes, config),
|
|
16
|
+
contributors: (0, summarizing_1.summarizeContributors)(sections.contributors, config),
|
|
20
17
|
};
|
|
21
18
|
return sections;
|
|
22
19
|
}
|
|
23
|
-
function summarizeCommits(commits, config) {
|
|
24
|
-
if (!Array.isArray(commits)) {
|
|
25
|
-
throw new Error("Invalid input: commits must be an array");
|
|
26
|
-
}
|
|
27
|
-
const result = [];
|
|
28
|
-
const summary = commits.reduce((acc, commit) => {
|
|
29
|
-
const type = commit.type;
|
|
30
|
-
if (!acc[type]) {
|
|
31
|
-
const matchingType = config.commitTypes.find((ct) => ct.type === type);
|
|
32
|
-
const typeTitle = matchingType ? matchingType.title : "Other Changes";
|
|
33
|
-
const order = matchingType && matchingType.order !== undefined
|
|
34
|
-
? matchingType.order
|
|
35
|
-
: Number.MAX_SAFE_INTEGER;
|
|
36
|
-
acc[type] = {
|
|
37
|
-
type: type,
|
|
38
|
-
title: typeTitle,
|
|
39
|
-
count: commit.items.length,
|
|
40
|
-
order: order,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return acc;
|
|
44
|
-
}, {});
|
|
45
|
-
result.push(...Object.values(summary));
|
|
46
|
-
result.sort((a, b) => a.order - b.order);
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
function summarizeNotes(notes, config) {
|
|
50
|
-
if (!Array.isArray(notes)) {
|
|
51
|
-
throw new Error("Invalid input: notes must be an array");
|
|
52
|
-
}
|
|
53
|
-
const result = [];
|
|
54
|
-
const summary = notes.reduce((acc, note) => {
|
|
55
|
-
const type = note.type;
|
|
56
|
-
if (!acc[type]) {
|
|
57
|
-
const matchingType = config.noteTypes.find((nt) => nt.type === type);
|
|
58
|
-
const typeTitle = matchingType ? matchingType.title : "Other Notes";
|
|
59
|
-
const order = matchingType && matchingType.order !== undefined
|
|
60
|
-
? matchingType.order
|
|
61
|
-
: Number.MAX_SAFE_INTEGER;
|
|
62
|
-
acc[type] = {
|
|
63
|
-
type: type,
|
|
64
|
-
title: typeTitle,
|
|
65
|
-
count: note.items.length,
|
|
66
|
-
order: order,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return acc;
|
|
70
|
-
}, {});
|
|
71
|
-
result.push(...Object.values(summary));
|
|
72
|
-
result.sort((a, b) => a.order - b.order);
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
function summarizeContributors(contributors, config) {
|
|
76
|
-
if (!Array.isArray(contributors)) {
|
|
77
|
-
throw new Error("Invalid input: contributors must be an array");
|
|
78
|
-
}
|
|
79
|
-
const result = [];
|
|
80
|
-
const summary = contributors.reduce((acc, contributor) => {
|
|
81
|
-
var _a;
|
|
82
|
-
const type = contributor.email;
|
|
83
|
-
if (!acc[type]) {
|
|
84
|
-
acc[type] = {
|
|
85
|
-
email: contributor.email,
|
|
86
|
-
name: contributor.name,
|
|
87
|
-
profileUrl: contributor.profileUrl,
|
|
88
|
-
count: ((_a = contributor.groups) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
return acc;
|
|
92
|
-
}, {});
|
|
93
|
-
result.push(...Object.values(summary));
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
function groupBy(commits, key, config) {
|
|
97
|
-
if (!Array.isArray(commits)) {
|
|
98
|
-
throw new Error("Invalid input: commits must be an array");
|
|
99
|
-
}
|
|
100
|
-
const result = [];
|
|
101
|
-
const grouped = commits.reduce((acc, commit) => {
|
|
102
|
-
const groupKey = key
|
|
103
|
-
.split(".")
|
|
104
|
-
.reduce((nested, part) => nested && nested[part], commit);
|
|
105
|
-
if (!acc[groupKey]) {
|
|
106
|
-
const matchingType = config.commitTypes.find((ct) => ct.terms.includes(groupKey));
|
|
107
|
-
const typeTitle = matchingType ? matchingType.title : "Other Changes";
|
|
108
|
-
const order = matchingType && matchingType.order !== undefined
|
|
109
|
-
? matchingType.order
|
|
110
|
-
: Number.MAX_SAFE_INTEGER;
|
|
111
|
-
acc[groupKey] = {
|
|
112
|
-
type: matchingType ? matchingType.type : "other",
|
|
113
|
-
title: typeTitle,
|
|
114
|
-
order: order,
|
|
115
|
-
items: [],
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
acc[groupKey].items.push(commit);
|
|
119
|
-
return acc;
|
|
120
|
-
}, {});
|
|
121
|
-
result.push(...Object.values(grouped));
|
|
122
|
-
result.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
function groupByNotes(array, config, includeUnmatched = true) {
|
|
126
|
-
if (!Array.isArray(array)) {
|
|
127
|
-
throw new Error("Invalid input: array must be an array");
|
|
128
|
-
}
|
|
129
|
-
const result = [];
|
|
130
|
-
const grouped = array.reduce((acc, item) => {
|
|
131
|
-
if (!item.notes || item.notes.length === 0)
|
|
132
|
-
return acc;
|
|
133
|
-
item.notes.forEach((note) => {
|
|
134
|
-
const groupKey = note.type;
|
|
135
|
-
const matchingType = config.noteTypes.find((nt) => nt.type === groupKey);
|
|
136
|
-
if (!matchingType && !includeUnmatched)
|
|
137
|
-
return;
|
|
138
|
-
if (!acc[groupKey]) {
|
|
139
|
-
const typeTitle = matchingType ? matchingType.title : groupKey;
|
|
140
|
-
const order = matchingType && matchingType.order !== undefined
|
|
141
|
-
? matchingType.order
|
|
142
|
-
: Number.MAX_SAFE_INTEGER;
|
|
143
|
-
acc[groupKey] = {
|
|
144
|
-
type: groupKey,
|
|
145
|
-
title: typeTitle,
|
|
146
|
-
order: order,
|
|
147
|
-
items: [],
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
acc[groupKey].items.push({
|
|
151
|
-
note,
|
|
152
|
-
commit: item,
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
return acc;
|
|
156
|
-
}, {});
|
|
157
|
-
result.push(...Object.values(grouped));
|
|
158
|
-
result.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
function getContributors(commits, config) {
|
|
162
|
-
const contributors = {};
|
|
163
|
-
commits.forEach((commit) => {
|
|
164
|
-
const allContributors = [commit.author, ...(commit.mentions || [])];
|
|
165
|
-
allContributors.forEach((contributor) => {
|
|
166
|
-
var _a;
|
|
167
|
-
const key = contributor.email;
|
|
168
|
-
if (!contributors[key]) {
|
|
169
|
-
contributors[key] = {
|
|
170
|
-
...contributor,
|
|
171
|
-
groups: [],
|
|
172
|
-
files: [],
|
|
173
|
-
commits: [],
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
const normalizePath = (path) => path.replace(/\\/g, "/");
|
|
177
|
-
commit.files.forEach((file) => {
|
|
178
|
-
var _a;
|
|
179
|
-
const normalizedFile = normalizePath(file);
|
|
180
|
-
Object.entries(config.fileGroups).forEach(([group, paths]) => {
|
|
181
|
-
var _a;
|
|
182
|
-
if (paths.some((path) => normalizedFile.startsWith(normalizePath(path)))) {
|
|
183
|
-
let groupObj = (_a = contributors[key].groups) === null || _a === void 0 ? void 0 : _a.find((g) => g.title === group);
|
|
184
|
-
if (!groupObj) {
|
|
185
|
-
groupObj = { title: group, files: [], commits: [] };
|
|
186
|
-
contributors[key].groups.push(groupObj);
|
|
187
|
-
}
|
|
188
|
-
if (!groupObj.files.includes(normalizedFile)) {
|
|
189
|
-
groupObj.files.push(normalizedFile);
|
|
190
|
-
}
|
|
191
|
-
if (!groupObj.commits.includes(commit)) {
|
|
192
|
-
groupObj.commits.push(commit);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
if (!((_a = contributors[key].files) === null || _a === void 0 ? void 0 : _a.includes(normalizedFile))) {
|
|
197
|
-
contributors[key].files.push(normalizedFile);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
if (!((_a = contributors[key].commits) === null || _a === void 0 ? void 0 : _a.includes(commit))) {
|
|
201
|
-
contributors[key].commits.push(commit);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
return Object.values(contributors);
|
|
206
|
-
}
|
|
207
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sections/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sections/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;AAclC,wCAWC;AArBD,iDAAiD;AACjD,yCAAmD;AACnD,+CAAwF;AAQxF,SAAgB,cAAc,CAAC,OAAwB,EAAE,MAAc;IACrE,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,GAAG,IAAA,kBAAO,EAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,QAAQ,CAAC,KAAK,GAAG,IAAA,uBAAY,EAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,QAAQ,CAAC,YAAY,GAAG,IAAA,8BAAe,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,QAAQ,CAAC,OAAO,GAAG;QACjB,OAAO,EAAE,IAAA,8BAAgB,EAAC,QAAQ,CAAC,OAAQ,EAAE,MAAM,CAAC;QACpD,KAAK,EAAE,IAAA,4BAAc,EAAC,QAAQ,CAAC,KAAM,EAAE,MAAM,CAAC;QAC9C,YAAY,EAAE,IAAA,mCAAqB,EAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KACnE,CAAC;IACF,OAAO,QAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.summarizeCommits = summarizeCommits;
|
|
4
|
+
exports.summarizeNotes = summarizeNotes;
|
|
5
|
+
exports.summarizeContributors = summarizeContributors;
|
|
6
|
+
function summarizeCommits(commits, config) {
|
|
7
|
+
if (!Array.isArray(commits)) {
|
|
8
|
+
throw new Error("Invalid input: commits must be an array");
|
|
9
|
+
}
|
|
10
|
+
const result = [];
|
|
11
|
+
const summary = commits.reduce((acc, commit) => {
|
|
12
|
+
const type = commit.type;
|
|
13
|
+
if (!acc[type]) {
|
|
14
|
+
const matchingType = config.commitTypes.find((ct) => ct.type === type);
|
|
15
|
+
const typeTitle = matchingType ? matchingType.title : "Other Changes";
|
|
16
|
+
const order = matchingType && matchingType.order !== undefined
|
|
17
|
+
? matchingType.order
|
|
18
|
+
: Number.MAX_SAFE_INTEGER;
|
|
19
|
+
acc[type] = {
|
|
20
|
+
type: type,
|
|
21
|
+
title: typeTitle,
|
|
22
|
+
count: commit.items.length,
|
|
23
|
+
order: order,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
result.push(...Object.values(summary));
|
|
29
|
+
result.sort((a, b) => a.order - b.order);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
function summarizeNotes(notes, config) {
|
|
33
|
+
if (!Array.isArray(notes)) {
|
|
34
|
+
throw new Error("Invalid input: notes must be an array");
|
|
35
|
+
}
|
|
36
|
+
const result = [];
|
|
37
|
+
const summary = notes.reduce((acc, note) => {
|
|
38
|
+
const type = note.type;
|
|
39
|
+
if (!acc[type]) {
|
|
40
|
+
const matchingType = config.noteTypes.find((nt) => nt.type === type);
|
|
41
|
+
const typeTitle = matchingType ? matchingType.title : "Other Notes";
|
|
42
|
+
const order = matchingType && matchingType.order !== undefined
|
|
43
|
+
? matchingType.order
|
|
44
|
+
: Number.MAX_SAFE_INTEGER;
|
|
45
|
+
acc[type] = {
|
|
46
|
+
type: type,
|
|
47
|
+
title: typeTitle,
|
|
48
|
+
count: note.items.length,
|
|
49
|
+
order: order,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
result.push(...Object.values(summary));
|
|
55
|
+
result.sort((a, b) => a.order - b.order);
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
function summarizeContributors(contributors, config) {
|
|
59
|
+
if (!Array.isArray(contributors)) {
|
|
60
|
+
throw new Error("Invalid input: contributors must be an array");
|
|
61
|
+
}
|
|
62
|
+
const result = [];
|
|
63
|
+
const summary = contributors.reduce((acc, contributor) => {
|
|
64
|
+
var _a;
|
|
65
|
+
const type = contributor.email;
|
|
66
|
+
if (!acc[type]) {
|
|
67
|
+
acc[type] = {
|
|
68
|
+
email: contributor.email,
|
|
69
|
+
name: contributor.name,
|
|
70
|
+
profileUrl: contributor.profileUrl,
|
|
71
|
+
count: ((_a = contributor.groups) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return acc;
|
|
75
|
+
}, {});
|
|
76
|
+
result.push(...Object.values(summary));
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=summarizing.js.map
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C,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAEvC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,qBAAqB,CACnC,YAA2B,EAC3B,MAAc;IAEd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IAEzB,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE;;QACnB,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACf,GAAG,CAAC,IAAI,CAAC,GAAG;gBACV,KAAK,EAAE,WAAW,CAAC,KAAK;gBACxB,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,UAAU,EAAE,WAAW,CAAC,UAAU;gBAClC,KAAK,EAAE,CAAA,MAAA,WAAW,CAAC,MAAM,0CAAE,MAAM,KAAI,CAAC;aACvC,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// export interface Commit {
|
|
4
|
+
// type: string;
|
|
5
|
+
// items: any[];
|
|
6
|
+
// author: Contributor;
|
|
7
|
+
// mentions?: Contributor[];
|
|
8
|
+
// files: string[];
|
|
9
|
+
// notes?: Note[];
|
|
10
|
+
// }
|
|
11
|
+
// export interface Note {
|
|
12
|
+
// type: string;
|
|
13
|
+
// [key: string]: any;
|
|
14
|
+
// }
|
|
15
|
+
//# sourceMappingURL=Contributor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contributor.js","sourceRoot":"","sources":["../../../../src/sections/types/Contributor.ts"],"names":[],"mappings":";;AAYA,4BAA4B;AAC5B,kBAAkB;AAClB,kBAAkB;AAClB,yBAAyB;AACzB,8BAA8B;AAC9B,qBAAqB;AACrB,oBAAoB;AACpB,IAAI;AAEJ,0BAA0B;AAC1B,kBAAkB;AAClB,wBAAwB;AACxB,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../src/sections/types/Group.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// export interface Config {
|
|
3
|
+
// commitTypes: {
|
|
4
|
+
// type: string;
|
|
5
|
+
// title: string;
|
|
6
|
+
// order?: number;
|
|
7
|
+
// terms: string[];
|
|
8
|
+
// }[];
|
|
9
|
+
// noteTypes: { type: string; title: string; order?: number }[];
|
|
10
|
+
// fileGroups: { [key: string]: string[] };
|
|
11
|
+
// }
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
//# sourceMappingURL=SectionSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionSummary.js","sourceRoot":"","sources":["../../../../src/sections/types/SectionSummary.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,mBAAmB;AACnB,oBAAoB;AACpB,qBAAqB;AACrB,sBAAsB;AACtB,uBAAuB;AACvB,SAAS;AACT,kEAAkE;AAClE,6CAA6C;AAC7C,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sections.js","sourceRoot":"","sources":["../../../../src/sections/types/Sections.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LOCAL_TEMPLATE_PATH = exports.DEFAULT_TEMPLATE_PATH = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
exports.DEFAULT_TEMPLATE_PATH = path_1.default.resolve(__dirname, 'defaults/changelog.ejs');
|
|
9
|
+
exports.LOCAL_TEMPLATE_PATH = path_1.default.resolve(process.cwd(), '.grm/templates/changelog.ejs');
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/templates/constants.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEV,QAAA,qBAAqB,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAA;AACzE,QAAA,mBAAmB,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,8BAA8B,CAAC,CAAA"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# <%= config.appName %> <%= changeInfo.header %> Release Notes - <%= latestTag?.date?.split("T")[0] %>
|
|
2
|
+
|
|
3
|
+
## Summary:
|
|
4
|
+
<% sections.summary.commits.forEach(function(commit) { %>
|
|
5
|
+
- <%= commit.title %>: <%= commit.count %> <%= commit.count === 1 ? 'commit' : 'commits' %>
|
|
6
|
+
<% }) %>
|
|
7
|
+
<% sections.summary.notes.forEach(function(note) { %>
|
|
8
|
+
- <%= note.title %>: <%= note.count %> <%= note.count === 1 ? 'note' : 'notes' %>
|
|
9
|
+
<% }) %>
|
|
10
|
+
and <%= sections.summary.contributors.length %> <%= sections.summary.contributors.length === 1 ? '❤️ contributor' : '❤️ contributors' %>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<% if (sections.notes.length > 0) { %>
|
|
14
|
+
## Notes
|
|
15
|
+
<% sections.notes.forEach((note) => { %>
|
|
16
|
+
### <%= note.title %>
|
|
17
|
+
<% note.items.forEach(item => { %>
|
|
18
|
+
<%
|
|
19
|
+
const commitLinks = `[#${item.commit.raw.shortHash}](#commit-${item.commit.raw.shortHash})`;
|
|
20
|
+
%>
|
|
21
|
+
- <%= item.note.content %> (<%= commitLinks %>)
|
|
22
|
+
<% }) %>
|
|
23
|
+
<% }) %>
|
|
24
|
+
<% } %>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<% if (sections.commits.length > 0) { %>
|
|
28
|
+
## Changes
|
|
29
|
+
<% sections.commits.forEach((section) => { %>
|
|
30
|
+
### <%= section.title %>:
|
|
31
|
+
<%
|
|
32
|
+
// Group commits by scope
|
|
33
|
+
const scopedCommits = {};
|
|
34
|
+
const unscopedCommits = [];
|
|
35
|
+
|
|
36
|
+
section.items.forEach(commit => {
|
|
37
|
+
if (commit.scope) {
|
|
38
|
+
if (!scopedCommits[commit.scope]) {
|
|
39
|
+
scopedCommits[commit.scope] = [];
|
|
40
|
+
}
|
|
41
|
+
scopedCommits[commit.scope].push(commit);
|
|
42
|
+
} else {
|
|
43
|
+
unscopedCommits.push(commit);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
%>
|
|
47
|
+
|
|
48
|
+
<% // Show commits with scope
|
|
49
|
+
Object.keys(scopedCommits).sort().forEach(scope => { %>
|
|
50
|
+
#### <%= scope %>
|
|
51
|
+
<% scopedCommits[scope].forEach(commit => {
|
|
52
|
+
const author = `[@${commit.author.name}](${commit.author.profileUrl})`;
|
|
53
|
+
const mentions = commit.mentions
|
|
54
|
+
? commit.mentions
|
|
55
|
+
.filter(mention => ['co-authored-by', 'helped-by'].includes(mention.type))
|
|
56
|
+
.map(mention => `[@${mention.name}](${mention.profileUrl})`)
|
|
57
|
+
.join(', ')
|
|
58
|
+
: '';
|
|
59
|
+
const authorText = mentions ? `${author} with ${mentions}` : author;
|
|
60
|
+
|
|
61
|
+
const commitLink = `[#${commit.raw.shortHash}](${repository.remote.repoUrl}/commit/${commit.raw.hash})`;
|
|
62
|
+
|
|
63
|
+
const issueLinks = commit.links && commit.links.length > 0
|
|
64
|
+
? ` (${commit.links.length === 1 ? 'Issue' : 'Issues'}: ${commit.links.map(link => `[#${link.id}](${repository.remote.repoUrl}/issues/${link.id})`).join(', ')})`
|
|
65
|
+
: '';
|
|
66
|
+
%>
|
|
67
|
+
- <a id="commit-<%= commit.raw.shortHash %>"></a><%= commitLink %>: <%= commit.summary %> (by <%= authorText %>) <%= issueLinks %>
|
|
68
|
+
<% if (commit.description) { %>
|
|
69
|
+
|
|
70
|
+
<%= commit.description?.split('\n').map(line => `\t${line.trim()}`).join('\n') %>
|
|
71
|
+
<% } %>
|
|
72
|
+
<% }); %>
|
|
73
|
+
<% }); %>
|
|
74
|
+
|
|
75
|
+
<% // Show commits without scope
|
|
76
|
+
unscopedCommits.forEach(commit => {
|
|
77
|
+
const author = `[@${commit.author.name}](${commit.author.profileUrl})`;
|
|
78
|
+
const mentions = commit.mentions
|
|
79
|
+
? commit.mentions
|
|
80
|
+
.filter(mention => ['co-authored-by', 'helped-by'].includes(mention.type))
|
|
81
|
+
.map(mention => `[@${mention.name}](${mention.profileUrl})`)
|
|
82
|
+
.join(', ')
|
|
83
|
+
: '';
|
|
84
|
+
const authorText = mentions ? `${author} with ${mentions}` : author;
|
|
85
|
+
|
|
86
|
+
const commitLink = `[#${commit.raw.shortHash}](${repository.remote.repoUrl}/commit/${commit.raw.hash})`;
|
|
87
|
+
|
|
88
|
+
const issueLinks = commit.links && commit.links.length > 0
|
|
89
|
+
? ` (${commit.links.length === 1 ? 'Issue' : 'Issues'}: ${commit.links.map(link => `[#${link.id}](${repository.remote.repoUrl}/issues/${link.id})`).join(', ')})`
|
|
90
|
+
: '';
|
|
91
|
+
%>
|
|
92
|
+
- <a id="commit-<%= commit.raw.shortHash %>"></a><%= commitLink %>: <%= commit.summary %> (by <%= authorText %>) <%= issueLinks %>
|
|
93
|
+
<% if (commit.description) { %>
|
|
94
|
+
|
|
95
|
+
<%= commit.description %>
|
|
96
|
+
<% } %>
|
|
97
|
+
<% }); %>
|
|
98
|
+
<% }) %>
|
|
99
|
+
<% } %>
|
|
100
|
+
|
|
101
|
+
## Useful Links
|
|
102
|
+
- 📜 [Full Changelog](<%= repository.remote.repoUrl %>/blob/main/CHANGELOG.md)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<% if (sections.contributors.length > 0) { %>
|
|
107
|
+
## Contributors:
|
|
108
|
+
<% sections.contributors.forEach((contributor) => { %>
|
|
109
|
+
- [<%= contributor.name %>](<%= contributor.profileUrl %>) <% if (contributor.groups.length > 0) { %>(<%= contributor.groups.map(group => group.title).join(', ') %>)<% } %>
|
|
110
|
+
<% }) %>
|
|
111
|
+
<% } %>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# <%= config.appName %> <%= changeInfo.header %> Release Notes - <%= latestTag?.date?.split("T")[0] %>
|
|
2
|
+
|
|
3
|
+
## Summary:
|
|
4
|
+
<% sections.summary.commits.forEach(function(commit) { %>
|
|
5
|
+
- <%= commit.title %>: <%= commit.count %> <%= commit.count === 1 ? 'commit' : 'commits' %>
|
|
6
|
+
<% }) %>
|
|
7
|
+
<% sections.summary.notes.forEach(function(note) { %>
|
|
8
|
+
- <%= note.title %>: <%= note.count %> <%= note.count === 1 ? 'note' : 'notes' %>
|
|
9
|
+
<% }) %>
|
|
10
|
+
and <%= sections.summary.contributors.length %> <%= sections.summary.contributors.length === 1 ? '❤️ contributor' : '❤️ contributors' %>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<% if (sections.notes.length > 0) { %>
|
|
14
|
+
## Notes
|
|
15
|
+
<% sections.notes.forEach((note) => { %>
|
|
16
|
+
### <%= note.title %>
|
|
17
|
+
<% note.items.forEach(item => { %>
|
|
18
|
+
<%
|
|
19
|
+
const commitLinks = `[#${item.commit.raw.shortHash}](#commit-${item.commit.raw.shortHash})`;
|
|
20
|
+
%>
|
|
21
|
+
- <%= item.note.content %> (<%= commitLinks %>)
|
|
22
|
+
<% }) %>
|
|
23
|
+
<% }) %>
|
|
24
|
+
<% } %>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<% if (sections.commits.length > 0) { %>
|
|
28
|
+
## Changes
|
|
29
|
+
<% sections.commits.forEach((section) => { %>
|
|
30
|
+
### <%= section.title %>:
|
|
31
|
+
<%
|
|
32
|
+
section.items.forEach(commit => {
|
|
33
|
+
const author = `[@${commit.author.name}](${commit.author.profileUrl})`;
|
|
34
|
+
const mentions = commit.mentions
|
|
35
|
+
? commit.mentions
|
|
36
|
+
.filter(mention => ['co-authored-by', 'helped-by'].includes(mention.type))
|
|
37
|
+
.map(mention => `[@${mention.name}](${mention.profileUrl})`)
|
|
38
|
+
.join(', ')
|
|
39
|
+
: '';
|
|
40
|
+
const authorText = mentions ? `${author} with ${mentions}` : author;
|
|
41
|
+
|
|
42
|
+
const commitLink = `[#${commit.raw.shortHash}](${repository.remote.repoUrl}/commit/${commit.raw.hash})`;
|
|
43
|
+
|
|
44
|
+
const issueLinks = commit.links && commit.links.length > 0
|
|
45
|
+
? ` (${commit.links.length === 1 ? 'Issue' : 'Issues'}: ${commit.links.map(link => `[#${link.id}](${repository.remote.repoUrl}/issues/${link.id})`).join(', ')})`
|
|
46
|
+
: '';
|
|
47
|
+
|
|
48
|
+
const scopeText = commit.scope ? `**${commit.scope}** ` : '';
|
|
49
|
+
%>
|
|
50
|
+
- <a id="commit-<%= commit.raw.shortHash %>"></a><%= scopeText %><%= commitLink %>: <%= commit.summary %> (by <%= authorText %>) <%= issueLinks %>
|
|
51
|
+
<% if (commit.description) { %>
|
|
52
|
+
|
|
53
|
+
<%= commit.description?.split('\n').map(line => `\t${line.trim()}`).join('\n') %>
|
|
54
|
+
<% } %>
|
|
55
|
+
<% }); %>
|
|
56
|
+
<% }) %>
|
|
57
|
+
<% } %>
|
|
58
|
+
|
|
59
|
+
## Useful Links
|
|
60
|
+
- 📜 [Full Changelog](<%= repository.remote.repoUrl %>/blob/main/CHANGELOG.md)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<% if (sections.contributors.length > 0) { %>
|
|
64
|
+
## Contributors:
|
|
65
|
+
<% sections.contributors.forEach((contributor) => { %>
|
|
66
|
+
- [<%= contributor.name %>](<%= contributor.profileUrl %>) <% if (contributor.groups.length > 0) { %>(<%= contributor.groups.map(group => group.title).join(', ') %>)<% } %>
|
|
67
|
+
<% }) %>
|
|
68
|
+
<% } %>
|
|
@@ -38,8 +38,7 @@ exports.renderTemplate = renderTemplate;
|
|
|
38
38
|
const ejs = __importStar(require("ejs"));
|
|
39
39
|
const fs = __importStar(require("fs"));
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
|
-
const
|
|
42
|
-
const LOCAL_TEMPLATE_PATH = path.resolve(process.cwd(), '.grm/templates/changelog.ejs');
|
|
41
|
+
const constants_1 = require("./constants");
|
|
43
42
|
// export async function resolveTemplatePath1(paramPath?: string): Promise<string> {
|
|
44
43
|
// if (paramPath) {
|
|
45
44
|
// const resolvedPath = path.resolve(paramPath);
|
|
@@ -76,19 +75,19 @@ async function resolveTemplatePath(paramPath, environment = null) {
|
|
|
76
75
|
}
|
|
77
76
|
throw new Error(`Template file not found at: ${resolvedPath} or ${defaultParamPath}`);
|
|
78
77
|
}
|
|
79
|
-
const localTemplatePath = LOCAL_TEMPLATE_PATH.replace(/\.ejs$/, `${envSuffix}.ejs`);
|
|
78
|
+
const localTemplatePath = constants_1.LOCAL_TEMPLATE_PATH.replace(/\.ejs$/, `${envSuffix}.ejs`);
|
|
80
79
|
if (fs.existsSync(localTemplatePath)) {
|
|
81
80
|
return localTemplatePath;
|
|
82
81
|
}
|
|
83
|
-
if (fs.existsSync(LOCAL_TEMPLATE_PATH)) {
|
|
84
|
-
return LOCAL_TEMPLATE_PATH;
|
|
82
|
+
if (fs.existsSync(constants_1.LOCAL_TEMPLATE_PATH)) {
|
|
83
|
+
return constants_1.LOCAL_TEMPLATE_PATH;
|
|
85
84
|
}
|
|
86
|
-
const defaultTemplatePath = DEFAULT_TEMPLATE_PATH.replace(/\.ejs$/, `${envSuffix}.ejs`);
|
|
85
|
+
const defaultTemplatePath = constants_1.DEFAULT_TEMPLATE_PATH.replace(/\.ejs$/, `${envSuffix}.ejs`);
|
|
87
86
|
if (fs.existsSync(defaultTemplatePath)) {
|
|
88
87
|
return defaultTemplatePath;
|
|
89
88
|
}
|
|
90
|
-
if (fs.existsSync(DEFAULT_TEMPLATE_PATH)) {
|
|
91
|
-
return DEFAULT_TEMPLATE_PATH;
|
|
89
|
+
if (fs.existsSync(constants_1.DEFAULT_TEMPLATE_PATH)) {
|
|
90
|
+
return constants_1.DEFAULT_TEMPLATE_PATH;
|
|
92
91
|
}
|
|
93
92
|
throw new Error('No valid template file found');
|
|
94
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,kDAmCC;AAGD,wCAOC;AAzED,yCAA2B;AAC3B,uCAAyB;AACzB,2CAA6B;AAC7B,2CAAyE;AAEzE,oFAAoF;AACpF,uBAAuB;AACvB,wDAAwD;AACxD,gBAAgB;AAChB,0EAA0E;AAC1E,4CAA4C;AAC5C,uCAAuC;AACvC,gBAAgB;AAChB,iCAAiC;AACjC,6CAA6C;AAC7C,kFAAkF;AAClF,gBAAg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