lerna-clean-changelogs 3.0.4 → 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/CHANGELOG.md +0 -23
- package/LICENSE +1 -1
- package/README.md +4 -9
- package/dist/lerna-clean-changelogs.esm.js +7 -67
- package/dist/lerna-clean-changelogs.umd.js +7 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +21 -80
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
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
|
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,75 +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
|
-
} 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
|
-
});
|
|
38
|
-
}
|
|
39
|
-
const newLinesArr = [];
|
|
40
|
-
for (let i = linesArr.length; i--;) {
|
|
41
|
-
if (linesArr[i].startsWith("**Note:** Version bump only") || extras && linesArr[i].toLowerCase().includes("wip")) {
|
|
42
|
-
while (isStr(linesArr[i - 1]) && !linesArr[i - 1].trim() && i) {
|
|
43
|
-
i -= 1;
|
|
44
|
-
}
|
|
45
|
-
if (i && isStr(linesArr[i - 1]) && linesArr[i - 1].trim().startsWith("#")) {
|
|
46
|
-
i -= 1;
|
|
47
|
-
}
|
|
48
|
-
while (isStr(linesArr[i - 1]) && !linesArr[i - 1].trim() && i) {
|
|
49
|
-
i -= 1;
|
|
50
|
-
}
|
|
51
|
-
} else if (!linesArr[i].trim()) {
|
|
52
|
-
if (!lastLineWasEmpty) {
|
|
53
|
-
newLinesArr.unshift(linesArr[i].trim());
|
|
54
|
-
lastLineWasEmpty = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (linesArr[i][0] === "*" && linesArr[i][1] === " ") {
|
|
58
|
-
newLinesArr.unshift(`- ${linesArr[i].slice(2)}`);
|
|
59
|
-
} else {
|
|
60
|
-
newLinesArr.unshift(linesArr[i]);
|
|
61
|
-
}
|
|
62
|
-
if (linesArr[i].trim()) {
|
|
63
|
-
lastLineWasEmpty = false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/* istanbul ignore next */
|
|
67
|
-
final = `${newLinesArr.join("\n")}${changelogEndedWithLinebreak ? "\n" : ""}`;
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
version,
|
|
71
|
-
res: final || changelogContents
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
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,93 +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
|
-
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
51
|
-
"republish": "npm publish || :",
|
|
52
|
-
"tap": "tap",
|
|
53
|
-
"pretest": "npm run build",
|
|
54
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
55
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
56
|
-
"tsc": "tsc",
|
|
57
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
"--no-warnings",
|
|
67
|
-
"--experimental-loader",
|
|
68
|
-
"@istanbuljs/esm-loader-hook"
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
53
|
+
},
|
|
54
|
+
"c8": {
|
|
55
|
+
"check-coverage": true,
|
|
56
|
+
"exclude": [
|
|
57
|
+
"**/test/**/*.*"
|
|
69
58
|
],
|
|
70
|
-
"
|
|
59
|
+
"lines": 100
|
|
71
60
|
},
|
|
72
61
|
"lect": {
|
|
73
62
|
"licence": {
|
|
74
63
|
"extras": [
|
|
75
64
|
""
|
|
76
65
|
]
|
|
77
|
-
},
|
|
78
|
-
"req": "{ cleanChangelogs }",
|
|
79
|
-
"various": {
|
|
80
|
-
"devDependencies": []
|
|
81
66
|
}
|
|
82
|
-
},
|
|
83
|
-
"dependencies": {
|
|
84
|
-
"@babel/runtime": "^7.16.0"
|
|
85
|
-
},
|
|
86
|
-
"devDependencies": {
|
|
87
|
-
"@babel/cli": "^7.16.0",
|
|
88
|
-
"@babel/core": "^7.16.0",
|
|
89
|
-
"@babel/node": "^7.16.0",
|
|
90
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
91
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
92
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
93
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
94
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
95
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
96
|
-
"@babel/preset-env": "^7.16.0",
|
|
97
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
98
|
-
"@babel/register": "^7.16.0",
|
|
99
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
100
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
101
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
102
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
103
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
104
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
105
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
106
|
-
"@types/node": "^16.11.6",
|
|
107
|
-
"@types/tap": "^15.0.5",
|
|
108
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
109
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
110
|
-
"core-js": "^3.19.1",
|
|
111
|
-
"cross-env": "^7.0.3",
|
|
112
|
-
"eslint": "^8.1.0",
|
|
113
|
-
"lect": "^0.18.4",
|
|
114
|
-
"rollup": "^2.59.0",
|
|
115
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
116
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
117
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
118
|
-
"rollup-plugin-dts": "^4.0.0",
|
|
119
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
120
|
-
"tap": "^15.0.10",
|
|
121
|
-
"tslib": "^2.3.1",
|
|
122
|
-
"typescript": "^4.4.4"
|
|
123
|
-
},
|
|
124
|
-
"engines": {
|
|
125
|
-
"node": ">=12"
|
|
126
67
|
}
|
|
127
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);"}}
|