lerna-clean-changelogs 3.0.5 → 3.0.11

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 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
@@ -26,18 +26,17 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
30
30
 
31
31
  ```bash
32
32
  npm i lerna-clean-changelogs
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 2.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
40
38
  import { strict as assert } from "assert";
39
+
41
40
  import { cleanChangelogs } from "lerna-clean-changelogs";
42
41
 
43
42
  // are all values equal to null:
@@ -49,16 +48,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
49
48
 
50
49
  ## 2.9.2 (2018-12-27)
51
50
 
52
-
53
-
54
-
55
-
56
-
57
-
58
51
  **Note:** Version bump only for package ranges-apply
59
52
 
60
-
61
-
62
53
  ## [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
54
 
64
55
  **Note:** Version bump only for package ranges-apply
@@ -98,7 +89,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
98
89
 
99
90
  ## Documentation
100
91
 
101
- Please [visit codsen.com](https://codsen.com/os/lerna-clean-changelogs/) for a full description of the API and examples.
92
+ Please [visit codsen.com](https://codsen.com/os/lerna-clean-changelogs/) for a full description of the API.
102
93
 
103
94
  ## Contributing
104
95
 
@@ -108,6 +99,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
108
99
 
109
100
  MIT License
110
101
 
111
- Copyright (c) 2010-2021 Roy Revelt and other contributors
102
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
112
103
 
113
104
  <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">
@@ -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.5
4
+ * @version 3.0.11
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.5";
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
- } 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.11";var m=u;function i(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(!i(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 p=i(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,t)=>{e.startsWith("#")&&(s[t]=e.replace(/(#+) \[?(\d+\.\d+\.\d+)\s?\]\([^)]*\)/g,"$1 $2")),t&&s[t].startsWith("# ")&&(s[t]=`#${s[t]}`)});let n=[];for(let e=s.length;e--;){if(s[e].startsWith("**Note:** Version bump only")||a&&s[e].toLowerCase().includes("wip")){for(;i(s[e-1])&&!s[e-1].trim()&&e;)e-=1;for(e&&i(s[e-1])&&s[e-1].trim().startsWith("#")&&(e-=1);i(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
+ `)}${p?`
15
+ `:""}`}return{version:m,res:o||r}}export{y as cleanChangelogs,m 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.5
4
+ * @version 3.0.11
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.5";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 p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var h=e=>p(e,"__esModule",{value:!0});var $=(e,t)=>{for(var i in t)p(e,i,{get:t[i],enumerable:!0})},g=(e,t,i,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!y.call(e,n)&&(i||n!=="default")&&p(e,n,{get:()=>t[n],enumerable:!(l=d(t,n))||l.enumerable});return e};var b=(e=>(t,i)=>e&&e.get(t)||(i=g(h({}),t,1),e&&e.set(t,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var w={};$(w,{cleanChangelogs:()=>v,version:()=>m});var c="3.0.11";var m=c;function o(e){return typeof e=="string"}function v(e,t=!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 i,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/);t&&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")||t&&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)}i=`${u.join(`
14
+ `)}${n?`
15
+ `:""}`}return{version:m,res:i||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.5",
3
+ "version": "3.0.11",
4
4
  "description": "Removes frivolous entries from commitizen generated changelogs",
5
5
  "keywords": [
6
6
  "changelog",
@@ -35,93 +35,36 @@
35
35
  },
36
36
  "types": "types/index.d.ts",
37
37
  "scripts": {
38
- "build": "rollup -c",
39
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
40
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
41
- "clean_types": "../../scripts/cleanTypes.js",
42
- "dev": "rollup -c --dev",
43
- "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
- "format": "npm run lect && npm run prettier && npm run lint",
47
- "lect": "lect",
48
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
49
- "perf": "node perf/check",
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 && yarn run prettier 'types/index.d.ts' --write",
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
+ "prettier": "prettier",
48
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
49
+ "pretest": "yarn run lect && yarn run build",
50
+ "test": "c8 yarn run unit && yarn run examples && yarn run lint",
51
+ "unit": "uvu test"
58
52
  },
59
- "tap": {
60
- "check-coverage": false,
61
- "coverage-report": [
62
- "json-summary",
63
- "text"
64
- ],
65
- "node-arg": [
66
- "--no-warnings",
67
- "--experimental-loader",
68
- "@istanbuljs/esm-loader-hook"
53
+ "engines": {
54
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
55
+ },
56
+ "c8": {
57
+ "check-coverage": true,
58
+ "exclude": [
59
+ "**/test/**/*.*"
69
60
  ],
70
- "timeout": 0
61
+ "lines": 100
71
62
  },
72
63
  "lect": {
73
64
  "licence": {
74
65
  "extras": [
75
66
  ""
76
67
  ]
77
- },
78
- "req": "{ cleanChangelogs }",
79
- "various": {
80
- "devDependencies": []
81
68
  }
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.2.0",
113
- "lect": "^0.18.5",
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.1",
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
69
  }
127
70
  }
package/types/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  declare const version: string;
2
- declare function cleanChangelogs(changelogContents: string, extras?: boolean): {
3
- version: string;
4
- res: string;
2
+ declare function cleanChangelogs(
3
+ changelogContents: string,
4
+ extras?: boolean
5
+ ): {
6
+ version: string;
7
+ res: string;
5
8
  };
6
9
 
7
10
  export { cleanChangelogs, version };
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);"}}