lerna-clean-changelogs 3.0.7 → 3.0.10
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/README.md +4 -9
- package/dist/lerna-clean-changelogs.esm.js +7 -80
- package/dist/lerna-clean-changelogs.umd.js +7 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +21 -76
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 2.1.0
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
import { strict as assert } from "assert";
|
|
41
|
+
|
|
41
42
|
import { cleanChangelogs } from "lerna-clean-changelogs";
|
|
42
43
|
|
|
43
44
|
// are all values equal to null:
|
|
@@ -49,16 +50,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
49
50
|
|
|
50
51
|
## 2.9.2 (2018-12-27)
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
53
|
**Note:** Version bump only for package ranges-apply
|
|
59
54
|
|
|
60
|
-
|
|
61
|
-
|
|
62
55
|
## [2.9.1](https://gitlab.com/codsen/codsen/tree/master/packages/ranges-apply/compare/ranges-apply@2.9.0...ranges-apply@2.9.1) (2018-12-27)
|
|
63
56
|
|
|
64
57
|
**Note:** Version bump only for package ranges-apply
|
|
@@ -98,7 +91,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
98
91
|
|
|
99
92
|
## Documentation
|
|
100
93
|
|
|
101
|
-
Please [visit codsen.com](https://codsen.com/os/lerna-clean-changelogs/) for a full description of the API
|
|
94
|
+
Please [visit codsen.com](https://codsen.com/os/lerna-clean-changelogs/) for a full description of the API.
|
|
102
95
|
|
|
103
96
|
## Contributing
|
|
104
97
|
|
|
@@ -110,4 +103,6 @@ MIT License
|
|
|
110
103
|
|
|
111
104
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
112
105
|
|
|
106
|
+
|
|
113
107
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
108
|
+
|
|
@@ -1,88 +1,15 @@
|
|
|
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.10
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
function cleanChangelogs(changelogContents, extras = false) {
|
|
17
|
-
if (changelogContents === undefined) {
|
|
18
|
-
throw new Error(`lerna-clean-changelogs: [THROW_ID_01] The first input argument is missing!`);
|
|
19
|
-
}
|
|
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
|
-
});
|
|
46
|
-
}
|
|
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
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/* istanbul ignore next */
|
|
80
|
-
final = `${newLinesArr.join("\n")}${changelogEndedWithLinebreak ? "\n" : ""}`;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
version,
|
|
84
|
-
res: final || changelogContents,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { cleanChangelogs, version };
|
|
10
|
+
var u="3.0.10";var p=u;function t(r){return typeof r=="string"}function y(r,a=!1){if(r===void 0)throw new Error("lerna-clean-changelogs: [THROW_ID_01] The first input argument is missing!");if(!t(r))throw new Error(`lerna-clean-changelogs: [THROW_ID_02] The first input argument must be a string! It was given as ${Array.isArray(r)?"array":typeof r}, equal to:
|
|
11
|
+
${JSON.stringify(r,null,4)}`);let o,l=!1;if(typeof r=="string"&&r.length&&(!r.includes(`
|
|
12
|
+
`)||!r.includes("\r"))){let c=t(r)&&r.length&&(r[r.length-1]===`
|
|
13
|
+
`||r[r.length-1]==="\r");r=r.trim().replace(/(https:\/\/git\.sr\.ht\/~[^/]+\/[^/]+\/)commits\//g,"$1commit/");let s=r.split(/\r?\n/);a&&s.forEach((e,i)=>{e.startsWith("#")&&(s[i]=e.replace(/(#+) \[?(\d+\.\d+\.\d+)\s?\]\([^)]*\)/g,"$1 $2")),i&&s[i].startsWith("# ")&&(s[i]=`#${s[i]}`)});let n=[];for(let e=s.length;e--;){if(s[e].startsWith("**Note:** Version bump only")||a&&s[e].toLowerCase().includes("wip")){for(;t(s[e-1])&&!s[e-1].trim()&&e;)e-=1;for(e&&t(s[e-1])&&s[e-1].trim().startsWith("#")&&(e-=1);t(s[e-1])&&!s[e-1].trim()&&e;)e-=1}else s[e].trim()?s[e][0]==="*"&&s[e][1]===" "?n.unshift(`- ${s[e].slice(2)}`):n.unshift(s[e]):l||(n.unshift(s[e].trim()),l=!0);s[e].trim()&&(l=!1)}o=`${n.join(`
|
|
14
|
+
`)}${c?`
|
|
15
|
+
`:""}`}return{version:p,res:o||r}}export{y as cleanChangelogs,p as version};
|
|
@@ -1,10 +1,15 @@
|
|
|
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.10
|
|
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
|
-
|
|
10
|
+
var lernaCleanChangelogs=(()=>{var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var $=e=>c(e,"__esModule",{value:!0});var h=(e,i)=>{for(var t in i)c(e,t,{get:i[t],enumerable:!0})},g=(e,i,t,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of f(i))!y.call(e,n)&&(t||n!=="default")&&c(e,n,{get:()=>i[n],enumerable:!(l=d(i,n))||l.enumerable});return e};var b=(e=>(i,t)=>e&&e.get(i)||(t=g($({}),i,1),e&&e.set(i,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var W={};h(W,{cleanChangelogs:()=>v,version:()=>p});var m="3.0.10";var p=m;function o(e){return typeof e=="string"}function v(e,i=!1){if(e===void 0)throw new Error("lerna-clean-changelogs: [THROW_ID_01] The first input argument is missing!");if(!o(e))throw new Error(`lerna-clean-changelogs: [THROW_ID_02] The first input argument must be a string! It was given as ${Array.isArray(e)?"array":typeof e}, equal to:
|
|
11
|
+
${JSON.stringify(e,null,4)}`);let t,l=!1;if(typeof e=="string"&&e.length&&(!e.includes(`
|
|
12
|
+
`)||!e.includes("\r"))){let n=o(e)&&e.length&&(e[e.length-1]===`
|
|
13
|
+
`||e[e.length-1]==="\r");e=e.trim().replace(/(https:\/\/git\.sr\.ht\/~[^/]+\/[^/]+\/)commits\//g,"$1commit/");let s=e.split(/\r?\n/);i&&s.forEach((r,a)=>{r.startsWith("#")&&(s[a]=r.replace(/(#+) \[?(\d+\.\d+\.\d+)\s?\]\([^)]*\)/g,"$1 $2")),a&&s[a].startsWith("# ")&&(s[a]=`#${s[a]}`)});let u=[];for(let r=s.length;r--;){if(s[r].startsWith("**Note:** Version bump only")||i&&s[r].toLowerCase().includes("wip")){for(;o(s[r-1])&&!s[r-1].trim()&&r;)r-=1;for(r&&o(s[r-1])&&s[r-1].trim().startsWith("#")&&(r-=1);o(s[r-1])&&!s[r-1].trim()&&r;)r-=1}else s[r].trim()?s[r][0]==="*"&&s[r][1]===" "?u.unshift(`- ${s[r].slice(2)}`):u.unshift(s[r]):l||(u.unshift(s[r].trim()),l=!0);s[r].trim()&&(l=!1)}t=`${u.join(`
|
|
14
|
+
`)}${n?`
|
|
15
|
+
`:""}`}return{version:p,res:t||e}}return b(W);})();
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lerna-clean-changelogs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Removes frivolous entries from commitizen generated changelogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"changelog",
|
|
@@ -35,89 +35,34 @@
|
|
|
35
35
|
},
|
|
36
36
|
"types": "types/index.d.ts",
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"republish": "npm publish || :",
|
|
51
|
-
"tap": "tap",
|
|
52
|
-
"pretest": "npm run build",
|
|
53
|
-
"test": "npm run test:ci && npm run perf",
|
|
54
|
-
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
55
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
56
|
-
"tsc": "tsc",
|
|
57
|
-
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
38
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
39
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
40
|
+
"dts": "rollup -c",
|
|
41
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
42
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
43
|
+
"letspublish": "yarn publish || :",
|
|
44
|
+
"lint": "eslint . --fix",
|
|
45
|
+
"perf": "node perf/check.js",
|
|
46
|
+
"prepare": "echo 'ready'",
|
|
47
|
+
"pretest": "yarn run lect && yarn run build",
|
|
48
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
49
|
+
"unit": "uvu test"
|
|
58
50
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
53
|
+
},
|
|
54
|
+
"c8": {
|
|
55
|
+
"check-coverage": true,
|
|
56
|
+
"exclude": [
|
|
57
|
+
"**/test/**/*.*"
|
|
65
58
|
],
|
|
66
|
-
"
|
|
59
|
+
"lines": 100
|
|
67
60
|
},
|
|
68
61
|
"lect": {
|
|
69
62
|
"licence": {
|
|
70
63
|
"extras": [
|
|
71
64
|
""
|
|
72
65
|
]
|
|
73
|
-
},
|
|
74
|
-
"req": "{ cleanChangelogs }",
|
|
75
|
-
"various": {
|
|
76
|
-
"devDependencies": []
|
|
77
66
|
}
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"@babel/runtime": "^7.16.3"
|
|
81
|
-
},
|
|
82
|
-
"devDependencies": {
|
|
83
|
-
"@babel/cli": "^7.16.0",
|
|
84
|
-
"@babel/core": "^7.16.0",
|
|
85
|
-
"@babel/node": "^7.16.0",
|
|
86
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
87
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
88
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
89
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
90
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
91
|
-
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
92
|
-
"@babel/preset-env": "^7.16.4",
|
|
93
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
94
|
-
"@babel/register": "^7.16.0",
|
|
95
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
96
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
97
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
98
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
99
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
100
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
101
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
102
|
-
"@types/node": "^16.11.10",
|
|
103
|
-
"@types/tap": "^15.0.5",
|
|
104
|
-
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
105
|
-
"@typescript-eslint/parser": "^5.5.0",
|
|
106
|
-
"core-js": "^3.19.2",
|
|
107
|
-
"cross-env": "^7.0.3",
|
|
108
|
-
"eslint": "^8.3.0",
|
|
109
|
-
"lect": "^0.18.7",
|
|
110
|
-
"rollup": "^2.60.1",
|
|
111
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
112
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
113
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
114
|
-
"rollup-plugin-dts": "^4.0.1",
|
|
115
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
116
|
-
"tap": "^15.1.5",
|
|
117
|
-
"tslib": "^2.3.1",
|
|
118
|
-
"typescript": "^4.5.2"
|
|
119
|
-
},
|
|
120
|
-
"engines": {
|
|
121
|
-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
122
67
|
}
|
|
123
68
|
}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/examples/api.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"_quickTake.js":{"title":"Quick Take","content":"import { strict as assert } from \"assert\";\nimport { cleanChangelogs } from \"lerna-clean-changelogs\";\n\n// are all values equal to null:\nassert.equal(\n cleanChangelogs(`# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## 2.9.2 (2018-12-27)\n\n\n\n\n\n\n\n**Note:** Version bump only for package ranges-apply\n\n\n\n## [2.9.1](https://gitlab.com/codsen/codsen/tree/master/packages/ranges-apply/compare/ranges-apply@2.9.0...ranges-apply@2.9.1) (2018-12-27)\n\n**Note:** Version bump only for package ranges-apply\n\n## 2.9.0 (2018-12-26)\n\n### Bug Fixes\n\n* aaa\n\n### Features\n\n* bbb\n\n`).res,\n //\n //\n //\n // output:\n `# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## 2.9.0 (2018-12-26)\n\n### Bug Fixes\n\n- aaa\n\n### Features\n\n- bbb\n`\n);"}}
|