@maggioli-rd/sr-codeowners-plugin 1.1.1 → 1.2.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [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
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * typo cmd string concat codeownersPath ([032625f](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/032625f66a9a369946f9552e644acbc6d15b4525))
7
+
8
+ # [1.2.0](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/compare/v1.1.1...v1.2.0) (2024-1-9)
9
+
10
+
11
+ ### Features
12
+
13
+ * add codeownersPath config ([01e7c4f](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/commit/01e7c4f2ff32e44fca777ce32a568aa56c470adf))
14
+
1
15
  ## [1.1.1](https://gitlab.com/maggiolispa/ricerca-sviluppo/semantic-release-shareable-configurations/sr-codeowners-plugin/compare/v1.1.0...v1.1.1) (2024-01-09)
2
16
 
3
17
 
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type PluginConfig = {
2
2
  excludeRegex: string;
3
+ codeownersPath: string;
3
4
  limit: number;
4
5
  leaderboard: boolean;
5
6
  };
package/dist/utils.js CHANGED
@@ -1,7 +1,8 @@
1
1
  const DEFAULT_CONFIG = {
2
2
  excludeRegex: "",
3
+ codeownersPath: ".gitlab/CODEOWNERS",
3
4
  limit: 3,
4
- leaderboard: true,
5
+ leaderboard: true
5
6
  };
6
7
  export const getConfig = (config) => {
7
8
  return { ...DEFAULT_CONFIG, ...config };
@@ -2,10 +2,13 @@ import SemanticReleaseError from "@semantic-release/error";
2
2
  import { execa } from "execa";
3
3
  import { getConfig } from "./utils.js";
4
4
  export const verifyConditions = async (pluginConfig, { logger }) => {
5
- const { excludeRegex, limit, leaderboard } = getConfig(pluginConfig);
5
+ const { excludeRegex, codeownersPath, limit, leaderboard } = getConfig(pluginConfig);
6
6
  if (limit < 0) {
7
7
  throw new SemanticReleaseError("limit plugin config must be a positive integer");
8
8
  }
9
+ if (codeownersPath.length == 0 || codeownersPath == "") {
10
+ throw new SemanticReleaseError("codeownersPath plugin config must be a non-empty string");
11
+ }
9
12
  await verifyCommand("which", ["git", "touch", "sed", "grep", "head"]);
10
13
  };
11
14
  const verifyCommand = async (command, args) => {
@@ -2,14 +2,14 @@ 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, limit, leaderboard } = getConfig(pluginConfig);
5
+ const { excludeRegex, 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/^/# /' > CODEOWNERS && " + cmd;
9
+ cmd = "git shortlog -s -e -n --all | sed -e 's/^/# /' > " + codeownersPath + " && " + cmd;
10
10
  }
11
11
  else {
12
- cmd = "touch CODEOWNERS && " + cmd;
12
+ cmd = "touch " + codeownersPath + " && " + cmd;
13
13
  logger.log("Skip leaderboard!");
14
14
  }
15
15
  if (excludeRegex.length != 0) {
@@ -21,7 +21,7 @@ export const verifyRelease = async (pluginConfig, { logger }) => {
21
21
  }
22
22
  logger.log("Set " + limit + " as limit");
23
23
  cmd = cmd + " head -" + limit + " |";
24
- cmd = "(rm CODEOWNERS || true) && " + cmd + " sed 's/.*<\\(.*\\)>/\\1/' | sed -e 's/^/* /' >> CODEOWNERS && cat CODEOWNERS";
24
+ cmd = "(rm CODEOWNERS " + codeownersPath + " || true) && " + cmd + " sed 's/.*<\\(.*\\)>/\\1/' | sed -e 's/^/* /' >> " + codeownersPath;
25
25
  logger.log("Running cmd: " + cmd);
26
26
  await verifyCommand("bash", ["-c", cmd]);
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-rd/sr-codeowners-plugin",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "Maggioli Semantic Release Plugin: Codeowners",
5
5
  "files": [
6
6
  "dist/*"