lerna-clean-changelogs 3.0.3 → 3.0.7
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 +0 -23
- package/LICENSE +1 -1
- package/dist/lerna-clean-changelogs.esm.js +68 -55
- package/dist/lerna-clean-changelogs.umd.js +2 -2
- package/package.json +21 -25
package/CHANGELOG.md
CHANGED
|
@@ -3,29 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 3.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- introduce extras setting ([5d1520b](https://github.com/codsen/codsen/commit/5d1520ba5a6885b015cb6b41aec3fe39806e9266))
|
|
15
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
16
|
-
|
|
17
|
-
### BREAKING CHANGES
|
|
18
|
-
|
|
19
|
-
- previous behaviour will now require a true "extras" param to be passed, default
|
|
20
|
-
behaviour is more conservative now
|
|
21
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
22
|
-
|
|
23
|
-
## 3.0.1 (2021-09-13)
|
|
24
|
-
|
|
25
|
-
### Bug Fixes
|
|
26
|
-
|
|
27
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
28
|
-
|
|
29
6
|
## 3.0.0 (2021-09-09)
|
|
30
7
|
|
|
31
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -1,75 +1,88 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name lerna-clean-changelogs
|
|
3
3
|
* @fileoverview Removes frivolous entries from commitizen generated changelogs
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/lerna-clean-changelogs/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var version$1 = "3.0.
|
|
10
|
+
var version$1 = "3.0.7";
|
|
11
11
|
|
|
12
12
|
const version = version$1;
|
|
13
13
|
function isStr(something) {
|
|
14
|
-
|
|
14
|
+
return typeof something === "string";
|
|
15
15
|
}
|
|
16
16
|
function cleanChangelogs(changelogContents, extras = false) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} else if (!isStr(changelogContents)) {
|
|
20
|
-
throw new Error(`lerna-clean-changelogs: [THROW_ID_02] The first input argument must be a string! It was given as ${Array.isArray(changelogContents) ? "array" : typeof changelogContents}, equal to:\n${JSON.stringify(changelogContents, null, 4)}`);
|
|
21
|
-
}
|
|
22
|
-
let final;
|
|
23
|
-
let lastLineWasEmpty = false;
|
|
24
|
-
if (typeof changelogContents === "string" && changelogContents.length && (!changelogContents.includes("\n") || !changelogContents.includes("\r"))) {
|
|
25
|
-
/* istanbul ignore next */
|
|
26
|
-
const changelogEndedWithLinebreak = isStr(changelogContents) && changelogContents.length && (changelogContents[changelogContents.length - 1] === "\n" || changelogContents[changelogContents.length - 1] === "\r");
|
|
27
|
-
changelogContents = changelogContents.trim().replace(/(https:\/\/git\.sr\.ht\/~[^/]+\/[^/]+\/)commits\//g, "$1commit/");
|
|
28
|
-
const linesArr = changelogContents.split(/\r?\n/);
|
|
29
|
-
if (extras) {
|
|
30
|
-
linesArr.forEach((line, i) => {
|
|
31
|
-
if (line.startsWith("#")) {
|
|
32
|
-
linesArr[i] = line.replace(/(#+) \[?(\d+\.\d+\.\d+)\s?\]\([^)]*\)/g, "$1 $2");
|
|
33
|
-
}
|
|
34
|
-
if (i && linesArr[i].startsWith("# ")) {
|
|
35
|
-
linesArr[i] = `#${linesArr[i]}`;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
17
|
+
if (changelogContents === undefined) {
|
|
18
|
+
throw new Error(`lerna-clean-changelogs: [THROW_ID_01] The first input argument is missing!`);
|
|
38
19
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
20
|
+
else if (!isStr(changelogContents)) {
|
|
21
|
+
throw new Error(`lerna-clean-changelogs: [THROW_ID_02] The first input argument must be a string! It was given as ${Array.isArray(changelogContents) ? "array" : typeof changelogContents}, equal to:\n${JSON.stringify(changelogContents, null, 4)}`);
|
|
22
|
+
}
|
|
23
|
+
let final;
|
|
24
|
+
let lastLineWasEmpty = false;
|
|
25
|
+
if (typeof changelogContents === "string" &&
|
|
26
|
+
changelogContents.length &&
|
|
27
|
+
(!changelogContents.includes("\n") || !changelogContents.includes("\r"))) {
|
|
28
|
+
/* istanbul ignore next */
|
|
29
|
+
const changelogEndedWithLinebreak = isStr(changelogContents) &&
|
|
30
|
+
changelogContents.length &&
|
|
31
|
+
(changelogContents[changelogContents.length - 1] === "\n" ||
|
|
32
|
+
changelogContents[changelogContents.length - 1] === "\r");
|
|
33
|
+
changelogContents = changelogContents
|
|
34
|
+
.trim()
|
|
35
|
+
.replace(/(https:\/\/git\.sr\.ht\/~[^/]+\/[^/]+\/)commits\//g, "$1commit/");
|
|
36
|
+
const linesArr = changelogContents.split(/\r?\n/);
|
|
37
|
+
if (extras) {
|
|
38
|
+
linesArr.forEach((line, i) => {
|
|
39
|
+
if (line.startsWith("#")) {
|
|
40
|
+
linesArr[i] = line.replace(/(#+) \[?(\d+\.\d+\.\d+)\s?\]\([^)]*\)/g, "$1 $2");
|
|
41
|
+
}
|
|
42
|
+
if (i && linesArr[i].startsWith("# ")) {
|
|
43
|
+
linesArr[i] = `#${linesArr[i]}`;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
50
46
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const newLinesArr = [];
|
|
48
|
+
for (let i = linesArr.length; i--;) {
|
|
49
|
+
if (linesArr[i].startsWith("**Note:** Version bump only") ||
|
|
50
|
+
(extras && linesArr[i].toLowerCase().includes("wip"))) {
|
|
51
|
+
while (isStr(linesArr[i - 1]) && !linesArr[i - 1].trim() && i) {
|
|
52
|
+
i -= 1;
|
|
53
|
+
}
|
|
54
|
+
if (i &&
|
|
55
|
+
isStr(linesArr[i - 1]) &&
|
|
56
|
+
linesArr[i - 1].trim().startsWith("#")) {
|
|
57
|
+
i -= 1;
|
|
58
|
+
}
|
|
59
|
+
while (isStr(linesArr[i - 1]) && !linesArr[i - 1].trim() && i) {
|
|
60
|
+
i -= 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (!linesArr[i].trim()) {
|
|
64
|
+
if (!lastLineWasEmpty) {
|
|
65
|
+
newLinesArr.unshift(linesArr[i].trim());
|
|
66
|
+
lastLineWasEmpty = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (linesArr[i][0] === "*" && linesArr[i][1] === " ") {
|
|
70
|
+
newLinesArr.unshift(`- ${linesArr[i].slice(2)}`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
newLinesArr.unshift(linesArr[i]);
|
|
74
|
+
}
|
|
75
|
+
if (linesArr[i].trim()) {
|
|
76
|
+
lastLineWasEmpty = false;
|
|
77
|
+
}
|
|
55
78
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
newLinesArr.unshift(`- ${linesArr[i].slice(2)}`);
|
|
59
|
-
} else {
|
|
60
|
-
newLinesArr.unshift(linesArr[i]);
|
|
61
|
-
}
|
|
62
|
-
if (linesArr[i].trim()) {
|
|
63
|
-
lastLineWasEmpty = false;
|
|
64
|
-
}
|
|
79
|
+
/* istanbul ignore next */
|
|
80
|
+
final = `${newLinesArr.join("\n")}${changelogEndedWithLinebreak ? "\n" : ""}`;
|
|
65
81
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
version,
|
|
71
|
-
res: final || changelogContents
|
|
72
|
-
};
|
|
82
|
+
return {
|
|
83
|
+
version,
|
|
84
|
+
res: final || changelogContents,
|
|
85
|
+
};
|
|
73
86
|
}
|
|
74
87
|
|
|
75
88
|
export { cleanChangelogs, version };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name lerna-clean-changelogs
|
|
3
3
|
* @fileoverview Removes frivolous entries from commitizen generated changelogs
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/lerna-clean-changelogs/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).lernaCleanChangelogs={})}(this,(function(t){"use strict";const e="3.0.
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).lernaCleanChangelogs={})}(this,(function(t){"use strict";const e="3.0.7";function n(t){return"string"==typeof t}t.cleanChangelogs=function(t,r=!1){if(void 0===t)throw new Error("lerna-clean-changelogs: [THROW_ID_01] The first input argument is missing!");if(!n(t))throw new Error(`lerna-clean-changelogs: [THROW_ID_02] The first input argument must be a string! It was given as ${Array.isArray(t)?"array":typeof t}, equal to:\n${JSON.stringify(t,null,4)}`);let i,s=!1;if("string"==typeof t&&t.length&&(!t.includes("\n")||!t.includes("\r"))){const e=n(t)&&t.length&&("\n"===t[t.length-1]||"\r"===t[t.length-1]),o=(t=t.trim().replace(/(https:\/\/git\.sr\.ht\/~[^/]+\/[^/]+\/)commits\//g,"$1commit/")).split(/\r?\n/);r&&o.forEach(((t,e)=>{t.startsWith("#")&&(o[e]=t.replace(/(#+) \[?(\d+\.\d+\.\d+)\s?\]\([^)]*\)/g,"$1 $2")),e&&o[e].startsWith("# ")&&(o[e]=`#${o[e]}`)}));const l=[];for(let t=o.length;t--;){if(o[t].startsWith("**Note:** Version bump only")||r&&o[t].toLowerCase().includes("wip")){for(;n(o[t-1])&&!o[t-1].trim()&&t;)t-=1;for(t&&n(o[t-1])&&o[t-1].trim().startsWith("#")&&(t-=1);n(o[t-1])&&!o[t-1].trim()&&t;)t-=1}else o[t].trim()?l.unshift("*"===o[t][0]&&" "===o[t][1]?`- ${o[t].slice(2)}`:o[t]):s||(l.unshift(o[t].trim()),s=!0);o[t].trim()&&(s=!1)}i=`${l.join("\n")}${e?"\n":""}`}return{version:e,res:i||t}},t.version=e,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lerna-clean-changelogs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Removes frivolous entries from commitizen generated changelogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"changelog",
|
|
@@ -36,13 +36,12 @@
|
|
|
36
36
|
"types": "types/index.d.ts",
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "rollup -c",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
40
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
41
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
41
42
|
"clean_types": "../../scripts/cleanTypes.js",
|
|
42
43
|
"dev": "rollup -c --dev",
|
|
43
44
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
44
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
45
|
-
"esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
46
45
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
47
46
|
"lect": "lect",
|
|
48
47
|
"lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
|
|
@@ -51,17 +50,14 @@
|
|
|
51
50
|
"republish": "npm publish || :",
|
|
52
51
|
"tap": "tap",
|
|
53
52
|
"pretest": "npm run build",
|
|
54
|
-
"test": "npm run
|
|
53
|
+
"test": "npm run test:ci && npm run perf",
|
|
54
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
55
55
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
56
56
|
"tsc": "tsc",
|
|
57
|
-
"unittest": "tap --no-only --
|
|
57
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
58
58
|
},
|
|
59
59
|
"tap": {
|
|
60
60
|
"check-coverage": false,
|
|
61
|
-
"coverage-report": [
|
|
62
|
-
"json-summary",
|
|
63
|
-
"text"
|
|
64
|
-
],
|
|
65
61
|
"node-arg": [
|
|
66
62
|
"--no-warnings",
|
|
67
63
|
"--experimental-loader",
|
|
@@ -81,7 +77,7 @@
|
|
|
81
77
|
}
|
|
82
78
|
},
|
|
83
79
|
"dependencies": {
|
|
84
|
-
"@babel/runtime": "^7.16.
|
|
80
|
+
"@babel/runtime": "^7.16.3"
|
|
85
81
|
},
|
|
86
82
|
"devDependencies": {
|
|
87
83
|
"@babel/cli": "^7.16.0",
|
|
@@ -92,8 +88,8 @@
|
|
|
92
88
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
93
89
|
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
94
90
|
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
95
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
96
|
-
"@babel/preset-env": "^7.16.
|
|
91
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
92
|
+
"@babel/preset-env": "^7.16.4",
|
|
97
93
|
"@babel/preset-typescript": "^7.16.0",
|
|
98
94
|
"@babel/register": "^7.16.0",
|
|
99
95
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
@@ -103,25 +99,25 @@
|
|
|
103
99
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
104
100
|
"@rollup/plugin-strip": "^2.1.0",
|
|
105
101
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
106
|
-
"@types/node": "^16.11.
|
|
102
|
+
"@types/node": "^16.11.10",
|
|
107
103
|
"@types/tap": "^15.0.5",
|
|
108
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
109
|
-
"@typescript-eslint/parser": "^5.
|
|
110
|
-
"core-js": "^3.19.
|
|
104
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
105
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
106
|
+
"core-js": "^3.19.2",
|
|
111
107
|
"cross-env": "^7.0.3",
|
|
112
|
-
"eslint": "^8.
|
|
113
|
-
"lect": "^0.18.
|
|
114
|
-
"rollup": "^2.
|
|
108
|
+
"eslint": "^8.3.0",
|
|
109
|
+
"lect": "^0.18.7",
|
|
110
|
+
"rollup": "^2.60.1",
|
|
115
111
|
"rollup-plugin-ascii": "^0.0.3",
|
|
116
112
|
"rollup-plugin-banner": "^0.2.1",
|
|
117
113
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
118
|
-
"rollup-plugin-dts": "^4.0.
|
|
114
|
+
"rollup-plugin-dts": "^4.0.1",
|
|
119
115
|
"rollup-plugin-terser": "^7.0.2",
|
|
120
|
-
"tap": "^15.
|
|
116
|
+
"tap": "^15.1.5",
|
|
121
117
|
"tslib": "^2.3.1",
|
|
122
|
-
"typescript": "^4.
|
|
118
|
+
"typescript": "^4.5.2"
|
|
123
119
|
},
|
|
124
120
|
"engines": {
|
|
125
|
-
"node": ">=
|
|
121
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
126
122
|
}
|
|
127
123
|
}
|