@soybeanjs/changelog 0.3.13-beta.0 → 0.3.13
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/index.cjs +6 -16
- package/dist/index.js +6 -16
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2404,11 +2404,10 @@ function generateMarkdown(params) {
|
|
|
2404
2404
|
const { options, showTitle, contributors } = params;
|
|
2405
2405
|
const commits = params.commits.filter((commit) => commit.description.match(VERSION_WITH_RELEASE) === null);
|
|
2406
2406
|
const lines = [];
|
|
2407
|
-
const
|
|
2408
|
-
const url = `https://github.com/${options.github.repo}/compare/${options.from}...${version}`;
|
|
2407
|
+
const url = `https://github.com/${options.github.repo}/compare/${options.from}...${options.newVersion}`;
|
|
2409
2408
|
if (showTitle) {
|
|
2410
|
-
const date =
|
|
2411
|
-
let title = `## [${
|
|
2409
|
+
const date = options.tagDateMap.get(options.newVersion) || (0, import_dayjs2.default)().format("YY-MM-DD");
|
|
2410
|
+
let title = `## [${options.newVersion}](${url})`;
|
|
2412
2411
|
if (date) {
|
|
2413
2412
|
title += ` (${date})`;
|
|
2414
2413
|
}
|
|
@@ -2435,7 +2434,7 @@ function generateMarkdown(params) {
|
|
|
2435
2434
|
const md = (0, import_convert_gitmoji.convert)(lines.join("\n").trim(), true);
|
|
2436
2435
|
return md;
|
|
2437
2436
|
}
|
|
2438
|
-
async function isVersionInMarkdown(
|
|
2437
|
+
async function isVersionInMarkdown(newVersion, mdPath) {
|
|
2439
2438
|
let isIn = false;
|
|
2440
2439
|
let md = "";
|
|
2441
2440
|
try {
|
|
@@ -2445,21 +2444,12 @@ async function isVersionInMarkdown(to, newVersion, mdPath) {
|
|
|
2445
2444
|
if (md) {
|
|
2446
2445
|
const matches = md.match(VERSION_REG_OF_MARKDOWN);
|
|
2447
2446
|
if (matches == null ? void 0 : matches.length) {
|
|
2448
|
-
const
|
|
2449
|
-
const versionInMarkdown = `## [${version}]`;
|
|
2447
|
+
const versionInMarkdown = `## [${newVersion}]`;
|
|
2450
2448
|
isIn = matches.includes(versionInMarkdown);
|
|
2451
2449
|
}
|
|
2452
2450
|
}
|
|
2453
2451
|
return isIn;
|
|
2454
2452
|
}
|
|
2455
|
-
function getVersionInfo(to, newVersion) {
|
|
2456
|
-
const isNewVersion = !VERSION_REG.test(to);
|
|
2457
|
-
const version = isNewVersion ? newVersion : to;
|
|
2458
|
-
return {
|
|
2459
|
-
version,
|
|
2460
|
-
isNewVersion
|
|
2461
|
-
};
|
|
2462
|
-
}
|
|
2463
2453
|
async function writeMarkdown(md, mdPath, regenerate = false) {
|
|
2464
2454
|
let changelogMD = "";
|
|
2465
2455
|
const changelogPrefix = "# Changelog";
|
|
@@ -2535,7 +2525,7 @@ ${markdown}`;
|
|
|
2535
2525
|
}
|
|
2536
2526
|
async function generateChangelog(options) {
|
|
2537
2527
|
const opts = await createOptions(options);
|
|
2538
|
-
const existContent = await isVersionInMarkdown(opts.
|
|
2528
|
+
const existContent = await isVersionInMarkdown(opts.newVersion, opts.output);
|
|
2539
2529
|
if (!opts.regenerate && existContent)
|
|
2540
2530
|
return;
|
|
2541
2531
|
const { markdown } = await getChangelogMarkdown(opts);
|
package/dist/index.js
CHANGED
|
@@ -467,11 +467,10 @@ function generateMarkdown(params) {
|
|
|
467
467
|
const { options, showTitle, contributors } = params;
|
|
468
468
|
const commits = params.commits.filter((commit) => commit.description.match(VERSION_WITH_RELEASE) === null);
|
|
469
469
|
const lines = [];
|
|
470
|
-
const
|
|
471
|
-
const url = `https://github.com/${options.github.repo}/compare/${options.from}...${version}`;
|
|
470
|
+
const url = `https://github.com/${options.github.repo}/compare/${options.from}...${options.newVersion}`;
|
|
472
471
|
if (showTitle) {
|
|
473
|
-
const date =
|
|
474
|
-
let title = `## [${
|
|
472
|
+
const date = options.tagDateMap.get(options.newVersion) || dayjs2().format("YY-MM-DD");
|
|
473
|
+
let title = `## [${options.newVersion}](${url})`;
|
|
475
474
|
if (date) {
|
|
476
475
|
title += ` (${date})`;
|
|
477
476
|
}
|
|
@@ -498,7 +497,7 @@ function generateMarkdown(params) {
|
|
|
498
497
|
const md = convert(lines.join("\n").trim(), true);
|
|
499
498
|
return md;
|
|
500
499
|
}
|
|
501
|
-
async function isVersionInMarkdown(
|
|
500
|
+
async function isVersionInMarkdown(newVersion, mdPath) {
|
|
502
501
|
let isIn = false;
|
|
503
502
|
let md = "";
|
|
504
503
|
try {
|
|
@@ -508,21 +507,12 @@ async function isVersionInMarkdown(to, newVersion, mdPath) {
|
|
|
508
507
|
if (md) {
|
|
509
508
|
const matches = md.match(VERSION_REG_OF_MARKDOWN);
|
|
510
509
|
if (matches == null ? void 0 : matches.length) {
|
|
511
|
-
const
|
|
512
|
-
const versionInMarkdown = `## [${version}]`;
|
|
510
|
+
const versionInMarkdown = `## [${newVersion}]`;
|
|
513
511
|
isIn = matches.includes(versionInMarkdown);
|
|
514
512
|
}
|
|
515
513
|
}
|
|
516
514
|
return isIn;
|
|
517
515
|
}
|
|
518
|
-
function getVersionInfo(to, newVersion) {
|
|
519
|
-
const isNewVersion = !VERSION_REG.test(to);
|
|
520
|
-
const version = isNewVersion ? newVersion : to;
|
|
521
|
-
return {
|
|
522
|
-
version,
|
|
523
|
-
isNewVersion
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
516
|
async function writeMarkdown(md, mdPath, regenerate = false) {
|
|
527
517
|
let changelogMD = "";
|
|
528
518
|
const changelogPrefix = "# Changelog";
|
|
@@ -598,7 +588,7 @@ ${markdown}`;
|
|
|
598
588
|
}
|
|
599
589
|
async function generateChangelog(options) {
|
|
600
590
|
const opts = await createOptions(options);
|
|
601
|
-
const existContent = await isVersionInMarkdown(opts.
|
|
591
|
+
const existContent = await isVersionInMarkdown(opts.newVersion, opts.output);
|
|
602
592
|
if (!opts.regenerate && existContent)
|
|
603
593
|
return;
|
|
604
594
|
const { markdown } = await getChangelogMarkdown(opts);
|