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 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 and examples.
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.7
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 version$1 = "3.0.7";
11
-
12
- const version = version$1;
13
- function isStr(something) {
14
- return typeof something === "string";
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.7
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
- !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})}));
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);})();
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { cleanChangelogs } from "../dist/lerna-clean-changelogs.esm.js";
5
6
 
6
7
  // are all values equal to null:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lerna-clean-changelogs",
3
- "version": "3.0.7",
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": "rollup -c",
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",
42
- "clean_types": "../../scripts/cleanTypes.js",
43
- "dev": "rollup -c --dev",
44
- "devunittest": "npm run dev && tap --only -R 'base'",
45
- "format": "npm run lect && npm run prettier && npm run lint",
46
- "lect": "lect",
47
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
48
- "perf": "node perf/check",
49
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
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
- "tap": {
60
- "check-coverage": false,
61
- "node-arg": [
62
- "--no-warnings",
63
- "--experimental-loader",
64
- "@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/**/*.*"
65
58
  ],
66
- "timeout": 0
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 &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; cleanChangelogs &#x7D; 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);"}}