@tahminator/pipeline 1.0.21 → 1.0.22

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.
@@ -4,23 +4,53 @@ type SonarScannerOpts = {
4
4
  token: string;
5
5
  };
6
6
  run: {
7
+ /**
8
+ * Pass in a Bun command
9
+ *
10
+ * @example
11
+ * ```
12
+ * new SonarScannerClient({
13
+ * run: {
14
+ * runTestsCmd: $`./mvnw clean verify -Dspring.profiles.active=ci`
15
+ * }
16
+ * })
17
+ * ```
18
+ */
7
19
  runTestsCmd: $.ShellPromise;
8
20
  };
9
21
  scan: {
10
22
  hostUrl?: string;
23
+ /**
24
+ * All args will be formated into `-Dsonar.${key}=${value}`
25
+ */
11
26
  additionalArgs?: Record<string, string | number | boolean>;
12
27
  projectKey: string;
13
28
  organization: string;
29
+ /**
30
+ * Point this at where your source code files reside. e.g. `src/` or `src/java`
31
+ */
14
32
  sourceCodeDir: string;
15
33
  };
16
34
  };
17
35
  /**
18
- * @beta WIP
36
+ * Provides a unified way to run tests & upload test coverage to a SonarQube instance.
37
+ *
38
+ * This client can be used to wire up test coverage for any language & environment; essentially, if SonarQube
39
+ * supports it, this client can do it.
19
40
  */
20
41
  export declare class SonarScannerClient {
21
42
  private readonly opts;
43
+ /**
44
+ * Get `token`, `projectKey` & `organization` from https://sonarcloud.io/project/configuration/GitHubManual?id=<project_name>
45
+ */
22
46
  constructor(opts: SonarScannerOpts);
47
+ /**
48
+ * Runs `opts.run.runTestsCmd`
49
+ */
23
50
  runTests(): Promise<void>;
24
- uploadTests(): Promise<void>;
51
+ /**
52
+ * Upload test coverage to SonarQube.
53
+ */
54
+ uploadTestCoverage(): Promise<void>;
25
55
  }
26
56
  export {};
@@ -1,17 +1,29 @@
1
1
  import { $ } from "bun";
2
2
  import { isCmdAvailable } from "../utils/cmd";
3
3
  /**
4
- * @beta WIP
4
+ * Provides a unified way to run tests & upload test coverage to a SonarQube instance.
5
+ *
6
+ * This client can be used to wire up test coverage for any language & environment; essentially, if SonarQube
7
+ * supports it, this client can do it.
5
8
  */
6
9
  export class SonarScannerClient {
7
10
  opts;
11
+ /**
12
+ * Get `token`, `projectKey` & `organization` from https://sonarcloud.io/project/configuration/GitHubManual?id=<project_name>
13
+ */
8
14
  constructor(opts) {
9
15
  this.opts = opts;
10
16
  }
17
+ /**
18
+ * Runs `opts.run.runTestsCmd`
19
+ */
11
20
  async runTests() {
12
21
  await this.opts.run.runTestsCmd;
13
22
  }
14
- async uploadTests() {
23
+ /**
24
+ * Upload test coverage to SonarQube.
25
+ */
26
+ async uploadTestCoverage() {
15
27
  if (!(await isCmdAvailable("sonar"))) {
16
28
  console.log("Sonar is missing, installing globally via NPM...");
17
29
  await $ `npm i -g @sonar/scan`;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "author": "Tahmid Ahmed",
5
5
  "description": "A collection of Bun shell scripts that can be re-used in various CICD pipelines.",
6
- "version": "1.0.21",
6
+ "version": "1.0.22",
7
7
  "repository": {
8
8
  "url": "git+https://github.com/tahminator/pipeline.git"
9
9
  },