@code-pushup/cli
Version:
A CLI to run all kinds of code quality measurements to align your team with company goals
38 lines • 1.64 kB
JavaScript
import { bold, gray } from 'ansis';
import { collectAndPersistReports, } from '@code-pushup/core';
import { link, ui } from '@code-pushup/utils';
import { CLI_NAME } from '../constants.js';
import { collectSuccessfulLog, renderConfigureCategoriesHint, } from '../implementation/logging.js';
export function yargsCollectCommandObject() {
const command = 'collect';
return {
command,
describe: 'Run Plugins and collect results',
handler: async (args) => {
const options = args;
ui().logger.log(bold(CLI_NAME));
ui().logger.info(gray(`Run ${command}...`));
await collectAndPersistReports(options);
collectSuccessfulLog();
if (!options.categories || options.categories.length === 0) {
renderConfigureCategoriesHint();
}
const { upload = {} } = args;
if (Object.keys(upload).length === 0) {
renderUploadAutorunHint();
}
},
};
}
export function renderUploadAutorunHint() {
ui()
.sticker()
.add(bold.gray('💡 Visualize your reports'))
.add('')
.add(`${gray('❯')} npx code-pushup upload - ${gray('Run upload to upload the created report to the server')}`)
.add(` ${link('https://github.com/code-pushup/cli/tree/main/packages/cli#upload-command')}`)
.add(`${gray('❯')} npx code-pushup autorun - ${gray('Run collect & upload')}`)
.add(` ${link('https://github.com/code-pushup/cli/tree/main/packages/cli#autorun-command')}`)
.render();
}
//# sourceMappingURL=collect-command.js.map