keep-a-changelog 2.1.0 → 2.3.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/CHANGELOG.md +28 -2
- package/README.md +23 -6
- package/esm/_dnt.test_shims.d.ts +5 -0
- package/esm/bin.js +11 -2
- package/esm/deps/deno.land/std@0.133.0/fmt/colors.d.ts +270 -0
- package/esm/deps/deno.land/std@0.133.0/testing/_diff.d.ts +23 -0
- package/esm/deps/deno.land/std@0.133.0/testing/asserts.d.ts +167 -0
- package/esm/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
- package/esm/deps/deno.land/{x/semver@v1.4.0 → std@0.173.0/semver}/mod.js +227 -334
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.d.ts +10 -0
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.js +21 -0
- package/esm/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/_util/os.js +3 -2
- package/esm/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/flags/mod.js +146 -36
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_constants.js +1 -0
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/_interface.d.ts +1 -1
- package/esm/deps/deno.land/std@0.189.0/path/_interface.js +3 -0
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/_util.d.ts +3 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_util.js +47 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/common.js +1 -1
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/glob.d.ts +10 -5
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/glob.js +1 -1
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/mod.d.ts +3 -1
- package/esm/deps/deno.land/std@0.189.0/path/mod.js +35 -0
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/posix.d.ts +15 -9
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/posix.js +58 -112
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/separator.js +1 -1
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/win32.d.ts +13 -9
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/win32.js +30 -87
- package/esm/src/Change.js +15 -15
- package/{types → esm}/src/Changelog.d.ts +1 -0
- package/esm/src/Changelog.js +9 -1
- package/{types → esm}/src/Release.d.ts +1 -0
- package/esm/src/Release.js +10 -0
- package/esm/src/deps.d.ts +1 -0
- package/esm/src/deps.js +1 -1
- package/esm/src/parser.js +19 -3
- package/esm/test/Change.test.d.ts +1 -0
- package/esm/test/changelog.custom.type.md +0 -1
- package/esm/test/changelog.expected.linted.md +208 -0
- package/esm/test/changelog.expected.md +3 -1
- package/esm/test/changelog.md +4 -0
- package/esm/test/deps.d.ts +1 -0
- package/esm/test/empty.expected.md +0 -1
- package/esm/test/fixture/CustomRelease.d.ts +8 -0
- package/esm/test/parser.test.d.ts +1 -0
- package/esm/test/test.d.ts +1 -0
- package/package.json +6 -8
- package/script/_dnt.polyfills.d.ts +11 -0
- package/script/_dnt.shims.d.ts +5 -0
- package/script/_dnt.test_shims.d.ts +5 -0
- package/script/bin.d.ts +2 -0
- package/script/bin.js +11 -2
- package/script/deps/deno.land/std@0.133.0/fmt/colors.d.ts +270 -0
- package/script/deps/deno.land/std@0.133.0/testing/_diff.d.ts +23 -0
- package/script/deps/deno.land/std@0.133.0/testing/asserts.d.ts +167 -0
- package/script/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
- package/script/deps/deno.land/{x/semver@v1.4.0 → std@0.173.0/semver}/mod.js +232 -342
- package/script/deps/deno.land/std@0.189.0/_util/asserts.d.ts +10 -0
- package/script/deps/deno.land/std@0.189.0/_util/asserts.js +27 -0
- package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/_util/os.js +4 -3
- package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/flags/mod.js +150 -40
- package/script/deps/deno.land/std@0.189.0/path/_constants.d.ts +39 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_constants.js +1 -0
- package/script/deps/deno.land/std@0.189.0/path/_interface.d.ts +26 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_interface.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +11 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_util.js +51 -1
- package/script/deps/deno.land/std@0.189.0/path/common.d.ts +13 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/common.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/glob.d.ts +83 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/glob.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +11 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/mod.js +23 -2
- package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +86 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/posix.js +56 -110
- package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +2 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/separator.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +91 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/win32.js +30 -87
- package/script/deps/deno.land/std@0.51.0/fs/eol.d.ts +12 -0
- package/script/deps/deno.land/x/ini@v2.1.0/ini.d.ts +53 -0
- package/script/deps/deno.land/x/ini@v2.1.0/mod.d.ts +1 -0
- package/script/mod.d.ts +6 -0
- package/script/src/Change.d.ts +8 -0
- package/script/src/Change.js +15 -15
- package/script/src/Changelog.d.ts +19 -0
- package/script/src/Changelog.js +9 -1
- package/script/src/Release.d.ts +27 -0
- package/script/src/Release.js +10 -0
- package/script/src/deps.d.ts +1 -0
- package/script/src/deps.js +1 -1
- package/script/src/parser.d.ts +11 -0
- package/script/src/parser.js +19 -3
- package/script/test/Change.test.d.ts +1 -0
- package/script/test/changelog.custom.type.md +0 -1
- package/script/test/changelog.expected.linted.md +208 -0
- package/script/test/changelog.expected.md +3 -1
- package/script/test/changelog.md +4 -0
- package/script/test/deps.d.ts +1 -0
- package/script/test/empty.expected.md +0 -1
- package/script/test/fixture/CustomRelease.d.ts +8 -0
- package/script/test/parser.test.d.ts +1 -0
- package/script/test/test.d.ts +1 -0
- package/esm/deps/deno.land/std@0.120.0/_util/assert.js +0 -13
- package/esm/deps/deno.land/std@0.120.0/path/_interface.js +0 -3
- package/esm/deps/deno.land/std@0.120.0/path/mod.js +0 -14
- package/script/deps/deno.land/std@0.120.0/_util/assert.js +0 -18
- package/types/deps/deno.land/std@0.120.0/_util/assert.d.ts +0 -5
- package/types/deps/deno.land/std@0.120.0/_util/os.d.ts +0 -3
- package/types/deps/deno.land/std@0.120.0/flags/mod.d.ts +0 -50
- package/types/deps/deno.land/x/semver@v1.4.0/mod.d.ts +0 -116
- package/types/src/deps.d.ts +0 -1
- /package/{types → esm}/_dnt.polyfills.d.ts +0 -0
- /package/{types → esm}/_dnt.shims.d.ts +0 -0
- /package/{types → esm}/bin.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/_constants.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/common.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/separator.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -0
- /package/{types → esm}/mod.d.ts +0 -0
- /package/{types → esm}/src/Change.d.ts +0 -0
- /package/{types → esm}/src/parser.d.ts +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
1
2
|
// Copyright the Browserify authors. MIT License.
|
|
2
3
|
// Ported from https://github.com/browserify/path-browserify/
|
|
3
4
|
// This module is browser compatible.
|
|
4
5
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
5
6
|
import { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_DOT, CHAR_QUESTION_MARK, } from "./_constants.js";
|
|
6
|
-
import { _format, assertPath, encodeWhitespace, isPathSeparator, isWindowsDeviceRoot, normalizeString, } from "./_util.js";
|
|
7
|
-
import { assert } from "../_util/
|
|
7
|
+
import { _format, assertPath, encodeWhitespace, isPathSeparator, isPosixPathSeparator, isWindowsDeviceRoot, lastPathSegment, normalizeString, stripSuffix, stripTrailingSeparators, } from "./_util.js";
|
|
8
|
+
import { assert } from "../_util/asserts.js";
|
|
8
9
|
export const sep = "\\";
|
|
9
10
|
export const delimiter = ";";
|
|
10
11
|
/**
|
|
@@ -506,8 +507,8 @@ export function toNamespacedPath(path) {
|
|
|
506
507
|
return path;
|
|
507
508
|
}
|
|
508
509
|
/**
|
|
509
|
-
* Return the directory
|
|
510
|
-
* @param path to
|
|
510
|
+
* Return the directory path of a `path`.
|
|
511
|
+
* @param path - path to extract the directory from.
|
|
511
512
|
*/
|
|
512
513
|
export function dirname(path) {
|
|
513
514
|
assertPath(path);
|
|
@@ -597,25 +598,26 @@ export function dirname(path) {
|
|
|
597
598
|
else
|
|
598
599
|
end = rootEnd;
|
|
599
600
|
}
|
|
600
|
-
return path.slice(0, end);
|
|
601
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
601
602
|
}
|
|
602
603
|
/**
|
|
603
|
-
* Return the last portion of a `path`.
|
|
604
|
-
*
|
|
605
|
-
*
|
|
604
|
+
* Return the last portion of a `path`.
|
|
605
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
606
|
+
*
|
|
607
|
+
* @param path - path to extract name from.
|
|
608
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
606
609
|
*/
|
|
607
|
-
export function basename(path,
|
|
608
|
-
if (ext !== undefined && typeof ext !== "string") {
|
|
609
|
-
throw new TypeError('"ext" argument must be a string');
|
|
610
|
-
}
|
|
610
|
+
export function basename(path, suffix = "") {
|
|
611
611
|
assertPath(path);
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
612
|
+
if (path.length === 0)
|
|
613
|
+
return path;
|
|
614
|
+
if (typeof suffix !== "string") {
|
|
615
|
+
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
616
|
+
}
|
|
616
617
|
// Check for a drive letter prefix so as not to mistake the following
|
|
617
618
|
// path separator as an extra separator at the end of the path that can be
|
|
618
619
|
// disregarded
|
|
620
|
+
let start = 0;
|
|
619
621
|
if (path.length >= 2) {
|
|
620
622
|
const drive = path.charCodeAt(0);
|
|
621
623
|
if (isWindowsDeviceRoot(drive)) {
|
|
@@ -623,77 +625,14 @@ export function basename(path, ext = "") {
|
|
|
623
625
|
start = 2;
|
|
624
626
|
}
|
|
625
627
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
let extIdx = ext.length - 1;
|
|
630
|
-
let firstNonSlashEnd = -1;
|
|
631
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
632
|
-
const code = path.charCodeAt(i);
|
|
633
|
-
if (isPathSeparator(code)) {
|
|
634
|
-
// If we reached a path separator that was not part of a set of path
|
|
635
|
-
// separators at the end of the string, stop now
|
|
636
|
-
if (!matchedSlash) {
|
|
637
|
-
start = i + 1;
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
if (firstNonSlashEnd === -1) {
|
|
643
|
-
// We saw the first non-path separator, remember this index in case
|
|
644
|
-
// we need it if the extension ends up not matching
|
|
645
|
-
matchedSlash = false;
|
|
646
|
-
firstNonSlashEnd = i + 1;
|
|
647
|
-
}
|
|
648
|
-
if (extIdx >= 0) {
|
|
649
|
-
// Try to match the explicit extension
|
|
650
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
651
|
-
if (--extIdx === -1) {
|
|
652
|
-
// We matched the extension, so mark this as the end of our path
|
|
653
|
-
// component
|
|
654
|
-
end = i;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
// Extension does not match, so our result is the entire path
|
|
659
|
-
// component
|
|
660
|
-
extIdx = -1;
|
|
661
|
-
end = firstNonSlashEnd;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
if (start === end)
|
|
667
|
-
end = firstNonSlashEnd;
|
|
668
|
-
else if (end === -1)
|
|
669
|
-
end = path.length;
|
|
670
|
-
return path.slice(start, end);
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
674
|
-
if (isPathSeparator(path.charCodeAt(i))) {
|
|
675
|
-
// If we reached a path separator that was not part of a set of path
|
|
676
|
-
// separators at the end of the string, stop now
|
|
677
|
-
if (!matchedSlash) {
|
|
678
|
-
start = i + 1;
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
else if (end === -1) {
|
|
683
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
684
|
-
// path component
|
|
685
|
-
matchedSlash = false;
|
|
686
|
-
end = i + 1;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
if (end === -1)
|
|
690
|
-
return "";
|
|
691
|
-
return path.slice(start, end);
|
|
692
|
-
}
|
|
628
|
+
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
629
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
630
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
693
631
|
}
|
|
694
632
|
/**
|
|
695
|
-
* Return the extension of the `path
|
|
633
|
+
* Return the extension of the `path` with leading period.
|
|
696
634
|
* @param path with extension
|
|
635
|
+
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
697
636
|
*/
|
|
698
637
|
export function extname(path) {
|
|
699
638
|
assertPath(path);
|
|
@@ -827,13 +766,14 @@ export function parse(path) {
|
|
|
827
766
|
// `path` contains just a drive root, exit early to avoid
|
|
828
767
|
// unnecessary work
|
|
829
768
|
ret.root = ret.dir = path;
|
|
769
|
+
ret.base = "\\";
|
|
830
770
|
return ret;
|
|
831
771
|
}
|
|
832
772
|
rootEnd = 3;
|
|
833
773
|
}
|
|
834
774
|
}
|
|
835
775
|
else {
|
|
836
|
-
// `path` contains just a drive root, exit early to avoid
|
|
776
|
+
// `path` contains just a relative drive root, exit early to avoid
|
|
837
777
|
// unnecessary work
|
|
838
778
|
ret.root = ret.dir = path;
|
|
839
779
|
return ret;
|
|
@@ -845,6 +785,7 @@ export function parse(path) {
|
|
|
845
785
|
// `path` contains just a path separator, exit early to avoid
|
|
846
786
|
// unnecessary work
|
|
847
787
|
ret.root = ret.dir = path;
|
|
788
|
+
ret.base = "\\";
|
|
848
789
|
return ret;
|
|
849
790
|
}
|
|
850
791
|
if (rootEnd > 0)
|
|
@@ -903,6 +844,8 @@ export function parse(path) {
|
|
|
903
844
|
ret.base = path.slice(startPart, end);
|
|
904
845
|
ret.ext = path.slice(startDot, end);
|
|
905
846
|
}
|
|
847
|
+
// Fallback to '\' in case there is no basename
|
|
848
|
+
ret.base = ret.base || "\\";
|
|
906
849
|
// If the directory is the root, use the entire root as the `dir` including
|
|
907
850
|
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
|
908
851
|
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
|
@@ -917,7 +860,7 @@ export function parse(path) {
|
|
|
917
860
|
* Converts a file URL to a path string.
|
|
918
861
|
*
|
|
919
862
|
* ```ts
|
|
920
|
-
* import { fromFileUrl } from "
|
|
863
|
+
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
921
864
|
* fromFileUrl("file:///home/foo"); // "\\home\\foo"
|
|
922
865
|
* fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
|
|
923
866
|
* fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
|
|
@@ -942,7 +885,7 @@ export function fromFileUrl(url) {
|
|
|
942
885
|
* Converts a path string to a file URL.
|
|
943
886
|
*
|
|
944
887
|
* ```ts
|
|
945
|
-
* import { toFileUrl } from "
|
|
888
|
+
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
946
889
|
* toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
|
|
947
890
|
* toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
|
|
948
891
|
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
|
package/esm/src/Change.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
export default class Change {
|
|
2
|
+
static extractIssues(text, issues) {
|
|
3
|
+
return text
|
|
4
|
+
.replace(/(^|[^\\])\[#(\d+)\](?=[^\(]|$)/g, (_, start, index) => {
|
|
5
|
+
if (!issues.includes(index)) {
|
|
6
|
+
issues.push(index);
|
|
7
|
+
}
|
|
8
|
+
return `${start}[#${index}]`;
|
|
9
|
+
})
|
|
10
|
+
.replace(/(^|[\s,])#(\d+)(?=[\s,\.]|$)/g, (_, start, index) => {
|
|
11
|
+
if (!issues.includes(index)) {
|
|
12
|
+
issues.push(index);
|
|
13
|
+
}
|
|
14
|
+
return `${start}[#${index}]`;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
2
17
|
constructor(title, description = "") {
|
|
3
18
|
Object.defineProperty(this, "title", {
|
|
4
19
|
enumerable: true,
|
|
@@ -21,21 +36,6 @@ export default class Change {
|
|
|
21
36
|
this.title = Change.extractIssues(title, this.issues);
|
|
22
37
|
this.description = Change.extractIssues(description, this.issues);
|
|
23
38
|
}
|
|
24
|
-
static extractIssues(text, issues) {
|
|
25
|
-
return text
|
|
26
|
-
.replace(/(^|[^\\])\[#(\d+)\](?=[^\(]|$)/g, (_, start, index) => {
|
|
27
|
-
if (!issues.includes(index)) {
|
|
28
|
-
issues.push(index);
|
|
29
|
-
}
|
|
30
|
-
return `${start}[#${index}]`;
|
|
31
|
-
})
|
|
32
|
-
.replace(/(^|[\s,])#(\d+)(?=[\s,\.]|$)/g, (_, start, index) => {
|
|
33
|
-
if (!issues.includes(index)) {
|
|
34
|
-
issues.push(index);
|
|
35
|
-
}
|
|
36
|
-
return `${start}[#${index}]`;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
39
|
toString() {
|
|
40
40
|
let t = this.title.split("\n").map((line) => ` ${line}`.trimEnd());
|
|
41
41
|
t[0] = "-" + t[0].substr(1);
|
|
@@ -9,6 +9,7 @@ export default class Changelog {
|
|
|
9
9
|
url?: string;
|
|
10
10
|
releases: Release[];
|
|
11
11
|
tagNameBuilder?: (release: Release) => string;
|
|
12
|
+
format: "compact" | "markdownlint";
|
|
12
13
|
constructor(title: string, description?: string);
|
|
13
14
|
addRelease(release: Release): this;
|
|
14
15
|
findRelease(version?: Semver | string): Release | undefined;
|
package/esm/src/Changelog.js
CHANGED
|
@@ -49,6 +49,12 @@ export default class Changelog {
|
|
|
49
49
|
writable: true,
|
|
50
50
|
value: void 0
|
|
51
51
|
});
|
|
52
|
+
Object.defineProperty(this, "format", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: "compact"
|
|
57
|
+
});
|
|
52
58
|
this.title = title;
|
|
53
59
|
this.description = description;
|
|
54
60
|
}
|
|
@@ -80,6 +86,9 @@ export default class Changelog {
|
|
|
80
86
|
t.push("");
|
|
81
87
|
}
|
|
82
88
|
t.push(`# ${this.title}`);
|
|
89
|
+
if (this.format === "markdownlint") {
|
|
90
|
+
t.push("");
|
|
91
|
+
}
|
|
83
92
|
const links = [];
|
|
84
93
|
const compareLinks = [];
|
|
85
94
|
const description = this.description.trim() ||
|
|
@@ -88,7 +97,6 @@ export default class Changelog {
|
|
|
88
97
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
89
98
|
and this project adheres to [Semantic Versioning](http://semver.org/).`;
|
|
90
99
|
if (description) {
|
|
91
|
-
t.push("");
|
|
92
100
|
t.push(description);
|
|
93
101
|
}
|
|
94
102
|
this.releases.forEach((release) => {
|
|
@@ -13,6 +13,7 @@ export default class Release {
|
|
|
13
13
|
isEmpty(): boolean;
|
|
14
14
|
setVersion(version?: string | Semver): void;
|
|
15
15
|
setDate(date?: Date | string): void;
|
|
16
|
+
setYanked(yanked?: boolean): this;
|
|
16
17
|
addChange(type: string, change: Change | string): this;
|
|
17
18
|
added(change: Change | string): this;
|
|
18
19
|
changed(change: Change | string): this;
|
package/esm/src/Release.js
CHANGED
|
@@ -90,6 +90,10 @@ export default class Release {
|
|
|
90
90
|
}
|
|
91
91
|
this.date = date;
|
|
92
92
|
}
|
|
93
|
+
setYanked(yanked = true) {
|
|
94
|
+
this.yanked = yanked;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
93
97
|
addChange(type, change) {
|
|
94
98
|
if (!(change instanceof Change)) {
|
|
95
99
|
change = new Change(change);
|
|
@@ -138,6 +142,9 @@ export default class Release {
|
|
|
138
142
|
t.push(`## Unreleased${yanked}`);
|
|
139
143
|
}
|
|
140
144
|
}
|
|
145
|
+
if (changelog?.format === "markdownlint") {
|
|
146
|
+
t.push("");
|
|
147
|
+
}
|
|
141
148
|
if (this.description.trim()) {
|
|
142
149
|
t.push(this.description.trim());
|
|
143
150
|
t.push("");
|
|
@@ -145,6 +152,9 @@ export default class Release {
|
|
|
145
152
|
this.changes.forEach((changes, type) => {
|
|
146
153
|
if (changes.length) {
|
|
147
154
|
t.push(`### ${type[0].toUpperCase()}${type.substring(1)}`);
|
|
155
|
+
if (changelog?.format === "markdownlint") {
|
|
156
|
+
t.push("");
|
|
157
|
+
}
|
|
148
158
|
t = t.concat(changes.map((change) => change.toString()));
|
|
149
159
|
t.push("");
|
|
150
160
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Semver, eq, } from "../deps/deno.land/std@0.173.0/semver/mod.js";
|
package/esm/src/deps.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Semver, eq, } from "../deps/deno.land/
|
|
1
|
+
export { default as Semver, eq, } from "../deps/deno.land/std@0.173.0/semver/mod.js";
|
package/esm/src/parser.js
CHANGED
|
@@ -19,7 +19,7 @@ function processTokens(tokens, opts) {
|
|
|
19
19
|
const changelog = new Changelog("");
|
|
20
20
|
changelog.flag = getContent(tokens, "flag");
|
|
21
21
|
changelog.title = getContent(tokens, "h1", true);
|
|
22
|
-
changelog.description =
|
|
22
|
+
changelog.description = getTextContent(tokens);
|
|
23
23
|
//Releases
|
|
24
24
|
let release;
|
|
25
25
|
while ((release = getContent(tokens, "h2").toLowerCase())) {
|
|
@@ -40,7 +40,7 @@ function processTokens(tokens, opts) {
|
|
|
40
40
|
throw new Error(`Syntax error in the release title`);
|
|
41
41
|
}
|
|
42
42
|
changelog.addRelease(release);
|
|
43
|
-
release.description =
|
|
43
|
+
release.description = getTextContent(tokens);
|
|
44
44
|
let type;
|
|
45
45
|
while ((type = getContent(tokens, "h3").toLowerCase())) {
|
|
46
46
|
let change;
|
|
@@ -71,7 +71,8 @@ function processTokens(tokens, opts) {
|
|
|
71
71
|
}
|
|
72
72
|
/** Returns the content of a token */
|
|
73
73
|
function getContent(tokens, type, required = false) {
|
|
74
|
-
|
|
74
|
+
const types = Array.isArray(type) ? type : [type];
|
|
75
|
+
if (!tokens[0] || types.indexOf(tokens[0][1]) === -1) {
|
|
75
76
|
if (required) {
|
|
76
77
|
throw new Error(`Required token missing in: "${tokens[0][0]}"`);
|
|
77
78
|
}
|
|
@@ -79,6 +80,21 @@ function getContent(tokens, type, required = false) {
|
|
|
79
80
|
}
|
|
80
81
|
return tokens.shift()[2].join("\n");
|
|
81
82
|
}
|
|
83
|
+
/** Return the next text content */
|
|
84
|
+
function getTextContent(tokens) {
|
|
85
|
+
const lines = [];
|
|
86
|
+
const types = ["p", "li"];
|
|
87
|
+
while (tokens[0] && types.indexOf(tokens[0][1]) !== -1) {
|
|
88
|
+
const token = tokens.shift();
|
|
89
|
+
if (token[1] === "li") {
|
|
90
|
+
lines.push("- " + token[2].join("\n"));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
lines.push(token[2].join("\n"));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return lines.join("\n");
|
|
97
|
+
}
|
|
82
98
|
/** Tokenize a markdown string */
|
|
83
99
|
function tokenize(markdown) {
|
|
84
100
|
const tokens = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Changelog - demo
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to
|
|
7
|
+
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
8
|
+
|
|
9
|
+
## [Unreleased] [YANKED]
|
|
10
|
+
|
|
11
|
+
This is a brand new releases with:
|
|
12
|
+
- Configuration is now done within the Web client, for authorized users.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Test
|
|
17
|
+
|
|
18
|
+
## [2.0.0] - Unreleased [YANKED]
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- None
|
|
23
|
+
- Test with issue link [#1]
|
|
24
|
+
- Test with issue link [#4] in the middle of the text
|
|
25
|
+
- [#3] Test with issue link in the beginning of the text
|
|
26
|
+
- Test with issue dot [#2], [#10].
|
|
27
|
+
- Test with no issue link #123b
|
|
28
|
+
- Test with `package#2.0`
|
|
29
|
+
|
|
30
|
+
## [1.0.0] - 2017-06-20
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- New visual identity by @tylerfortune8.
|
|
35
|
+
- Version navigation.
|
|
36
|
+
- Links to latest released version in previous versions.
|
|
37
|
+
- "Why keep a changelog?" section.
|
|
38
|
+
- "Who needs a changelog?" section.
|
|
39
|
+
- "How do I make a changelog?" section.
|
|
40
|
+
- "Frequently Asked Questions" section.
|
|
41
|
+
- New "Guiding Principles" sub-section to "How do I make a changelog?".
|
|
42
|
+
- Simplified and Traditional Chinese translations from @tianshuo.
|
|
43
|
+
- German translation from @mpbzh & @Art4.
|
|
44
|
+
- Italian translation from @azkidenz.
|
|
45
|
+
- Swedish translation from @magol.
|
|
46
|
+
- Turkish translation from @karalamalar.
|
|
47
|
+
- French translation from @zapashcanon.
|
|
48
|
+
- Brazilian Portugese translation from @aisamu.
|
|
49
|
+
- Polish translation from @amielucha.
|
|
50
|
+
- Russian translation from @aishek.
|
|
51
|
+
- Czech translation from @h4vry.
|
|
52
|
+
- Slovak translation from @jkostolansky.
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Start using "changelog" over "change log" since it's the common usage.
|
|
57
|
+
- Start versioning based on the current English version at 0.3.0 to help
|
|
58
|
+
translation authors keep things up-to-date.
|
|
59
|
+
- Rewrite "What makes unicorns cry?" section.
|
|
60
|
+
- Rewrite "Ignoring Deprecations" sub-section to clarify the ideal scenario.
|
|
61
|
+
- Improve "Commit log diffs" sub-section to further argument against them.
|
|
62
|
+
- Merge "Why can’t people just use a git log diff?" with "Commit log diffs"
|
|
63
|
+
- Fix typos in Simplified Chinese and Traditional Chinese translations.
|
|
64
|
+
- Fix typos in Brazilian Portugese translation.
|
|
65
|
+
- Fix typos in Turkish translation.
|
|
66
|
+
- Fix typos in Czech translation.
|
|
67
|
+
- Fix typos in Swedish translation.
|
|
68
|
+
- Improve phrasing in French translation.
|
|
69
|
+
- Fix phrasing and spelling in German translation.
|
|
70
|
+
|
|
71
|
+
### Removed
|
|
72
|
+
|
|
73
|
+
- Section about "changelog" vs "CHANGELOG".
|
|
74
|
+
|
|
75
|
+
## [0.3.0] - 2015-12-03
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- RU translation from @aishek.
|
|
80
|
+
- pt-BR translation from @tallesl.
|
|
81
|
+
- es-ES translation from @ZeliosAriex.
|
|
82
|
+
|
|
83
|
+
## [0.2.0] - 2015-10-06
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
|
|
87
|
+
- Remove exclusionary mentions of "open source" since this project can benefit
|
|
88
|
+
both "open" and "closed" source projects equally.
|
|
89
|
+
|
|
90
|
+
## [0.1.0] - 2015-10-06
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
- Answer "Should you ever rewrite a change log?".
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
|
|
98
|
+
- Improve argument against commit logs.
|
|
99
|
+
- Start following [SemVer](http://semver.org) properly.
|
|
100
|
+
|
|
101
|
+
## [0.0.8] - 2015-02-17
|
|
102
|
+
|
|
103
|
+
### Changed
|
|
104
|
+
|
|
105
|
+
- Update year to match in every README example.
|
|
106
|
+
- Reluctantly stop making fun of Brits only, since most of the world writes
|
|
107
|
+
dates in a strange way.
|
|
108
|
+
|
|
109
|
+
### Fixed
|
|
110
|
+
|
|
111
|
+
- Fix typos in recent README changes.
|
|
112
|
+
- Update outdated unreleased diff link.
|
|
113
|
+
|
|
114
|
+
## [0.0.7] - 2015-02-16
|
|
115
|
+
|
|
116
|
+
### Added
|
|
117
|
+
|
|
118
|
+
- Link, and make it obvious that date format is ISO 8601.
|
|
119
|
+
|
|
120
|
+
### Changed
|
|
121
|
+
|
|
122
|
+
- Clarified the section on "Is there a standard change log format?".
|
|
123
|
+
|
|
124
|
+
### Fixed
|
|
125
|
+
|
|
126
|
+
- Fix Markdown links to tag comparison URL with footnote-style links.
|
|
127
|
+
|
|
128
|
+
## [0.0.6] - 2014-12-12 [YANKED]
|
|
129
|
+
|
|
130
|
+
### Added
|
|
131
|
+
|
|
132
|
+
- README section on "yanked" releases.
|
|
133
|
+
|
|
134
|
+
## [0.0.5] - 2014-08-09
|
|
135
|
+
|
|
136
|
+
### Added
|
|
137
|
+
|
|
138
|
+
- Markdown links to version tags on release headings.
|
|
139
|
+
- Unreleased section to gather unreleased changes and encourage note keeping
|
|
140
|
+
prior to releases.
|
|
141
|
+
|
|
142
|
+
## [0.0.4] - 2014-08-09
|
|
143
|
+
|
|
144
|
+
### Added
|
|
145
|
+
|
|
146
|
+
- Better explanation of the difference between the file ("CHANGELOG") and its
|
|
147
|
+
function "the change log".
|
|
148
|
+
|
|
149
|
+
### Changed
|
|
150
|
+
|
|
151
|
+
- Refer to a "change log" instead of a "CHANGELOG" throughout the site to
|
|
152
|
+
differentiate between the file and the purpose of the file — the logging of
|
|
153
|
+
changes.
|
|
154
|
+
|
|
155
|
+
### Removed
|
|
156
|
+
|
|
157
|
+
- Remove empty sections from CHANGELOG, they occupy too much space and create
|
|
158
|
+
too much noise in the file. People will have to assume that the missing
|
|
159
|
+
sections were intentionally left out because they contained no notable
|
|
160
|
+
changes.
|
|
161
|
+
|
|
162
|
+
## [0.0.3] - 2014-08-09
|
|
163
|
+
|
|
164
|
+
### Added
|
|
165
|
+
|
|
166
|
+
- "Why should I care?" section mentioning The Changelog podcast.
|
|
167
|
+
|
|
168
|
+
## [0.0.2] - 2014-07-10
|
|
169
|
+
|
|
170
|
+
### Added
|
|
171
|
+
|
|
172
|
+
- Explanation of the recommended reverse chronological release ordering.
|
|
173
|
+
|
|
174
|
+
## [0.0.1] - 2014-05-31
|
|
175
|
+
|
|
176
|
+
### Added
|
|
177
|
+
|
|
178
|
+
- This CHANGELOG file to hopefully serve as an evolving example of a
|
|
179
|
+
standardized open source project CHANGELOG.
|
|
180
|
+
- CNAME file to enable GitHub Pages custom domain
|
|
181
|
+
- README now contains answers to common questions about CHANGELOGs
|
|
182
|
+
- Good examples and basic guidelines, including proper date formatting.
|
|
183
|
+
- Counter-examples: "What makes unicorns cry?"
|
|
184
|
+
|
|
185
|
+
[#1]: https://github.com/olivierlacan/keep-a-changelog/issues/1
|
|
186
|
+
[#2]: https://github.com/olivierlacan/keep-a-changelog/issues/2
|
|
187
|
+
[#3]: https://github.com/olivierlacan/keep-a-changelog/issues/3
|
|
188
|
+
[#4]: https://github.com/olivierlacan/keep-a-changelog/issues/4
|
|
189
|
+
[#10]: https://github.com/olivierlacan/keep-a-changelog/issues/10
|
|
190
|
+
|
|
191
|
+
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
|
|
192
|
+
[2.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
|
|
193
|
+
[1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
|
|
194
|
+
[0.3.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
|
|
195
|
+
[0.2.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.1.0...v0.2.0
|
|
196
|
+
[0.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.8...v0.1.0
|
|
197
|
+
[0.0.8]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.7...v0.0.8
|
|
198
|
+
[0.0.7]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.6...v0.0.7
|
|
199
|
+
[0.0.6]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.5...v0.0.6
|
|
200
|
+
[0.0.5]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.4...v0.0.5
|
|
201
|
+
[0.0.4]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.3...v0.0.4
|
|
202
|
+
[0.0.3]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.2...v0.0.3
|
|
203
|
+
[0.0.2]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.1...v0.0.2
|
|
204
|
+
[0.0.1]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.0.1
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
This is a footer
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# Changelog - demo
|
|
2
|
-
|
|
3
2
|
All notable changes to this project will be documented in this file.
|
|
4
3
|
|
|
5
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
@@ -7,6 +6,9 @@ and this project adheres to
|
|
|
7
6
|
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
8
7
|
|
|
9
8
|
## [Unreleased] [YANKED]
|
|
9
|
+
This is a brand new releases with:
|
|
10
|
+
- Configuration is now done within the Web client, for authorized users.
|
|
11
|
+
|
|
10
12
|
### Added
|
|
11
13
|
- Test
|
|
12
14
|
|
package/esm/test/changelog.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../deps/deno.land/std@0.133.0/testing/asserts.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Change, Release } from "../../mod.js";
|
|
2
|
+
import { Semver } from "../../src/deps.js";
|
|
3
|
+
declare class CustomRelease extends Release {
|
|
4
|
+
constructor(version?: Semver | string, date?: Date | string, description?: string);
|
|
5
|
+
maintenance(change: string | Change): this;
|
|
6
|
+
}
|
|
7
|
+
export default function (version?: Semver | string, date?: Date | string, description?: string): CustomRelease;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|