Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const gulp = require('gulp'); // gulp.js is really heavy on load
if (extension) {
extension.requireTask(taskName);
} else {
require(taskFile)();
}
terminal.echo(chalk.green(`\r${env.logo} Ready to roll `));
/* eslint-enable global-require */
//-- Run task
if (gulp.task(task)) {
terminal.spacer();
gulp.series(task)();
} else {
terminal.exit(`Task ${chalk.underline(task)} does not exists`);
}
}
async cli(meowCli) {
cli.refuseArguments(meowCli);
const { verbose: flagVerbose } = cli.validateFlags(meowCli, {
verbose: ow.boolean
});
verbose = flagVerbose;
terminal.spacer();
const spinner = terminal.startSpinner(`Diagnosing ${chalk.cyan(env.packageConfig.name)}...`);
//-- Load here to speed up spinner first display
/* eslint-disable global-require */
const pluralize = require('pluralize');
const fss = require('@absolunet/fss');
const paths = require('~/helpers/paths');
const tester = require('~/helpers/doctor/tester');
/* eslint-enable global-require */
const [general, root, bundles, components, workflow, vendors, sync] = await Promise.all([
tester.general(),
tester.root(),
tester.bundles(),
tester.components(),
return plumber((error) => {
terminal.spacer(2);
terminal.echo(`${emoji.get('monkey')} ${error.toString()}`);
terminal.exit();
});
}
util.checkUpdate(cliPackageConfig, (error, update) => {
if (!error) {
const { terminal } = require('@absolunet/terminal');
terminal.spacer();
if (update.current !== update.latest) {
util.echo(`Update available: ${chalk.dim(update.current)} ${chalk.reset('→')} ${chalk.green(update.latest)}\n\nUpdating...`);
} else {
util.echo('No update available\n\nReinstalling...');
}
terminal.spacer();
terminal.run('npm uninstall -g @absolunet/nwayo-cli && npm install -g --no-audit @absolunet/nwayo-cli');
} else {
util.exit(error);
}
});
cli(meowCli) {
if (__(this).get('deprecated')) {
terminal.spacer();
terminal.warning(`DEPRECATED - ${__(this).get('deprecated')}`);
terminal.exit();
}
throw new Error('Not overwritten by subclass');
}
startWatchSpinner() {
__.cascadeSkip = false;
terminal.spacer();
__.standingSpinner = ora({
text: logGuard(START),
spinner: {
interval: 250,
frames: ['●', '○']
},
color: 'green'
}).start();
}
}
if (test.outdated) {
extra += ` ${chalk.dim(test.outdated.current)} → ${chalk.yellow(test.outdated.latest)}`;
}
if (test.linterOutput) {
extra += `\n${test.linterOutput}`;
}
terminal.echo(`${chalk.red(`${figures.pointerSmall} ${figures.cross}`)} ${test.message}${extra}`);
}
});
}
terminal.spacer(2);
return success;
};
]);
spinner.stop();
//-- Reports
reporter('General', general);
reporter('Root strucure', root);
reporter('Bundles', bundles);
reporter('Components', components);
reporter('Workflow', workflow);
reporter('Vendors', vendors);
reporter('Sync between workflow and toolbox', sync);
//-- Totals
terminal.spacer(2);
if (totals.success) {
terminal.echo(chalk.green(`${pluralize('test', totals.success, true)} passed`));
}
if (totals.failure) {
terminal.echo(chalk.red(`${pluralize('test', totals.failure, true)} failed`));
}
terminal.spacer();
//-- Reward
if (totals.failure === 0) {
const reward = fss.readFile(`${paths.workflow.ressources}/doctor-reward`, 'utf8');
const pink = chalk.hex('#ff69b4');