@code-pushup/cli 0.56.0 → 0.58.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/package.json +10 -9
- package/src/index.js +6 -0
- package/src/index.js.map +1 -0
- package/src/lib/autorun/autorun-command.js +43 -0
- package/src/lib/autorun/autorun-command.js.map +1 -0
- package/src/lib/cli.js +40 -0
- package/src/lib/cli.js.map +1 -0
- package/src/lib/collect/collect-command.js +38 -0
- package/src/lib/collect/collect-command.js.map +1 -0
- package/src/lib/commands.js +21 -0
- package/src/lib/commands.js.map +1 -0
- package/src/lib/compare/compare-command.d.ts +1 -1
- package/src/lib/compare/compare-command.js +24 -0
- package/src/lib/compare/compare-command.js.map +1 -0
- package/src/lib/constants.js +3 -0
- package/src/lib/constants.js.map +1 -0
- package/src/lib/history/history-command.js +50 -0
- package/src/lib/history/history-command.js.map +1 -0
- package/src/lib/history/history.model.js +2 -0
- package/src/lib/history/history.model.js.map +1 -0
- package/src/lib/history/history.options.d.ts +1 -1
- package/src/lib/history/history.options.js +41 -0
- package/src/lib/history/history.options.js.map +1 -0
- package/src/lib/history/utils.d.ts +1 -1
- package/src/lib/history/utils.js +27 -0
- package/src/lib/history/utils.js.map +1 -0
- package/src/lib/implementation/compare.model.js +2 -0
- package/src/lib/implementation/compare.model.js.map +1 -0
- package/src/lib/implementation/compare.options.d.ts +1 -1
- package/src/lib/implementation/compare.options.js +19 -0
- package/src/lib/implementation/compare.options.js.map +1 -0
- package/src/lib/implementation/core-config.middleware.d.ts +3 -3
- package/src/lib/implementation/core-config.middleware.js +31 -0
- package/src/lib/implementation/core-config.middleware.js.map +1 -0
- package/src/lib/implementation/core-config.model.js +2 -0
- package/src/lib/implementation/core-config.model.js.map +1 -0
- package/src/lib/implementation/core-config.options.d.ts +1 -1
- package/src/lib/implementation/core-config.options.js +43 -0
- package/src/lib/implementation/core-config.options.js.map +1 -0
- package/src/lib/implementation/filter.middleware.d.ts +4 -1
- package/src/lib/implementation/filter.middleware.js +81 -0
- package/src/lib/implementation/filter.middleware.js.map +1 -0
- package/src/lib/implementation/filter.middleware.utils.d.ts +11 -0
- package/src/lib/implementation/filter.middleware.utils.js +41 -0
- package/src/lib/implementation/filter.middleware.utils.js.map +1 -0
- package/src/lib/implementation/filter.model.js +2 -0
- package/src/lib/implementation/filter.model.js.map +1 -0
- package/src/lib/implementation/filter.options.d.ts +1 -1
- package/src/lib/implementation/filter.options.js +36 -0
- package/src/lib/implementation/filter.options.js.map +1 -0
- package/src/lib/implementation/formatting.js +26 -0
- package/src/lib/implementation/formatting.js.map +1 -0
- package/src/lib/implementation/global.model.d.ts +1 -1
- package/src/lib/implementation/global.model.js +2 -0
- package/src/lib/implementation/global.model.js.map +1 -0
- package/src/lib/implementation/global.options.d.ts +1 -1
- package/src/lib/implementation/global.options.js +23 -0
- package/src/lib/implementation/global.options.js.map +1 -0
- package/src/lib/implementation/global.utils.js +45 -0
- package/src/lib/implementation/global.utils.js.map +1 -0
- package/src/lib/implementation/logging.js +24 -0
- package/src/lib/implementation/logging.js.map +1 -0
- package/src/lib/implementation/merge-diffs.model.js +2 -0
- package/src/lib/implementation/merge-diffs.model.js.map +1 -0
- package/src/lib/implementation/merge-diffs.options.d.ts +1 -1
- package/src/lib/implementation/merge-diffs.options.js +10 -0
- package/src/lib/implementation/merge-diffs.options.js.map +1 -0
- package/src/lib/implementation/validate-filter-options.utils.d.ts +7 -4
- package/src/lib/implementation/validate-filter-options.utils.js +119 -0
- package/src/lib/implementation/validate-filter-options.utils.js.map +1 -0
- package/src/lib/merge-diffs/merge-diffs-command.js +22 -0
- package/src/lib/merge-diffs/merge-diffs-command.js.map +1 -0
- package/src/lib/middlewares.js +13 -0
- package/src/lib/middlewares.js.map +1 -0
- package/src/lib/options.d.ts +1 -1
- package/src/lib/options.js +17 -0
- package/src/lib/options.js.map +1 -0
- package/src/lib/print-config/print-config-command.js +17 -0
- package/src/lib/print-config/print-config-command.js.map +1 -0
- package/src/lib/upload/upload-command.js +26 -0
- package/src/lib/upload/upload-command.js.map +1 -0
- package/src/lib/yargs-cli.js +105 -0
- package/src/lib/yargs-cli.js.map +1 -0
- package/index.js +0 -4262
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.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",
|
|
@@ -38,17 +38,18 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"type": "module",
|
|
41
|
-
"main": "./index.js",
|
|
42
|
-
"types": "./src/index.d.ts",
|
|
43
41
|
"bin": {
|
|
44
|
-
"code-pushup": "index.js"
|
|
42
|
+
"code-pushup": "./src/index.js"
|
|
45
43
|
},
|
|
46
44
|
"dependencies": {
|
|
47
|
-
"@code-pushup/models": "0.
|
|
48
|
-
"@code-pushup/core": "0.
|
|
49
|
-
"@code-pushup/utils": "0.
|
|
45
|
+
"@code-pushup/models": "0.58.0",
|
|
46
|
+
"@code-pushup/core": "0.58.0",
|
|
47
|
+
"@code-pushup/utils": "0.58.0",
|
|
50
48
|
"yargs": "^17.7.2",
|
|
51
49
|
"ansis": "^3.3.0",
|
|
52
50
|
"simple-git": "^3.20.0"
|
|
53
|
-
}
|
|
54
|
-
|
|
51
|
+
},
|
|
52
|
+
"module": "./src/index.js",
|
|
53
|
+
"main": "./src/index.js",
|
|
54
|
+
"types": "./src/index.d.ts"
|
|
55
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/cli/src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,uDAAuD;AACvD,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { bold, gray } from 'ansis';
|
|
2
|
+
import { collectAndPersistReports, upload, } from '@code-pushup/core';
|
|
3
|
+
import { ui } from '@code-pushup/utils';
|
|
4
|
+
import { CLI_NAME } from '../constants.js';
|
|
5
|
+
import { collectSuccessfulLog, renderConfigureCategoriesHint, renderIntegratePortalHint, uploadSuccessfulLog, } from '../implementation/logging.js';
|
|
6
|
+
export function yargsAutorunCommandObject() {
|
|
7
|
+
const command = 'autorun';
|
|
8
|
+
return {
|
|
9
|
+
command,
|
|
10
|
+
describe: 'Shortcut for running collect followed by upload',
|
|
11
|
+
handler: async (args) => {
|
|
12
|
+
ui().logger.log(bold(CLI_NAME));
|
|
13
|
+
ui().logger.info(gray(`Run ${command}...`));
|
|
14
|
+
const options = args;
|
|
15
|
+
// we need to ensure `json` is part of the formats as we want to upload
|
|
16
|
+
const optionsWithFormat = {
|
|
17
|
+
...options,
|
|
18
|
+
persist: {
|
|
19
|
+
...options.persist,
|
|
20
|
+
format: [
|
|
21
|
+
...new Set([...options.persist.format, 'json']),
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
await collectAndPersistReports(optionsWithFormat);
|
|
26
|
+
collectSuccessfulLog();
|
|
27
|
+
if (!options.categories || options.categories.length === 0) {
|
|
28
|
+
renderConfigureCategoriesHint();
|
|
29
|
+
}
|
|
30
|
+
if (options.upload) {
|
|
31
|
+
const report = await upload(options);
|
|
32
|
+
if (report?.url) {
|
|
33
|
+
uploadSuccessfulLog(report.url);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
ui().logger.warning('Upload skipped because configuration is not set.');
|
|
38
|
+
renderIntegratePortalHint();
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=autorun-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autorun-command.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/autorun/autorun-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAGL,wBAAwB,EACxB,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAItC,MAAM,UAAU,yBAAyB;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,iDAAiD;QAC3D,OAAO,EAAE,KAAK,EAAK,IAA2B,EAAE,EAAE;YAChD,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,IAAiC,CAAC;YAElD,uEAAuE;YACvE,MAAM,iBAAiB,GAAmB;gBACxC,GAAG,OAAO;gBACV,OAAO,EAAE;oBACP,GAAG,OAAO,CAAC,OAAO;oBAClB,MAAM,EAAE;wBACN,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;qBACT;iBACzC;aACF,CAAC;YAEF,MAAM,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;YAClD,oBAAoB,EAAE,CAAC;YAEvB,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3D,6BAA6B,EAAE,CAAC;YAClC,CAAC;YAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;gBACrC,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC;oBAChB,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;gBACxE,yBAAyB,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC;KACsB,CAAC;AAC5B,CAAC"}
|
package/src/lib/cli.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { commands } from './commands.js';
|
|
2
|
+
import { CLI_NAME, CLI_SCRIPT_NAME } from './constants.js';
|
|
3
|
+
import { middlewares } from './middlewares.js';
|
|
4
|
+
import { groups, options } from './options.js';
|
|
5
|
+
import { yargsCli } from './yargs-cli.js';
|
|
6
|
+
export const cli = (args) => yargsCli(args, {
|
|
7
|
+
usageMessage: CLI_NAME,
|
|
8
|
+
scriptName: CLI_SCRIPT_NAME,
|
|
9
|
+
options,
|
|
10
|
+
groups,
|
|
11
|
+
examples: [
|
|
12
|
+
[
|
|
13
|
+
'code-pushup',
|
|
14
|
+
'Run collect followed by upload based on configuration from code-pushup.config.* file.',
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
'code-pushup collect --tsconfig=tsconfig.base.json',
|
|
18
|
+
'Run collect using custom tsconfig to parse code-pushup.config.ts file.',
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
'code-pushup collect --onlyPlugins=coverage',
|
|
22
|
+
'Run collect with only coverage plugin, other plugins from config file will be skipped.',
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
'code-pushup collect --skipPlugins=coverage',
|
|
26
|
+
'Run collect skiping the coverage plugin, other plugins from config file will be included.',
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
'code-pushup upload --persist.outputDir=dist --upload.apiKey=$CP_API_KEY',
|
|
30
|
+
'Upload dist/report.json to portal using API key from environment variable',
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
'code-pushup print-config --config code-pushup.config.test.js',
|
|
34
|
+
'Print resolved config object parsed from custom config location',
|
|
35
|
+
],
|
|
36
|
+
],
|
|
37
|
+
middlewares,
|
|
38
|
+
commands,
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../../packages/cli/src/lib/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAc,EAAE,EAAE,CACpC,QAAQ,CAAC,IAAI,EAAE;IACb,YAAY,EAAE,QAAQ;IACtB,UAAU,EAAE,eAAe;IAC3B,OAAO;IACP,MAAM;IACN,QAAQ,EAAE;QACR;YACE,aAAa;YACb,uFAAuF;SACxF;QACD;YACE,mDAAmD;YACnD,wEAAwE;SACzE;QACD;YACE,4CAA4C;YAC5C,wFAAwF;SACzF;QACD;YACE,4CAA4C;YAC5C,2FAA2F;SAC5F;QACD;YACE,yEAAyE;YACzE,2EAA2E;SAC5E;QACD;YACE,8DAA8D;YAC9D,iEAAiE;SAClE;KACF;IACD,WAAW;IACX,QAAQ;CACT,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { bold, gray } from 'ansis';
|
|
2
|
+
import { collectAndPersistReports, } from '@code-pushup/core';
|
|
3
|
+
import { link, ui } from '@code-pushup/utils';
|
|
4
|
+
import { CLI_NAME } from '../constants.js';
|
|
5
|
+
import { collectSuccessfulLog, renderConfigureCategoriesHint, } from '../implementation/logging.js';
|
|
6
|
+
export function yargsCollectCommandObject() {
|
|
7
|
+
const command = 'collect';
|
|
8
|
+
return {
|
|
9
|
+
command,
|
|
10
|
+
describe: 'Run Plugins and collect results',
|
|
11
|
+
handler: async (args) => {
|
|
12
|
+
const options = args;
|
|
13
|
+
ui().logger.log(bold(CLI_NAME));
|
|
14
|
+
ui().logger.info(gray(`Run ${command}...`));
|
|
15
|
+
await collectAndPersistReports(options);
|
|
16
|
+
collectSuccessfulLog();
|
|
17
|
+
if (!options.categories || options.categories.length === 0) {
|
|
18
|
+
renderConfigureCategoriesHint();
|
|
19
|
+
}
|
|
20
|
+
const { upload = {} } = args;
|
|
21
|
+
if (Object.keys(upload).length === 0) {
|
|
22
|
+
renderUploadAutorunHint();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function renderUploadAutorunHint() {
|
|
28
|
+
ui()
|
|
29
|
+
.sticker()
|
|
30
|
+
.add(bold.gray('💡 Visualize your reports'))
|
|
31
|
+
.add('')
|
|
32
|
+
.add(`${gray('❯')} npx code-pushup upload - ${gray('Run upload to upload the created report to the server')}`)
|
|
33
|
+
.add(` ${link('https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command')}`)
|
|
34
|
+
.add(`${gray('❯')} npx code-pushup autorun - ${gray('Run collect & upload')}`)
|
|
35
|
+
.add(` ${link('https://github.com/code-pushup/cli/tree/main/packages/cli#autorun-command')}`)
|
|
36
|
+
.render();
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=collect-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-command.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/collect/collect-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAEL,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,MAAM,UAAU,yBAAyB;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,iCAAiC;QAC3C,OAAO,EAAE,KAAK,EAAK,IAA2B,EAAE,EAAE;YAChD,MAAM,OAAO,GAAG,IAAkD,CAAC;YACnE,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC;YAE5C,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC;YACxC,oBAAoB,EAAE,CAAC;YAEvB,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3D,6BAA6B,EAAE,CAAC;YAClC,CAAC;YAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,IAGvB,CAAC;YACF,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrC,uBAAuB,EAAE,CAAC;YAC5B,CAAC;QACH,CAAC;KACsB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,EAAE,EAAE;SACD,OAAO,EAAE;SACT,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;SAC3C,GAAG,CAAC,EAAE,CAAC;SACP,GAAG,CACF,GAAG,IAAI,CAAC,GAAG,CAAC,6BAA6B,IAAI,CAC3C,uDAAuD,CACxD,EAAE,CACJ;SACA,GAAG,CACF,KAAK,IAAI,CACP,0EAA0E,CAC3E,EAAE,CACJ;SACA,GAAG,CACF,GAAG,IAAI,CAAC,GAAG,CAAC,8BAA8B,IAAI,CAAC,sBAAsB,CAAC,EAAE,CACzE;SACA,GAAG,CACF,KAAK,IAAI,CACP,2EAA2E,CAC5E,EAAE,CACJ;SACA,MAAM,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { yargsAutorunCommandObject } from './autorun/autorun-command.js';
|
|
2
|
+
import { yargsCollectCommandObject } from './collect/collect-command.js';
|
|
3
|
+
import { yargsCompareCommandObject } from './compare/compare-command.js';
|
|
4
|
+
import { yargsHistoryCommandObject } from './history/history-command.js';
|
|
5
|
+
import { yargsMergeDiffsCommandObject } from './merge-diffs/merge-diffs-command.js';
|
|
6
|
+
import { yargsConfigCommandObject } from './print-config/print-config-command.js';
|
|
7
|
+
import { yargsUploadCommandObject } from './upload/upload-command.js';
|
|
8
|
+
export const commands = [
|
|
9
|
+
{
|
|
10
|
+
...yargsAutorunCommandObject(),
|
|
11
|
+
command: '*',
|
|
12
|
+
},
|
|
13
|
+
yargsAutorunCommandObject(),
|
|
14
|
+
yargsCollectCommandObject(),
|
|
15
|
+
yargsUploadCommandObject(),
|
|
16
|
+
yargsHistoryCommandObject(),
|
|
17
|
+
yargsCompareCommandObject(),
|
|
18
|
+
yargsConfigCommandObject(),
|
|
19
|
+
yargsMergeDiffsCommandObject(),
|
|
20
|
+
];
|
|
21
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +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,6 +1,6 @@
|
|
|
1
1
|
export declare function yargsCompareCommandObject(): {
|
|
2
2
|
command: string;
|
|
3
3
|
describe: string;
|
|
4
|
-
builder: Record<
|
|
4
|
+
builder: Record<keyof import("@code-pushup/utils").Diff<string> | "label", import("yargs").Options>;
|
|
5
5
|
handler: (args: unknown) => Promise<void>;
|
|
6
6
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { bold, gray } from 'ansis';
|
|
2
|
+
import { compareReportFiles } from '@code-pushup/core';
|
|
3
|
+
import { ui } from '@code-pushup/utils';
|
|
4
|
+
import { CLI_NAME } from '../constants.js';
|
|
5
|
+
import { yargsCompareOptionsDefinition } from '../implementation/compare.options.js';
|
|
6
|
+
export function yargsCompareCommandObject() {
|
|
7
|
+
const command = 'compare';
|
|
8
|
+
return {
|
|
9
|
+
command,
|
|
10
|
+
describe: 'Compare 2 report files and create a diff file',
|
|
11
|
+
builder: yargsCompareOptionsDefinition(),
|
|
12
|
+
handler: async (args) => {
|
|
13
|
+
ui().logger.log(bold(CLI_NAME));
|
|
14
|
+
ui().logger.info(gray(`Run ${command}...`));
|
|
15
|
+
const options = args;
|
|
16
|
+
const { before, after, label, persist, upload } = options;
|
|
17
|
+
const outputPaths = await compareReportFiles({ before, after }, persist, upload, label);
|
|
18
|
+
ui().logger.info(`Reports diff written to ${outputPaths
|
|
19
|
+
.map(path => bold(path))
|
|
20
|
+
.join(' and ')}`);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=compare-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare-command.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/compare/compare-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AAErF,MAAM,UAAU,yBAAyB;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,+CAA+C;QACzD,OAAO,EAAE,6BAA6B,EAAE;QACxC,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;YAC/B,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC;YAE5C,MAAM,OAAO,GAAG,IAGf,CAAC;YAEF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAE1D,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAC1C,EAAE,MAAM,EAAE,KAAK,EAAE,EACjB,OAAO,EACP,MAAM,EACN,KAAK,CACN,CAAC;YAEF,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CACd,2BAA2B,WAAW;iBACnC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACvB,IAAI,CAAC,OAAO,CAAC,EAAE,CACnB,CAAC;QACJ,CAAC;KACsB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/cli/src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { bold, gray } from 'ansis';
|
|
2
|
+
import { history } from '@code-pushup/core';
|
|
3
|
+
import { getCurrentBranchOrTag, getHashes, getSemverTags, safeCheckout, ui, } from '@code-pushup/utils';
|
|
4
|
+
import { CLI_NAME } from '../constants.js';
|
|
5
|
+
import { yargsFilterOptionsDefinition } from '../implementation/filter.options.js';
|
|
6
|
+
import { yargsHistoryOptionsDefinition } from './history.options.js';
|
|
7
|
+
import { normalizeHashOptions } from './utils.js';
|
|
8
|
+
const command = 'history';
|
|
9
|
+
async function handler(args) {
|
|
10
|
+
ui().logger.info(bold(CLI_NAME));
|
|
11
|
+
ui().logger.info(gray(`Run ${command}`));
|
|
12
|
+
const currentBranch = await getCurrentBranchOrTag();
|
|
13
|
+
const { targetBranch: rawTargetBranch, ...opt } = args;
|
|
14
|
+
const { targetBranch, from, to, maxCount, onlySemverTags, ...historyOptions } = await normalizeHashOptions({
|
|
15
|
+
...opt,
|
|
16
|
+
targetBranch: rawTargetBranch ?? currentBranch,
|
|
17
|
+
});
|
|
18
|
+
const filterOptions = { targetBranch, from, to, maxCount };
|
|
19
|
+
const results = onlySemverTags
|
|
20
|
+
? await getSemverTags(filterOptions)
|
|
21
|
+
: await getHashes(filterOptions);
|
|
22
|
+
try {
|
|
23
|
+
// run history logic
|
|
24
|
+
const reports = await history({
|
|
25
|
+
targetBranch,
|
|
26
|
+
...historyOptions,
|
|
27
|
+
}, results.map(({ hash }) => hash));
|
|
28
|
+
ui().logger.log(`Reports: ${reports.length}`);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
// go back to initial branch
|
|
32
|
+
await safeCheckout(currentBranch);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function yargsHistoryCommandObject() {
|
|
36
|
+
return {
|
|
37
|
+
command,
|
|
38
|
+
describe: 'Collect reports for commit history',
|
|
39
|
+
builder: yargs => {
|
|
40
|
+
yargs.options({
|
|
41
|
+
...yargsHistoryOptionsDefinition(),
|
|
42
|
+
...yargsFilterOptionsDefinition(),
|
|
43
|
+
});
|
|
44
|
+
yargs.group(Object.keys(yargsHistoryOptionsDefinition()), 'History Options:');
|
|
45
|
+
return yargs;
|
|
46
|
+
},
|
|
47
|
+
handler,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=history-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-command.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/history/history-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAuB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,EAAE,GACH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,OAAO,GAAG,SAAS,CAAC;AAC1B,KAAK,UAAU,OAAO,CAAC,IAAa;IAClC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC;IAEzC,MAAM,aAAa,GAAG,MAAM,qBAAqB,EAAE,CAAC;IACpD,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,GAAG,EAAE,GAAG,IAClC,CAAC;IACjB,MAAM,EACJ,YAAY,EACZ,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,cAAc,EACd,GAAG,cAAc,EAClB,GAAG,MAAM,oBAAoB,CAAC;QAC7B,GAAG,GAAG;QACN,YAAY,EAAE,eAAe,IAAI,aAAa;KAC/C,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IAC3D,MAAM,OAAO,GAAgB,cAAc;QACzC,CAAC,CAAC,MAAM,aAAa,CAAC,aAAa,CAAC;QACpC,CAAC,CAAC,MAAM,SAAS,CAAC,aAAa,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,oBAAoB;QACpB,MAAM,OAAO,GAAG,MAAM,OAAO,CAC3B;YACE,YAAY;YACZ,GAAG,cAAc;SAClB,EACD,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAChC,CAAC;QAEF,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;YAAS,CAAC;QACT,4BAA4B;QAC5B,MAAM,YAAY,CAAC,aAAa,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,oCAAoC;QAC9C,OAAO,EAAE,KAAK,CAAC,EAAE;YACf,KAAK,CAAC,OAAO,CAAC;gBACZ,GAAG,6BAA6B,EAAE;gBAClC,GAAG,4BAA4B,EAAE;aAClC,CAAC,CAAC;YACH,KAAK,CAAC,KAAK,CACT,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,CAAC,EAC5C,kBAAkB,CACnB,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO;KACgB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.model.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/history/history.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function yargsHistoryOptionsDefinition() {
|
|
2
|
+
return {
|
|
3
|
+
targetBranch: {
|
|
4
|
+
describe: 'Branch to crawl history',
|
|
5
|
+
type: 'string',
|
|
6
|
+
},
|
|
7
|
+
onlySemverTags: {
|
|
8
|
+
describe: 'Skip commits not tagged with a semantic version',
|
|
9
|
+
type: 'boolean',
|
|
10
|
+
default: false,
|
|
11
|
+
},
|
|
12
|
+
forceCleanStatus: {
|
|
13
|
+
describe: 'If we reset the status to a clean git history forcefully or not.',
|
|
14
|
+
type: 'boolean',
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
skipUploads: {
|
|
18
|
+
describe: 'Upload created reports',
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
maxCount: {
|
|
23
|
+
// https://git-scm.com/docs/git-log#Documentation/git-log.txt---max-countltnumbergt
|
|
24
|
+
describe: 'Number of steps in history',
|
|
25
|
+
type: 'number',
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
27
|
+
default: 5,
|
|
28
|
+
},
|
|
29
|
+
from: {
|
|
30
|
+
// https://git-scm.com/docs/git-log#Documentation/git-log.txt-ltrevision-rangegt
|
|
31
|
+
describe: 'hash to first commit in history',
|
|
32
|
+
type: 'string',
|
|
33
|
+
},
|
|
34
|
+
to: {
|
|
35
|
+
// https://git-scm.com/docs/git-log#Documentation/git-log.txt-ltrevision-rangegt
|
|
36
|
+
describe: 'hash to last commit in history',
|
|
37
|
+
type: 'string',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=history.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.options.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/history/history.options.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,6BAA6B;IAI3C,OAAO;QACL,YAAY,EAAE;YACZ,QAAQ,EAAE,yBAAyB;YACnC,IAAI,EAAE,QAAQ;SACf;QACD,cAAc,EAAE;YACd,QAAQ,EAAE,iDAAiD;YAC3D,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,gBAAgB,EAAE;YAChB,QAAQ,EACN,kEAAkE;YACpE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,wBAAwB;YAClC,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,mFAAmF;YACnF,QAAQ,EAAE,4BAA4B;YACtC,IAAI,EAAE,QAAQ;YACd,+DAA+D;YAC/D,OAAO,EAAE,CAAC;SACX;QACD,IAAI,EAAE;YACJ,gFAAgF;YAChF,QAAQ,EAAE,iCAAiC;YAC3C,IAAI,EAAE,QAAQ;SACf;QACD,EAAE,EAAE;YACF,gFAAgF;YAChF,QAAQ,EAAE,gCAAgC;YAC1C,IAAI,EAAE,QAAQ;SACf;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HistoryOptions } from '@code-pushup/core';
|
|
2
|
-
import type { HistoryCliOptions } from './history.model';
|
|
2
|
+
import type { HistoryCliOptions } from './history.model.js';
|
|
3
3
|
export declare function normalizeHashOptions(processArgs: HistoryCliOptions & HistoryOptions): Promise<HistoryCliOptions & HistoryOptions>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getHashFromTag, isSemver } from '@code-pushup/utils';
|
|
2
|
+
export async function normalizeHashOptions(processArgs) {
|
|
3
|
+
const { onlySemverTags,
|
|
4
|
+
// overwritten
|
|
5
|
+
maxCount, ...opt } = processArgs;
|
|
6
|
+
// eslint-disable-next-line functional/no-let, prefer-const
|
|
7
|
+
let { from, to, ...processOptions } = opt;
|
|
8
|
+
// if no semver filter is used resolve hash of tags, as hashes are used to collect history
|
|
9
|
+
if (!onlySemverTags) {
|
|
10
|
+
if (from && isSemver(from)) {
|
|
11
|
+
const { hash } = await getHashFromTag(from);
|
|
12
|
+
from = hash;
|
|
13
|
+
}
|
|
14
|
+
if (to && isSemver(to)) {
|
|
15
|
+
const { hash } = await getHashFromTag(to);
|
|
16
|
+
to = hash;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
...processOptions,
|
|
21
|
+
onlySemverTags,
|
|
22
|
+
maxCount: maxCount && maxCount > 0 ? maxCount : undefined,
|
|
23
|
+
from,
|
|
24
|
+
to,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/history/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAA+C;IAE/C,MAAM,EACJ,cAAc;IACd,cAAc;IACd,QAAQ,EACR,GAAG,GAAG,EACP,GAAG,WAAW,CAAC;IAEhB,2DAA2D;IAC3D,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,GAAG,CAAC;IAC1C,0FAA0F;IAC1F,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,GAAG,IAAI,CAAC;QACd,CAAC;QACD,IAAI,EAAE,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;YAC1C,EAAE,GAAG,IAAI,CAAC;QACZ,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,cAAc;QACjB,cAAc;QACd,QAAQ,EAAE,QAAQ,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACzD,IAAI;QACJ,EAAE;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.model.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/compare.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function yargsCompareOptionsDefinition() {
|
|
2
|
+
return {
|
|
3
|
+
before: {
|
|
4
|
+
describe: 'Path to source report.json',
|
|
5
|
+
type: 'string',
|
|
6
|
+
demandOption: true,
|
|
7
|
+
},
|
|
8
|
+
after: {
|
|
9
|
+
describe: 'Path to target report.json',
|
|
10
|
+
type: 'string',
|
|
11
|
+
demandOption: true,
|
|
12
|
+
},
|
|
13
|
+
label: {
|
|
14
|
+
describe: 'Label for diff (e.g. project name)',
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=compare.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.options.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/compare.options.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,6BAA6B;IAI3C,OAAO;QACL,MAAM,EAAE;YACN,QAAQ,EAAE,4BAA4B;YACtC,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,IAAI;SACnB;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,4BAA4B;YACtC,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,IAAI;SACnB;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,oCAAoC;YAC9C,IAAI,EAAE,QAAQ;SACf;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CoreConfig, type Format } from '@code-pushup/models';
|
|
2
|
-
import type { CoreConfigCliOptions } from './core-config.model';
|
|
3
|
-
import type { FilterOptions } from './filter.model';
|
|
4
|
-
import type { GeneralCliOptions } from './global.model';
|
|
2
|
+
import type { CoreConfigCliOptions } from './core-config.model.js';
|
|
3
|
+
import type { FilterOptions } from './filter.model.js';
|
|
4
|
+
import type { GeneralCliOptions } from './global.model.js';
|
|
5
5
|
export type CoreConfigMiddlewareOptions = GeneralCliOptions & CoreConfigCliOptions & FilterOptions;
|
|
6
6
|
export declare function coreConfigMiddleware<T extends CoreConfigMiddlewareOptions>(processArgs: T): Promise<GeneralCliOptions & CoreConfig & FilterOptions>;
|
|
7
7
|
export declare const normalizeFormats: (formats?: string[]) => Format[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { autoloadRc, readRcByPath } from '@code-pushup/core';
|
|
2
|
+
import { DEFAULT_PERSIST_FILENAME, DEFAULT_PERSIST_FORMAT, DEFAULT_PERSIST_OUTPUT_DIR, uploadConfigSchema, } from '@code-pushup/models';
|
|
3
|
+
export async function coreConfigMiddleware(processArgs) {
|
|
4
|
+
const { config, tsconfig, persist: cliPersist, upload: cliUpload, ...remainingCliOptions } = processArgs;
|
|
5
|
+
// Search for possible configuration file extensions if path is not given
|
|
6
|
+
const importedRc = config
|
|
7
|
+
? await readRcByPath(config, tsconfig)
|
|
8
|
+
: await autoloadRc(tsconfig);
|
|
9
|
+
const { persist: rcPersist, upload: rcUpload, ...remainingRcConfig } = importedRc;
|
|
10
|
+
const upload = rcUpload == null && cliUpload == null
|
|
11
|
+
? undefined
|
|
12
|
+
: uploadConfigSchema.parse({
|
|
13
|
+
...rcUpload,
|
|
14
|
+
...cliUpload,
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
...(config != null && { config }),
|
|
18
|
+
persist: {
|
|
19
|
+
outputDir: cliPersist?.outputDir ??
|
|
20
|
+
rcPersist?.outputDir ??
|
|
21
|
+
DEFAULT_PERSIST_OUTPUT_DIR,
|
|
22
|
+
filename: cliPersist?.filename ?? rcPersist?.filename ?? DEFAULT_PERSIST_FILENAME,
|
|
23
|
+
format: normalizeFormats(cliPersist?.format ?? rcPersist?.format ?? DEFAULT_PERSIST_FORMAT),
|
|
24
|
+
},
|
|
25
|
+
...(upload != null && { upload }),
|
|
26
|
+
...remainingRcConfig,
|
|
27
|
+
...remainingCliOptions,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export const normalizeFormats = (formats) => (formats ?? []).flatMap(format => format.split(','));
|
|
31
|
+
//# sourceMappingURL=core-config.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-config.middleware.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/core-config.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAEL,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAE1B,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAS7B,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAExC,WAAc;IACd,MAAM,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,SAAS,EACjB,GAAG,mBAAmB,EACvB,GAAG,WAAW,CAAC;IAChB,yEAAyE;IACzE,MAAM,UAAU,GAAG,MAAM;QACvB,CAAC,CAAC,MAAM,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC;QACtC,CAAC,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,EACJ,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,QAAQ,EAChB,GAAG,iBAAiB,EACrB,GAAG,UAAU,CAAC;IACf,MAAM,MAAM,GACV,QAAQ,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI;QACnC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC;YACvB,GAAG,QAAQ;YACX,GAAG,SAAS;SACb,CAAC,CAAC;IACT,OAAO;QACL,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC;QACjC,OAAO,EAAE;YACP,SAAS,EACP,UAAU,EAAE,SAAS;gBACrB,SAAS,EAAE,SAAS;gBACpB,0BAA0B;YAC5B,QAAQ,EACN,UAAU,EAAE,QAAQ,IAAI,SAAS,EAAE,QAAQ,IAAI,wBAAwB;YACzE,MAAM,EAAE,gBAAgB,CACtB,UAAU,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,IAAI,sBAAsB,CAClE;SACF;QACD,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC;QACjC,GAAG,iBAAiB;QACpB,GAAG,mBAAmB;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAkB,EAAY,EAAE,CAC/D,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-config.model.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/core-config.model.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options } from 'yargs';
|
|
2
|
-
import type { PersistConfigCliOptions, UploadConfigCliOptions } from './core-config.model';
|
|
2
|
+
import type { PersistConfigCliOptions, UploadConfigCliOptions } from './core-config.model.js';
|
|
3
3
|
export declare function yargsCoreConfigOptionsDefinition(): Record<keyof (PersistConfigCliOptions & UploadConfigCliOptions), Options>;
|
|
4
4
|
export declare function yargsPersistConfigOptionsDefinition(): Record<keyof PersistConfigCliOptions, Options>;
|
|
5
5
|
export declare function yargsUploadConfigOptionsDefinition(): Record<keyof UploadConfigCliOptions, Options>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function yargsCoreConfigOptionsDefinition() {
|
|
2
|
+
return {
|
|
3
|
+
...yargsPersistConfigOptionsDefinition(),
|
|
4
|
+
...yargsUploadConfigOptionsDefinition(),
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function yargsPersistConfigOptionsDefinition() {
|
|
8
|
+
return {
|
|
9
|
+
'persist.outputDir': {
|
|
10
|
+
describe: 'Directory for the produced reports',
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
'persist.filename': {
|
|
14
|
+
describe: 'Filename for the produced reports.',
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
'persist.format': {
|
|
18
|
+
describe: 'Format of the report output. e.g. `md`, `json`',
|
|
19
|
+
type: 'array',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function yargsUploadConfigOptionsDefinition() {
|
|
24
|
+
return {
|
|
25
|
+
'upload.organization': {
|
|
26
|
+
describe: 'Organization slug from portal',
|
|
27
|
+
type: 'string',
|
|
28
|
+
},
|
|
29
|
+
'upload.project': {
|
|
30
|
+
describe: 'Project slug from portal',
|
|
31
|
+
type: 'string',
|
|
32
|
+
},
|
|
33
|
+
'upload.server': {
|
|
34
|
+
describe: 'URL to your portal server',
|
|
35
|
+
type: 'string',
|
|
36
|
+
},
|
|
37
|
+
'upload.apiKey': {
|
|
38
|
+
describe: 'API key for the portal server',
|
|
39
|
+
type: 'string',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=core-config.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-config.options.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/lib/implementation/core-config.options.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,gCAAgC;IAI9C,OAAO;QACL,GAAG,mCAAmC,EAAE;QACxC,GAAG,kCAAkC,EAAE;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC;IAIjD,OAAO;QACL,mBAAmB,EAAE;YACnB,QAAQ,EAAE,oCAAoC;YAC9C,IAAI,EAAE,QAAQ;SACf;QACD,kBAAkB,EAAE;YAClB,QAAQ,EAAE,oCAAoC;YAC9C,IAAI,EAAE,QAAQ;SACf;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,gDAAgD;YAC1D,IAAI,EAAE,OAAO;SACd;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC;IAIhD,OAAO;QACL,qBAAqB,EAAE;YACrB,QAAQ,EAAE,+BAA+B;YACzC,IAAI,EAAE,QAAQ;SACf;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,0BAA0B;YACpC,IAAI,EAAE,QAAQ;SACf;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,2BAA2B;YACrC,IAAI,EAAE,QAAQ;SACf;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,+BAA+B;YACzC,IAAI,EAAE,QAAQ;SACf;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CoreConfig, PluginConfig } from '@code-pushup/models';
|
|
2
|
+
import type { FilterOptions } from './filter.model.js';
|
|
2
3
|
export declare function filterMiddleware<T extends FilterOptions>(originalProcessArgs: T): T;
|
|
4
|
+
export declare function filterSkippedInPlugins(plugins: PluginConfig[]): PluginConfig[];
|
|
5
|
+
export declare function filterSkippedCategories(categories: CoreConfig['categories'], plugins: CoreConfig['plugins']): CoreConfig['categories'];
|