@maggioli-rd/sr-codeowners-plugin 1.2.1 → 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/CHANGELOG.md +19 -0
- package/README.md +22 -1
- package/dist/types.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/dist/verifyConditions.js +1 -1
- package/dist/verifyRelease.js +11 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [1.3.0](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/compare/v1.2.2...v1.3.0) (2024-1-9)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add header checks in cmd build ([4d01028](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/4d0102818e95c311909a09477f78c7ee78885bc0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add header plugin config ([3db10ee](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/3db10eec31504e184b2f966e8ec4c7435bfbf02f))
|
|
12
|
+
|
|
13
|
+
## [1.2.2](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/compare/v1.2.1...v1.2.2) (2024-1-9)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* sort unique output (closes [#3](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/issues/3)) ([b1f700a](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/b1f700a78f88be7d8c805f869cf10781acbea205))
|
|
19
|
+
|
|
1
20
|
## [1.2.1](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/compare/v1.2.0...v1.2.1) (2024-1-9)
|
|
2
21
|
|
|
3
22
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @maggioli-rd/sr-codeowners-plugin
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@maggioli-rd/sr-codeowners-plugin)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
| Step | Description |
|
|
7
|
+
|--------------------|--------------------------------------------------------------------------|
|
|
8
|
+
| `verifyConditions` | Execute a shell command to verify if the CODEOWNERS file can be created. |
|
|
9
|
+
| `verifyRelease` | Execute a shell command to create the CODEOWNERS file. |
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
| Options | Description | Default |
|
|
15
|
+
|--------------------|-------------------------------------------------------------------------------------------------------------|----------------------------|
|
|
16
|
+
| `excludeRegex` | RegEx to exclude authors when creating the CODEOWNERS file. | "" |
|
|
17
|
+
| `header` | String inserted in the first line of the CODEOWNERS file as header. | Autogen comment (see code) |
|
|
18
|
+
| `codeownersPath` | Path where to create the CODEOWNERS file. | .gitlab/CODEOWNERS |
|
|
19
|
+
| `limit` | Number of authors obtained from the ranking of authors with the most commits. | 3 |
|
|
20
|
+
| `leaderboard` | Generates the ranking of authors with the most commits and includes it as a comment in the CODEOWNERS file. | true |
|
|
21
|
+
|
|
22
|
+
## Links
|
|
2
23
|
|
|
3
24
|
* [https://semantic-release.gitbook.io/semantic-release/](https://semantic-release.gitbook.io/semantic-release/)
|
|
4
25
|
* [https://semantic-release.gitbook.io/semantic-release/developer-guide/plugin](https://semantic-release.gitbook.io/semantic-release/developer-guide/plugin)
|
package/dist/types.d.ts
CHANGED
package/dist/utils.js
CHANGED
package/dist/verifyConditions.js
CHANGED
|
@@ -9,7 +9,7 @@ export const verifyConditions = async (pluginConfig, { logger }) => {
|
|
|
9
9
|
if (codeownersPath.length == 0 || codeownersPath == "") {
|
|
10
10
|
throw new SemanticReleaseError("codeownersPath plugin config must be a non-empty string");
|
|
11
11
|
}
|
|
12
|
-
await verifyCommand("which", ["git", "touch", "sed", "grep", "head"]);
|
|
12
|
+
await verifyCommand("which", ["git", "touch", "sed", "grep", "head", "sort", "echo"]);
|
|
13
13
|
};
|
|
14
14
|
const verifyCommand = async (command, args) => {
|
|
15
15
|
try {
|
package/dist/verifyRelease.js
CHANGED
|
@@ -2,16 +2,23 @@ import SemanticReleaseError from "@semantic-release/error";
|
|
|
2
2
|
import { execa } from "execa";
|
|
3
3
|
import { getConfig } from "./utils.js";
|
|
4
4
|
export const verifyRelease = async (pluginConfig, { logger }) => {
|
|
5
|
-
const { excludeRegex, codeownersPath, limit, leaderboard } = getConfig(pluginConfig);
|
|
5
|
+
const { excludeRegex, header, codeownersPath, limit, leaderboard } = getConfig(pluginConfig);
|
|
6
6
|
var cmd = "git shortlog -s -e -n --all |";
|
|
7
7
|
if (leaderboard == true) {
|
|
8
8
|
logger.log("Set " + leaderboard + " as leaderboard");
|
|
9
|
-
cmd = "git shortlog -s -e -n --all | sed -e 's/^/# /'
|
|
9
|
+
cmd = "git shortlog -s -e -n --all | sed -e 's/^/# /' >> " + codeownersPath + " && " + cmd;
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
|
-
cmd = "touch " + codeownersPath + " && " + cmd;
|
|
13
12
|
logger.log("Skip leaderboard!");
|
|
14
13
|
}
|
|
14
|
+
if (header.length != 0) {
|
|
15
|
+
logger.log("Set " + header + " as header");
|
|
16
|
+
cmd = "echo '" + header + "' > " + codeownersPath + " && " + cmd;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
logger.log("Skip header!");
|
|
20
|
+
cmd = "touch " + codeownersPath + " && " + cmd;
|
|
21
|
+
}
|
|
15
22
|
if (excludeRegex.length != 0) {
|
|
16
23
|
logger.log("Set " + excludeRegex + " as excludeRegex");
|
|
17
24
|
cmd = cmd + " grep -v -E '" + excludeRegex + "' |";
|
|
@@ -20,8 +27,7 @@ export const verifyRelease = async (pluginConfig, { logger }) => {
|
|
|
20
27
|
logger.log("Skip excludeRegex!");
|
|
21
28
|
}
|
|
22
29
|
logger.log("Set " + limit + " as limit");
|
|
23
|
-
cmd = cmd + " head -" + limit + "
|
|
24
|
-
cmd = "(rm CODEOWNERS " + codeownersPath + " || true) && " + cmd + " sed 's/.*<\\(.*\\)>/\\1/' | sed -e 's/^/* /' >> " + codeownersPath;
|
|
30
|
+
cmd = "(rm CODEOWNERS " + codeownersPath + " || true) && " + cmd + " sed 's/.*<\\(.*\\)>/\\1/' | sed -e 's/^/* /' | sort -u | head -" + limit + " >> " + codeownersPath;
|
|
25
31
|
logger.log("Running cmd: " + cmd);
|
|
26
32
|
await verifyCommand("bash", ["-c", cmd]);
|
|
27
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggioli-rd/sr-codeowners-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Maggioli Semantic Release Plugin: Codeowners",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*"
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@types/semantic-release": "20.0.6",
|
|
41
41
|
"@types/semantic-release__error": "3.0.3",
|
|
42
42
|
"@types/signale": "1.4.7",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "6.18.
|
|
44
|
-
"@typescript-eslint/parser": "6.18.
|
|
45
|
-
"@vitest/coverage-v8": "1.1.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "6.18.1",
|
|
44
|
+
"@typescript-eslint/parser": "6.18.1",
|
|
45
|
+
"@vitest/coverage-v8": "1.1.3",
|
|
46
46
|
"eslint": "8.56.0",
|
|
47
47
|
"eslint-config-prettier": "9.1.0",
|
|
48
48
|
"eslint-config-semistandard": "17.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"eslint-plugin-promise": "6.1.1",
|
|
53
53
|
"semantic-release": "22.0.12",
|
|
54
54
|
"typescript": "5.3.3",
|
|
55
|
-
"vitest": "1.1.
|
|
55
|
+
"vitest": "1.1.3",
|
|
56
56
|
"vitest-mock-extended": "1.3.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|