@code-pushup/cli
Version:
A CLI to run all kinds of code quality measurements to align your team with company goals
38 lines • 1.42 kB
JavaScript
import { collectAndPersistReports, upload, } from '@code-pushup/core';
import { logger } from '@code-pushup/utils';
import { printCliCommand, renderCategoriesHint, renderPortalHint, } from '../implementation/logging.js';
export function yargsAutorunCommandObject() {
const command = 'autorun';
return {
command,
describe: 'Shortcut for running collect followed by upload',
handler: async (args) => {
printCliCommand(command);
const options = args;
// we need to ensure `json` is part of the formats as we want to upload
const optionsWithFormat = {
...options,
persist: {
...options.persist,
format: [
...new Set([...options.persist.format, 'json']),
],
},
};
await collectAndPersistReports(optionsWithFormat);
if (!options.categories?.length) {
renderCategoriesHint();
logger.newline();
}
if (options.upload) {
await upload(options);
}
else {
logger.warn('Upload skipped because Portal is not configured.');
logger.newline();
renderPortalHint();
}
},
};
}
//# sourceMappingURL=autorun-command.js.map