fix(cli): clean up eager loading bug when initializing cli
This commit is contained in:
parent
a443868f8b
commit
3d20361355
5 changed files with 99 additions and 96 deletions
|
@ -3,8 +3,7 @@
|
|||
import { program } from 'commander';
|
||||
import chalk from 'chalk';
|
||||
import figlet from 'figlet';
|
||||
import { initConfig, loadConfig } from '../lib/config.js';
|
||||
import { downloadAsset } from '../lib/download.js';
|
||||
import { loadConfig } from '../lib/config.js';
|
||||
import { runRootScript } from '../lib/runScript.js';
|
||||
import { handleExitError } from '../lib/handlers.js';
|
||||
import { runJobsMenu } from '../lib/jobs.js';
|
||||
|
@ -14,11 +13,17 @@ process.on('unhandledRejection', (err) => handleExitError(err, 'Unhandled reject
|
|||
process.on('uncaughtException', (err) => handleExitError(err, 'Uncaught exception'));
|
||||
|
||||
program.name('coryd').description('🪄 Handle tasks, run commands or jobs, download things and have fun.').version('3.2.0');
|
||||
program.command('init').description('Initialize CLI and populate required config.').action(initConfig);
|
||||
program.command('init').description('Initialize CLI and populate required config.').action(async () => {
|
||||
const { initConfig } = await import('../lib/config.js');
|
||||
await initConfig();
|
||||
});
|
||||
program.command('run [script]').description('Run site scripts and commands.').action(runRootScript);
|
||||
program.command('tasks').description('Handle repeated tasks.').action(runTasksMenu);
|
||||
program.command('jobs').description('Trigger jobs and scripts.').action(runJobsMenu);
|
||||
program.command('download').description('Download, name and store image assets.').action(downloadAsset);
|
||||
program.command('download').description('Download, name and store image assets.').action(async () => {
|
||||
const { downloadAsset } = await import('../lib/download.js');
|
||||
await downloadAsset();
|
||||
});
|
||||
|
||||
if (process.argv.length <= 2) {
|
||||
const ascii = figlet.textSync('coryd.dev', { horizontalLayout: 'default' });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue