changelog-machine 1.1.0 → 2.0.0
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/LICENSE.md +1 -1
- package/README.md +133 -75
- package/bin/cli.js +5 -1
- package/lib/changelog/contributors.d.ts +2 -0
- package/lib/changelog/contributors.js +31 -0
- package/lib/changelog/links.d.ts +31 -0
- package/lib/changelog/links.js +83 -0
- package/lib/changelog/render.d.ts +2 -0
- package/lib/changelog/render.js +69 -0
- package/lib/changelog/text.d.ts +5 -0
- package/lib/changelog/text.js +23 -0
- package/lib/changelog/update.d.ts +7 -0
- package/lib/changelog/update.js +119 -0
- package/lib/cli/files.d.ts +5 -0
- package/lib/cli/files.js +35 -0
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +44 -39
- package/lib/cli/options.d.ts +13 -0
- package/lib/cli/options.js +48 -0
- package/lib/cli/plans.d.ts +7 -0
- package/lib/cli/plans.js +67 -0
- package/lib/cli/progress.d.ts +2 -0
- package/lib/cli/progress.js +37 -0
- package/lib/commits/parse.d.ts +3 -0
- package/lib/commits/parse.js +87 -0
- package/lib/contributors/authors.d.ts +6 -0
- package/lib/contributors/authors.js +20 -0
- package/lib/contributors/privacy.d.ts +2 -0
- package/lib/contributors/privacy.js +9 -0
- package/lib/contributors/profile.d.ts +5 -0
- package/lib/contributors/profile.js +51 -0
- package/lib/contributors/repository.d.ts +7 -0
- package/lib/contributors/repository.js +36 -0
- package/lib/contributors/resolve.d.ts +10 -0
- package/lib/contributors/resolve.js +86 -0
- package/lib/git/command.d.ts +5 -0
- package/lib/git/command.js +39 -0
- package/lib/git/commits.d.ts +2 -0
- package/lib/git/commits.js +27 -0
- package/lib/git/history.d.ts +3 -0
- package/lib/git/history.js +41 -0
- package/lib/git/refs.d.ts +12 -0
- package/lib/git/refs.js +101 -0
- package/lib/git/remote.d.ts +1 -0
- package/lib/git/remote.js +59 -0
- package/lib/git/tags.d.ts +1 -0
- package/lib/git/tags.js +27 -0
- package/lib/index.d.ts +8 -1
- package/lib/index.js +6 -13
- package/lib/types.d.ts +31 -0
- package/lib/types.js +1 -0
- package/lib/version/json.d.ts +5 -0
- package/lib/version/json.js +35 -0
- package/lib/version/lockfiles.d.ts +3 -0
- package/lib/version/lockfiles.js +44 -0
- package/lib/version/plan.d.ts +11 -0
- package/lib/version/plan.js +51 -0
- package/package.json +34 -42
- package/lib/cli/commands/printHelp.d.ts +0 -2
- package/lib/cli/commands/printHelp.js +0 -15
- package/lib/cli/commands/printMarkdown.d.ts +0 -3
- package/lib/cli/commands/printMarkdown.js +0 -26
- package/lib/cli/commands/printVersion.d.ts +0 -2
- package/lib/cli/commands/printVersion.js +0 -12
- package/lib/cli/config/options.d.ts +0 -3
- package/lib/cli/config/options.js +0 -13
- package/lib/cli/config/readConfigFile.d.ts +0 -3
- package/lib/cli/config/readConfigFile.js +0 -25
- package/lib/core/async.d.ts +0 -9
- package/lib/core/async.js +0 -32
- package/lib/core/default.d.ts +0 -6
- package/lib/core/default.js +0 -9
- package/lib/core/git.d.ts +0 -8
- package/lib/core/git.js +0 -88
- package/lib/core/markdown.d.ts +0 -8
- package/lib/core/markdown.js +0 -85
- package/lib/core/test-helpers.d.ts +0 -6
- package/lib/core/test-helpers.js +0 -14
- package/lib/models/commit.d.ts +0 -6
- package/lib/models/commit.js +0 -2
- package/lib/models/config.d.ts +0 -30
- package/lib/models/config.js +0 -2
- package/lib/models/index.d.ts +0 -3
- package/lib/models/index.js +0 -15
- package/lib/models/tagGroup.d.ts +0 -7
- package/lib/models/tagGroup.js +0 -2
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printHelp = void 0;
|
|
4
|
-
const printHelp = () => {
|
|
5
|
-
return console.log(`
|
|
6
|
-
Usage
|
|
7
|
-
$ npx changelog-machine -c changelog.config.json
|
|
8
|
-
|
|
9
|
-
Options
|
|
10
|
-
--config, -c Path to the configuration file
|
|
11
|
-
--version, -v Show version
|
|
12
|
-
--help, -h Show help
|
|
13
|
-
`);
|
|
14
|
-
};
|
|
15
|
-
exports.printHelp = printHelp;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.printMarkdown = void 0;
|
|
13
|
-
const async_1 = require("../../core/async");
|
|
14
|
-
const markdown_1 = require("../../core/markdown");
|
|
15
|
-
const default_1 = require("../../core/default");
|
|
16
|
-
const printMarkdown = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
var _a;
|
|
18
|
-
const output = yield (0, markdown_1.createMarkdown)(config);
|
|
19
|
-
try {
|
|
20
|
-
yield (0, async_1.outputFileAsync)((_a = config === null || config === void 0 ? void 0 : config.filePath) !== null && _a !== void 0 ? _a : default_1.defaultConfig.outputFilename, output);
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error(error);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
exports.printMarkdown = printMarkdown;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printVersion = void 0;
|
|
4
|
-
const printVersion = () => {
|
|
5
|
-
if (typeof process.env.npm_package_version === 'undefined') {
|
|
6
|
-
console.warn('Warning: No version information found.');
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
console.log(`${process.env.npm_package_name} v${process.env.npm_package_version}`);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
exports.printVersion = printVersion;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flags = void 0;
|
|
4
|
-
const flags = {
|
|
5
|
-
string: 'config',
|
|
6
|
-
boolean: ['version', 'help'],
|
|
7
|
-
alias: { v: 'version', h: 'help' },
|
|
8
|
-
unknown: (a) => {
|
|
9
|
-
console.log(`The argument '${a}' is invalid for this command. Please use --help to read the description of this command.`);
|
|
10
|
-
return false;
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
exports.flags = flags;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.readConfigFile = void 0;
|
|
13
|
-
const async_1 = require("../../core/async");
|
|
14
|
-
const readConfigFile = (configFilePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
var _a;
|
|
16
|
-
try {
|
|
17
|
-
const file = yield (0, async_1.readFileAsync)(configFilePath);
|
|
18
|
-
return JSON.parse(file.toLocaleString());
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
throw new Error((_a = `Unable to read the config file at the location ${configFilePath}\n` +
|
|
22
|
-
error) !== null && _a !== void 0 ? _a : '');
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
exports.readConfigFile = readConfigFile;
|
package/lib/core/async.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { exec } from 'child_process';
|
|
3
|
-
import { readFile, writeFile } from 'fs';
|
|
4
|
-
declare const execAsync: typeof exec.__promisify__;
|
|
5
|
-
declare const writeFileAsync: typeof writeFile.__promisify__;
|
|
6
|
-
declare const readFileAsync: typeof readFile.__promisify__;
|
|
7
|
-
declare const outputFileAsync: (path: string, contents: string) => Promise<void>;
|
|
8
|
-
declare const checkPackageJsonExists: () => boolean;
|
|
9
|
-
export { checkPackageJsonExists, execAsync, outputFileAsync, readFileAsync, writeFileAsync, };
|
package/lib/core/async.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.writeFileAsync = exports.readFileAsync = exports.outputFileAsync = exports.execAsync = exports.checkPackageJsonExists = void 0;
|
|
13
|
-
const child_process_1 = require("child_process");
|
|
14
|
-
const fs_1 = require("fs");
|
|
15
|
-
const path_1 = require("path");
|
|
16
|
-
const util_1 = require("util");
|
|
17
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
18
|
-
exports.execAsync = execAsync;
|
|
19
|
-
const writeFileAsync = (0, util_1.promisify)(fs_1.writeFile);
|
|
20
|
-
exports.writeFileAsync = writeFileAsync;
|
|
21
|
-
const readFileAsync = (0, util_1.promisify)(fs_1.readFile);
|
|
22
|
-
exports.readFileAsync = readFileAsync;
|
|
23
|
-
const mkdirAsync = (0, util_1.promisify)(fs_1.mkdir);
|
|
24
|
-
const outputFileAsync = (path, contents) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield mkdirAsync((0, path_1.dirname)(path), { recursive: true });
|
|
26
|
-
yield writeFileAsync(path, contents);
|
|
27
|
-
});
|
|
28
|
-
exports.outputFileAsync = outputFileAsync;
|
|
29
|
-
const checkPackageJsonExists = () => {
|
|
30
|
-
return (0, fs_1.existsSync)('package.json');
|
|
31
|
-
};
|
|
32
|
-
exports.checkPackageJsonExists = checkPackageJsonExists;
|
package/lib/core/default.d.ts
DELETED
package/lib/core/default.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultConfig = void 0;
|
|
4
|
-
const defaultConfig = {
|
|
5
|
-
outputFilename: 'CHANGELOG.md',
|
|
6
|
-
title: 'Changelog',
|
|
7
|
-
description: 'All notable changes to this project will be documented in this file. Dates are displayed in UTC.',
|
|
8
|
-
};
|
|
9
|
-
exports.defaultConfig = defaultConfig;
|
package/lib/core/git.d.ts
DELETED
package/lib/core/git.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
-
var m = o[Symbol.asyncIterator], i;
|
|
14
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.groupCommitsByTags = void 0;
|
|
20
|
-
const async_1 = require("./async");
|
|
21
|
-
const getReleaseTags = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
const command = `git tag -l --sort=-creatordate --format="%(creatordate:short),%(refname:short)"`;
|
|
23
|
-
const result = yield (0, async_1.execAsync)(command);
|
|
24
|
-
return result.stdout
|
|
25
|
-
.split('\n')
|
|
26
|
-
.filter((tag) => !!tag)
|
|
27
|
-
.map((tag) => {
|
|
28
|
-
const value = tag.split(',');
|
|
29
|
-
return {
|
|
30
|
-
creatorDate: value[0],
|
|
31
|
-
tag: value[1],
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
const getReleaseCommits = (toTag, fromTag, blacklistPattern) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
-
const separator = '_||_';
|
|
37
|
-
const command = `git log ${fromTag}..${toTag} --no-merges --pretty=format:"%ad${separator}%h${separator}%ae${separator}%s"`;
|
|
38
|
-
const logResult = yield (0, async_1.execAsync)(command);
|
|
39
|
-
return logResult.stdout
|
|
40
|
-
.split('\n')
|
|
41
|
-
.filter((message) => !!message)
|
|
42
|
-
.map((message) => {
|
|
43
|
-
const data = message.split(separator);
|
|
44
|
-
return {
|
|
45
|
-
date: new Date(data[0]),
|
|
46
|
-
hash: data[1],
|
|
47
|
-
author: data[2],
|
|
48
|
-
subject: data[3],
|
|
49
|
-
};
|
|
50
|
-
})
|
|
51
|
-
.filter((commit) => {
|
|
52
|
-
if (!blacklistPattern) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return !new RegExp(blacklistPattern, 'gm').test(commit.subject);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
const groupCommitsByTags = (blacklistPattern) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
var e_1, _a;
|
|
60
|
-
const releaseCommits = [];
|
|
61
|
-
const headTag = {
|
|
62
|
-
creatorDate: new Date().toISOString().slice(0, 10),
|
|
63
|
-
tag: 'HEAD',
|
|
64
|
-
};
|
|
65
|
-
const allTags = [headTag, ...(yield getReleaseTags())];
|
|
66
|
-
try {
|
|
67
|
-
for (var _b = __asyncValues(allTags.slice(0, -1).entries()), _c; _c = yield _b.next(), !_c.done;) {
|
|
68
|
-
const [index, value] = _c.value;
|
|
69
|
-
const previousTag = allTags[index + 1].tag;
|
|
70
|
-
const commits = yield getReleaseCommits(value.tag, previousTag, blacklistPattern);
|
|
71
|
-
releaseCommits.push({
|
|
72
|
-
commits,
|
|
73
|
-
previousTag,
|
|
74
|
-
tag: value.tag,
|
|
75
|
-
date: new Date(value.creatorDate),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
80
|
-
finally {
|
|
81
|
-
try {
|
|
82
|
-
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
83
|
-
}
|
|
84
|
-
finally { if (e_1) throw e_1.error; }
|
|
85
|
-
}
|
|
86
|
-
return releaseCommits;
|
|
87
|
-
});
|
|
88
|
-
exports.groupCommitsByTags = groupCommitsByTags;
|
package/lib/core/markdown.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Config } from '../models';
|
|
2
|
-
/**
|
|
3
|
-
* Returns a changelog formatted in Markdown syntax
|
|
4
|
-
* @param config Config
|
|
5
|
-
* @returns Text in Markdown syntax
|
|
6
|
-
*/
|
|
7
|
-
declare const createMarkdown: (config?: Config | undefined) => Promise<string>;
|
|
8
|
-
export { createMarkdown };
|
package/lib/core/markdown.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createMarkdown = void 0;
|
|
13
|
-
const default_1 = require("./default");
|
|
14
|
-
const git_1 = require("./git");
|
|
15
|
-
const createLink = (linkText, url) => {
|
|
16
|
-
return `[${linkText}](${url})`;
|
|
17
|
-
};
|
|
18
|
-
const formatDate = (date) => {
|
|
19
|
-
return date.toLocaleString('en', {
|
|
20
|
-
month: 'long',
|
|
21
|
-
day: 'numeric',
|
|
22
|
-
year: 'numeric',
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
const ticketRecognition = (commitMessage) => {
|
|
26
|
-
var _a, _b;
|
|
27
|
-
return (_b = (_a = commitMessage.match(/\((?<ticket>#\d+)\)/)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.ticket;
|
|
28
|
-
};
|
|
29
|
-
const createReleaseSubtitle = (group, repository) => {
|
|
30
|
-
const latestTag = 'v' + process.env.npm_package_version;
|
|
31
|
-
const unreleasedChanges = latestTag === group.previousTag;
|
|
32
|
-
const latestVersion = unreleasedChanges ? 'Unreleased changes' : latestTag;
|
|
33
|
-
const tagIsHead = group.tag === 'HEAD';
|
|
34
|
-
const subtitleLinkText = tagIsHead ? latestVersion : group.tag;
|
|
35
|
-
const subtitleLinkCurrentTag = tagIsHead
|
|
36
|
-
? unreleasedChanges
|
|
37
|
-
? 'HEAD'
|
|
38
|
-
: latestTag
|
|
39
|
-
: group.tag;
|
|
40
|
-
const subtitleLink = `${repository}/compare/${group.previousTag}...${subtitleLinkCurrentTag}`;
|
|
41
|
-
const subtitle = `${createLink(subtitleLinkText, subtitleLink)}`;
|
|
42
|
-
return `#### ${repository ? subtitle : subtitleLinkText}`;
|
|
43
|
-
};
|
|
44
|
-
const createDateInformation = (group) => {
|
|
45
|
-
return `> ${formatDate(group.date)}`;
|
|
46
|
-
};
|
|
47
|
-
const createCommitList = (group, repository) => {
|
|
48
|
-
return group.commits.reduce((result, commit) => {
|
|
49
|
-
const ticket = ticketRecognition(commit.subject);
|
|
50
|
-
let reference = '';
|
|
51
|
-
if (ticket) {
|
|
52
|
-
commit.subject = commit.subject.replace(`(${ticket})`, ''); // remove ticket number
|
|
53
|
-
const ticketLinkText = `\`${ticket}\``;
|
|
54
|
-
reference = repository
|
|
55
|
-
? createLink(ticketLinkText, `${repository}/pull/${ticket.slice(1)}`)
|
|
56
|
-
: ticketLinkText;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const commitHashText = `\`${commit.hash}\``;
|
|
60
|
-
reference = repository
|
|
61
|
-
? createLink(commitHashText, `${repository}/commit/${commit.hash}`)
|
|
62
|
-
: commitHashText;
|
|
63
|
-
}
|
|
64
|
-
return (result +
|
|
65
|
-
`- ${commit.subject.replace(/[<<]/, '<').trim()} ${reference}\n`);
|
|
66
|
-
}, '');
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Returns a changelog formatted in Markdown syntax
|
|
70
|
-
* @param config Config
|
|
71
|
-
* @returns Text in Markdown syntax
|
|
72
|
-
*/
|
|
73
|
-
const createMarkdown = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
-
var _a, _b;
|
|
75
|
-
const title = `### ${(_a = config === null || config === void 0 ? void 0 : config.title) !== null && _a !== void 0 ? _a : default_1.defaultConfig.title} \n\n ${(_b = config === null || config === void 0 ? void 0 : config.description) !== null && _b !== void 0 ? _b : default_1.defaultConfig.description}\n\n`;
|
|
76
|
-
const tagGroups = yield (0, git_1.groupCommitsByTags)(config === null || config === void 0 ? void 0 : config.blacklistPattern);
|
|
77
|
-
return (title +
|
|
78
|
-
tagGroups.reduce((markdown, group) => {
|
|
79
|
-
const subtitle = createReleaseSubtitle(group, config === null || config === void 0 ? void 0 : config.repositoryUrl);
|
|
80
|
-
const date = createDateInformation(group);
|
|
81
|
-
const commitList = createCommitList(group, config === null || config === void 0 ? void 0 : config.repositoryUrl);
|
|
82
|
-
return `${markdown} \n${subtitle} \n\n${date} \n\n${commitList}`;
|
|
83
|
-
}, ''));
|
|
84
|
-
});
|
|
85
|
-
exports.createMarkdown = createMarkdown;
|
package/lib/core/test-helpers.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mockNewDateTime = exports.createExecAsyncMock = void 0;
|
|
4
|
-
const jest_mock_1 = require("jest-mock");
|
|
5
|
-
const async_1 = require("./async");
|
|
6
|
-
const createExecAsyncMock = () => {
|
|
7
|
-
const mockExecAsync = (0, jest_mock_1.mocked)(async_1.execAsync);
|
|
8
|
-
return mockExecAsync;
|
|
9
|
-
};
|
|
10
|
-
exports.createExecAsyncMock = createExecAsyncMock;
|
|
11
|
-
const mockNewDateTime = () => {
|
|
12
|
-
jest.useFakeTimers().setSystemTime(new Date('2022-02-08').getTime());
|
|
13
|
-
};
|
|
14
|
-
exports.mockNewDateTime = mockNewDateTime;
|
package/lib/models/commit.d.ts
DELETED
package/lib/models/commit.js
DELETED
package/lib/models/config.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface Config {
|
|
2
|
-
/**
|
|
3
|
-
* Name of the file in which the output should be written. Can also include a path name.
|
|
4
|
-
* @default `CHANGELOG.md`
|
|
5
|
-
* @optional
|
|
6
|
-
*/
|
|
7
|
-
filePath?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Title of the page
|
|
10
|
-
* @default `Changelog`
|
|
11
|
-
* @optional
|
|
12
|
-
*/
|
|
13
|
-
title?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Description of the page
|
|
16
|
-
* @default `All notable changes to this project will be documented in this file. Dates are displayed in UTC.`
|
|
17
|
-
* @optional
|
|
18
|
-
*/
|
|
19
|
-
description?: string;
|
|
20
|
-
/**
|
|
21
|
-
* URL of the repository
|
|
22
|
-
* @optional If not set, no links will be provided.
|
|
23
|
-
*/
|
|
24
|
-
repositoryUrl?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Regular expression pattern to exclude commit messages
|
|
27
|
-
* @optional
|
|
28
|
-
*/
|
|
29
|
-
blacklistPattern?: string;
|
|
30
|
-
}
|
package/lib/models/config.js
DELETED
package/lib/models/index.d.ts
DELETED
package/lib/models/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./commit"), exports);
|
|
14
|
-
__exportStar(require("./config"), exports);
|
|
15
|
-
__exportStar(require("./tagGroup"), exports);
|
package/lib/models/tagGroup.d.ts
DELETED
package/lib/models/tagGroup.js
DELETED