@myparcel-dev/semantic-release-wordpress-readme-generator 1.3.0
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
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# semantic-release-wordpress-readme-generator
|
|
2
|
+
|
|
3
|
+
Generates a readme.txt for WordPress plugin releases.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### With Yarn
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
yarn add -D @myparcel-dev/semantic-release-wordpress-readme-generator
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### With PNPM
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
pnpm add -D @myparcel-dev/semantic-release-wordpress-readme-generator
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### With NPM
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
npm install --save-dev @myparcel-dev/semantic-release-wordpress-readme-generator
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Add the following to your `release.config.js`, below the `@semantic-release/changelog` plugin:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const wordpressReadme = require('@myparcel-dev/semantic-release-wordpress-readme-generator');
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
plugins: [
|
|
34
|
+
// ...
|
|
35
|
+
'@myparcel-dev/semantic-release-wordpress-readme-generator',
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Options
|
|
41
|
+
|
|
42
|
+
By default, this is the configuration that will be used. This defines which commits will be included in the readme, and the order in which the entries will be written.
|
|
43
|
+
|
|
44
|
+
| Type | Prefix |
|
|
45
|
+
|----------|-----------------------------|
|
|
46
|
+
| `feat` | `New: ` |
|
|
47
|
+
| `fix` | `Fixed bug: ` |
|
|
48
|
+
| `perf` | `Performance improvement: ` |
|
|
49
|
+
| `revert` | `Reverted: ` |
|
|
50
|
+
|
|
51
|
+
To customize this, pass an object to the plugin and override the `types` property:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const wordpressReadme = require('@myparcel-dev/semantic-release-wordpress-readme-generator');
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
plugins: [
|
|
58
|
+
// ...
|
|
59
|
+
[
|
|
60
|
+
'@myparcel-dev/semantic-release-wordpress-readme-generator',
|
|
61
|
+
{
|
|
62
|
+
types: [
|
|
63
|
+
{
|
|
64
|
+
type: 'feat',
|
|
65
|
+
prefix: 'Feature: ',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'fix',
|
|
69
|
+
prefix: 'Fix: ',
|
|
70
|
+
},
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const d = require("fs"), a = require("debug")("semantic-release:@myparcel/semantic-release-wordpress-readme-generator"), v = [
|
|
2
|
+
{
|
|
3
|
+
type: "feat",
|
|
4
|
+
prefix: "New: "
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
type: "fix",
|
|
8
|
+
prefix: "Fixed bug: "
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
type: "perf",
|
|
12
|
+
prefix: "Performance improvement: "
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "revert",
|
|
16
|
+
prefix: "Revert: "
|
|
17
|
+
}
|
|
18
|
+
], A = {
|
|
19
|
+
generateNotes(u, m) {
|
|
20
|
+
const { commits: f, nextRelease: o, cwd: y, logger: x } = m, c = `${y}/readme.txt`, $ = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
|
|
21
|
+
let { types: n } = u;
|
|
22
|
+
(!n || !Array.isArray(n) || n.length === 0) && (n = v);
|
|
23
|
+
const s = n.map((e) => e.type), b = f.reduce((e, t) => {
|
|
24
|
+
var l;
|
|
25
|
+
a(`Parsing ${t.subject}`);
|
|
26
|
+
const r = t.subject.split(":")[0], i = r == null ? void 0 : r.replace(/!|\(.+\)/, "").trim();
|
|
27
|
+
if (!s.includes(i))
|
|
28
|
+
return a(`Skipping commit: ${t.subject}`), e;
|
|
29
|
+
const { prefix: p } = n.find((h) => h.type === i), g = (l = t.subject.split(":")[1]) == null ? void 0 : l.trim();
|
|
30
|
+
return e.push({
|
|
31
|
+
type: i,
|
|
32
|
+
message: `* ${p}${g}`
|
|
33
|
+
}), a(`Adding commit: ${t.subject} – * ${p}${g}`), e;
|
|
34
|
+
}, []).sort((e, t) => s.indexOf(e.type) - s.indexOf(t.type)), S = `= ${o.version} (${$}) =
|
|
35
|
+
|
|
36
|
+
${b.map((e) => e.message).join(`
|
|
37
|
+
`)}`, j = d.readFileSync(c).toString("utf-8").replace("== Changelog ==", `== Changelog ==
|
|
38
|
+
|
|
39
|
+
${S}`).replace(/Stable tag: .+\nRequires/g, `Stable tag: ${o.version}
|
|
40
|
+
Requires`);
|
|
41
|
+
d.writeFileSync(c, j), x.log("Updated changelog in readme.txt");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
module.exports = A;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
(function(s){typeof define=="function"&&define.amd?define(s):s()})(function(){"use strict";const s=require("fs"),r=require("debug")("semantic-release:@myparcel/semantic-release-wordpress-readme-generator"),l=[{type:"feat",prefix:"New: "},{type:"fix",prefix:"Fixed bug: "},{type:"perf",prefix:"Performance improvement: "},{type:"revert",prefix:"Revert: "}],f={generateNotes(m,y){const{commits:x,nextRelease:a,cwd:$,logger:b}=y,p=`${$}/readme.txt`,S=new Date().toISOString().substring(0,10);let{types:n}=m;(!n||!Array.isArray(n)||n.length===0)&&(n=l);const i=n.map(e=>e.type),j=x.reduce((e,t)=>{var u;r(`Parsing ${t.subject}`);const o=t.subject.split(":")[0],c=o==null?void 0:o.replace(/!|\(.+\)/,"").trim();if(!i.includes(c))return r(`Skipping commit: ${t.subject}`),e;const{prefix:g}=n.find(A=>A.type===c),d=(u=t.subject.split(":")[1])==null?void 0:u.trim();return e.push({type:c,message:`* ${g}${d}`}),r(`Adding commit: ${t.subject} – * ${g}${d}`),e},[]).sort((e,t)=>i.indexOf(e.type)-i.indexOf(t.type)),h=`= ${a.version} (${S}) =
|
|
2
|
+
|
|
3
|
+
${j.map(e=>e.message).join(`
|
|
4
|
+
`)}`,v=s.readFileSync(p).toString("utf-8").replace("== Changelog ==",`== Changelog ==
|
|
5
|
+
|
|
6
|
+
${h}`).replace(/Stable tag: .+\nRequires/g,`Stable tag: ${a.version}
|
|
7
|
+
Requires`);s.writeFileSync(p,v),b.log("Updated changelog in readme.txt")}};module.exports=f});
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@myparcel-dev/semantic-release-wordpress-readme-generator",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Generates a readme.txt for use with WordPress plugin releases in semantic-release",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "github:myparcelnl/semantic-release-wordpress-readme-generator"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "MyParcel <support@myparcel.nl>",
|
|
11
|
+
"main": "./lib/semantic-release-wordpress-readme-generator.umd.js",
|
|
12
|
+
"module": "./lib/semantic-release-wordpress-readme-generator.mjs",
|
|
13
|
+
"files": [
|
|
14
|
+
"lib"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"prepare": "is-ci || husky install",
|
|
18
|
+
"build": "vite build"
|
|
19
|
+
},
|
|
20
|
+
"lint-staged": {
|
|
21
|
+
"package.json": "npx sort-package-json",
|
|
22
|
+
"*.js": "npx eslint --fix"
|
|
23
|
+
},
|
|
24
|
+
"prettier": "@myparcel-dev/prettier-config",
|
|
25
|
+
"release": {
|
|
26
|
+
"extends": "@myparcel-dev/semantic-release-config/github-npm"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"debug": "^4.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@myparcel-dev/semantic-release-config": "^6.0.0",
|
|
33
|
+
"@myparcel-eslint/eslint-config-esnext": "^1.2.0",
|
|
34
|
+
"@myparcel-eslint/eslint-config-node": "^1.2.0",
|
|
35
|
+
"@myparcel-eslint/eslint-config-prettier": "^1.2.0",
|
|
36
|
+
"eslint": "^8.38.0",
|
|
37
|
+
"husky": "^8.0.1",
|
|
38
|
+
"is-ci": "^3.0.1",
|
|
39
|
+
"lint-staged": "^13.0.3",
|
|
40
|
+
"prettier": "^2.7.1",
|
|
41
|
+
"semantic-release": "^21.0.0",
|
|
42
|
+
"vite": "^4.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"semantic-release": "^19 || ^20 || ^21"
|
|
46
|
+
},
|
|
47
|
+
"packageManager": "yarn@3.5.0",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
51
|
+
}
|