@maggioli-rd/sr-codeowners-plugin 0.0.1
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 +9 -0
- package/README.md +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +8 -0
- package/dist/verifyConditions.d.ts +3 -0
- package/dist/verifyConditions.js +18 -0
- package/dist/verifyRelease.d.ts +3 -0
- package/dist/verifyRelease.js +35 -0
- package/package.json +66 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# 1.0.0 (2024-1-4)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add ci - trigger first release ([a68438a](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/a68438a1749f870d239fff0ab7528454027c1c63))
|
|
7
|
+
* fix verifyRelease cmd ([502be05](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/502be059899c90554ceb8e9573e255273c73de90))
|
|
8
|
+
* fix verifyRelease cmd ([84d7f66](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/84d7f66ced80a5113dffb3f2ee985d4cfc876ed9))
|
|
9
|
+
* refactor in es typescript module (closes [#1](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/issues/1)) ([8cc2e7f](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/8cc2e7f61cef04763c0438a4494f85e957c0b964))
|
package/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Maggioli Semantic Release Plugin: Codeowners
|
|
2
|
+
|
|
3
|
+
* [https://semantic-release.gitbook.io/semantic-release/](https://semantic-release.gitbook.io/semantic-release/)
|
|
4
|
+
* [https://semantic-release.gitbook.io/semantic-release/developer-guide/plugin](https://semantic-release.gitbook.io/semantic-release/developer-guide/plugin)
|
|
5
|
+
* [https://docs.gitlab.com/ee/user/project/codeowners/](https://docs.gitlab.com/ee/user/project/codeowners/)
|
|
6
|
+
* [https://git-scm.com/docs/git-shortlog](https://git-scm.com/docs/git-shortlog)
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import SemanticReleaseError from "@semantic-release/error";
|
|
2
|
+
import { execa } from "execa";
|
|
3
|
+
import { getConfig } from "./utils.js";
|
|
4
|
+
export const verifyConditions = async (pluginConfig, { logger }) => {
|
|
5
|
+
const { excludeRegex, limit, leaderboard } = getConfig(pluginConfig);
|
|
6
|
+
if (limit < 0) {
|
|
7
|
+
throw new SemanticReleaseError("limit plugin config must be a positive integer");
|
|
8
|
+
}
|
|
9
|
+
await verifyCommand("which git touch sed grep head");
|
|
10
|
+
};
|
|
11
|
+
const verifyCommand = async (command) => {
|
|
12
|
+
try {
|
|
13
|
+
await execa(command);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
throw new SemanticReleaseError(`${command} returned an error: ${error}`);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import SemanticReleaseError from "@semantic-release/error";
|
|
2
|
+
import { execa } from "execa";
|
|
3
|
+
import { getConfig } from "./utils.js";
|
|
4
|
+
export const verifyRelease = async (pluginConfig, { logger }) => {
|
|
5
|
+
const { excludeRegex, limit, leaderboard } = getConfig(pluginConfig);
|
|
6
|
+
var cmd = "git shortlog -s -e -n --all |";
|
|
7
|
+
if (leaderboard == true) {
|
|
8
|
+
logger.log("Set " + leaderboard + " as limit");
|
|
9
|
+
cmd = "git shortlog -s -e -n --all | sed -e 's/^/# /' > CODEOWNERS && " + cmd;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
cmd = "touch CODEOWNERS && " + cmd;
|
|
13
|
+
logger.log("Skip leaderboard!");
|
|
14
|
+
}
|
|
15
|
+
if (excludeRegex.length != 0) {
|
|
16
|
+
logger.log("Set " + excludeRegex + " as excludeRegex");
|
|
17
|
+
cmd = cmd + " grep -v -E '" + excludeRegex + "' |";
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
logger.log("Skip excludeRegex!");
|
|
21
|
+
}
|
|
22
|
+
logger.log("Set " + limit + " as limit");
|
|
23
|
+
cmd = cmd + " head -" + limit + " |";
|
|
24
|
+
cmd = "(rm CODEOWNERS || true) && " + cmd + " sed 's/.*<\\(.*\\)>/\\1/' | sed -e 's/^/* /' >> CODEOWNERS && cat CODEOWNERS";
|
|
25
|
+
logger.log("Running cmd: " + cmd);
|
|
26
|
+
await verifyCommand(cmd);
|
|
27
|
+
};
|
|
28
|
+
const verifyCommand = async (command) => {
|
|
29
|
+
try {
|
|
30
|
+
await execa(command);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw new SemanticReleaseError(`${command} returned an error: ${error}`);
|
|
34
|
+
}
|
|
35
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maggioli-rd/sr-codeowners-plugin",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Maggioli Semantic Release Plugin: Codeowners",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist/*"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"registry": "https://registry.npmjs.org/",
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"maggioli",
|
|
16
|
+
"ricerca-sviluppo",
|
|
17
|
+
"semantic-release",
|
|
18
|
+
"plugin",
|
|
19
|
+
"codeowners"
|
|
20
|
+
],
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin.git"
|
|
24
|
+
},
|
|
25
|
+
"bugs": "https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/issues",
|
|
26
|
+
"homepage": "https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin#readme",
|
|
27
|
+
"author": "Filippo Paganelli <filippo.paganelli@maggioli.it>",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@maggioli-rd/sr-codeowners-plugin": "file:sr-codeowners-plugin.tgz",
|
|
31
|
+
"@semantic-release/error": "4.0.0",
|
|
32
|
+
"execa": "8.0.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@semantic-release/changelog": "6.0.3",
|
|
36
|
+
"@semantic-release/commit-analyzer": "11.1.0",
|
|
37
|
+
"@semantic-release/exec": "6.0.3",
|
|
38
|
+
"@semantic-release/git": "10.0.1",
|
|
39
|
+
"@semantic-release/gitlab": "12.1.1",
|
|
40
|
+
"@types/common-tags": "1.8.4",
|
|
41
|
+
"@types/semantic-release": "20.0.6",
|
|
42
|
+
"@types/semantic-release__error": "3.0.3",
|
|
43
|
+
"@types/signale": "1.4.7",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "6.16.0",
|
|
45
|
+
"@typescript-eslint/parser": "6.16.0",
|
|
46
|
+
"@vitest/coverage-v8": "1.1.0",
|
|
47
|
+
"eslint": "8.56.0",
|
|
48
|
+
"eslint-config-prettier": "9.1.0",
|
|
49
|
+
"eslint-config-semistandard": "17.0.0",
|
|
50
|
+
"eslint-config-standard": "17.1.0",
|
|
51
|
+
"eslint-plugin-import": "2.29.1",
|
|
52
|
+
"eslint-plugin-n": "16.6.0",
|
|
53
|
+
"eslint-plugin-promise": "6.1.1",
|
|
54
|
+
"semantic-release": "22.0.12",
|
|
55
|
+
"typescript": "5.3.3",
|
|
56
|
+
"vitest": "1.1.0",
|
|
57
|
+
"vitest-mock-extended": "1.3.1"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsc",
|
|
61
|
+
"test": "vitest run tests --coverage"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=20.10.0"
|
|
65
|
+
}
|
|
66
|
+
}
|