@code-pushup/cli 0.62.0 → 0.64.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 CHANGED
@@ -303,7 +303,11 @@ Usage:
303
303
  Description:
304
304
  Print the resolved configuration.
305
305
 
306
- Refer to the [Common Command Options](#common-command-options) for the list of available options.
306
+ In addition to the [Common Command Options](#common-command-options), the following options are recognized by the `print-config` command:
307
+
308
+ | Option | Required | Type | Description |
309
+ | -------------- | :------: | -------- | -------------------------------------------------------- |
310
+ | **`--output`** | no | `string` | Path to output file to print config (default is stdout). |
307
311
 
308
312
  ### `merge-diffs` command
309
313
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/cli",
3
- "version": "0.62.0",
3
+ "version": "0.64.0",
4
4
  "license": "MIT",
5
5
  "description": "A CLI to run all kinds of code quality measurements to align your team with company goals",
6
6
  "homepage": "https://code-pushup.dev",
@@ -42,9 +42,9 @@
42
42
  "code-pushup": "./src/index.js"
43
43
  },
44
44
  "dependencies": {
45
- "@code-pushup/models": "0.62.0",
46
- "@code-pushup/core": "0.62.0",
47
- "@code-pushup/utils": "0.62.0",
45
+ "@code-pushup/models": "0.64.0",
46
+ "@code-pushup/core": "0.64.0",
47
+ "@code-pushup/utils": "0.64.0",
48
48
  "yargs": "^17.7.2",
49
49
  "ansis": "^3.3.0",
50
50
  "simple-git": "^3.20.0"
@@ -3,7 +3,7 @@ import { yargsCollectCommandObject } from './collect/collect-command.js';
3
3
  import { yargsCompareCommandObject } from './compare/compare-command.js';
4
4
  import { yargsHistoryCommandObject } from './history/history-command.js';
5
5
  import { yargsMergeDiffsCommandObject } from './merge-diffs/merge-diffs-command.js';
6
- import { yargsConfigCommandObject } from './print-config/print-config-command.js';
6
+ import { yargsPrintConfigCommandObject } from './print-config/print-config-command.js';
7
7
  import { yargsUploadCommandObject } from './upload/upload-command.js';
8
8
  export const commands = [
9
9
  {
@@ -15,7 +15,7 @@ export const commands = [
15
15
  yargsUploadCommandObject(),
16
16
  yargsHistoryCommandObject(),
17
17
  yargsCompareCommandObject(),
18
- yargsConfigCommandObject(),
18
+ yargsPrintConfigCommandObject(),
19
19
  yargsMergeDiffsCommandObject(),
20
20
  ];
21
21
  //# sourceMappingURL=commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../../packages/cli/src/lib/commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,CAAC,MAAM,QAAQ,GAAoB;IACvC;QACE,GAAG,yBAAyB,EAAE;QAC9B,OAAO,EAAE,GAAG;KACb;IACD,yBAAyB,EAAE;IAC3B,yBAAyB,EAAE;IAC3B,wBAAwB,EAAE;IAC1B,yBAAyB,EAAE;IAC3B,yBAAyB,EAAE;IAC3B,wBAAwB,EAAE;IAC1B,4BAA4B,EAAE;CAC/B,CAAC"}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../../packages/cli/src/lib/commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,CAAC,MAAM,QAAQ,GAAoB;IACvC;QACE,GAAG,yBAAyB,EAAE;QAC9B,OAAO,EAAE,GAAG;KACb;IACD,yBAAyB,EAAE;IAC3B,yBAAyB,EAAE;IAC3B,wBAAwB,EAAE;IAC1B,yBAAyB,EAAE;IAC3B,yBAAyB,EAAE;IAC3B,6BAA6B,EAAE;IAC/B,4BAA4B,EAAE;CAC/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type PrintConfigOptions = {
2
+ output?: string;
3
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=print-config.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-config.model.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/print-config.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { Options } from 'yargs';
2
+ import type { PrintConfigOptions } from './print-config.model.js';
3
+ export declare function yargsPrintConfigOptionsDefinition(): Record<keyof PrintConfigOptions, Options>;
@@ -0,0 +1,9 @@
1
+ export function yargsPrintConfigOptionsDefinition() {
2
+ return {
3
+ output: {
4
+ describe: 'Output file path to use instead of stdout',
5
+ type: 'string',
6
+ },
7
+ };
8
+ }
9
+ //# sourceMappingURL=print-config.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-config.options.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/print-config.options.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,iCAAiC;IAI/C,OAAO;QACL,MAAM,EAAE;YACN,QAAQ,EAAE,2CAA2C;YACrD,IAAI,EAAE,QAAQ;SACf;KACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
- export declare function yargsConfigCommandObject(): {
1
+ export declare function yargsPrintConfigCommandObject(): {
2
2
  command: string;
3
3
  describe: string;
4
- handler: (yargsArgs: import("yargs").ArgumentsCamelCase<{}>) => void;
4
+ builder: Record<"output", import("yargs").Options>;
5
+ handler: (yargsArgs: import("yargs").ArgumentsCamelCase<{}>) => Promise<void>;
5
6
  };
@@ -1,16 +1,29 @@
1
+ import { bold } from 'ansis';
2
+ import { mkdir, writeFile } from 'node:fs/promises';
3
+ import path from 'node:path';
1
4
  import { ui } from '@code-pushup/utils';
2
5
  import { filterKebabCaseKeys } from '../implementation/global.utils.js';
3
- export function yargsConfigCommandObject() {
6
+ import { yargsPrintConfigOptionsDefinition } from '../implementation/print-config.options.js';
7
+ export function yargsPrintConfigCommandObject() {
4
8
  const command = 'print-config';
5
9
  return {
6
10
  command,
7
11
  describe: 'Print config',
8
- handler: yargsArgs => {
9
- const { _, $0, ...args } = yargsArgs;
12
+ builder: yargsPrintConfigOptionsDefinition(),
13
+ handler: async (yargsArgs) => {
10
14
  // it is important to filter out kebab case keys
11
15
  // because yargs duplicates options in camel case and kebab case
12
- const cleanArgs = filterKebabCaseKeys(args);
13
- ui().logger.log(JSON.stringify(cleanArgs, null, 2));
16
+ const { _, $0, ...args } = filterKebabCaseKeys(yargsArgs);
17
+ const { output, ...config } = args;
18
+ const content = JSON.stringify(config, null, 2);
19
+ if (output) {
20
+ await mkdir(path.dirname(output), { recursive: true });
21
+ await writeFile(output, content);
22
+ ui().logger.info(`Config printed to file ${bold(output)}`);
23
+ }
24
+ else {
25
+ ui().logger.log(content);
26
+ }
14
27
  },
15
28
  };
16
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"print-config-command.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/print-config/print-config-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,UAAU,wBAAwB;IACtC,MAAM,OAAO,GAAG,cAAc,CAAC;IAC/B,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,SAAS,CAAC,EAAE;YACnB,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC;YACrC,gDAAgD;YAChD,gEAAgE;YAChE,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC5C,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC;KACsB,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"file":"print-config-command.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/print-config/print-config-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAE9F,MAAM,UAAU,6BAA6B;IAC3C,MAAM,OAAO,GAAG,cAAc,CAAC;IAC/B,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,iCAAiC,EAAE;QAC5C,OAAO,EAAE,KAAK,EAAC,SAAS,EAAC,EAAE;YACzB,gDAAgD;YAChD,gEAAgE;YAChE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,IACL,CAAC;YAE1B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAEhD,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvD,MAAM,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACjC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACsB,CAAC;AAC5B,CAAC"}