Files
cli/ts/mod_standard/index.ts

92 lines
3.4 KiB
TypeScript

/* -----------------------------------------------
* executes as standard task
* ----------------------------------------------- */
import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';
import { logger } from '../gitzone.logging.js';
export let run = async () => {
console.log('');
console.log('╭─────────────────────────────────────────────────────────────╮');
console.log('│ gitzone - Development Workflow CLI │');
console.log('╰─────────────────────────────────────────────────────────────╯');
console.log('');
const interactInstance = new plugins.smartinteract.SmartInteract();
const response = await interactInstance.askQuestion({
type: 'list',
name: 'action',
message: 'What would you like to do?',
default: 'commit',
choices: [
{ name: 'Commit changes (semantic versioning)', value: 'commit' },
{ name: 'Format project files', value: 'format' },
{ name: 'Configure release settings', value: 'config' },
{ name: 'Create from template', value: 'template' },
{ name: 'Manage dev services (MongoDB, S3)', value: 'services' },
{ name: 'Open project assets', value: 'open' },
{ name: 'Show help', value: 'help' },
],
});
const action = (response as any).value;
switch (action) {
case 'commit': {
const modCommit = await import('../mod_commit/index.js');
await modCommit.run({ _: ['commit'] });
break;
}
case 'format': {
const modFormat = await import('../mod_format/index.js');
await modFormat.run({ interactive: true });
break;
}
case 'config': {
const modConfig = await import('../mod_config/index.js');
await modConfig.run({ _: ['config'] });
break;
}
case 'template': {
const modTemplate = await import('../mod_template/index.js');
await modTemplate.run({ _: ['template'] });
break;
}
case 'services': {
const modServices = await import('../mod_services/index.js');
await modServices.run({ _: ['services'] });
break;
}
case 'open': {
const modOpen = await import('../mod_open/index.js');
await modOpen.run({ _: ['open'] });
break;
}
case 'help':
showHelp();
break;
}
};
function showHelp(): void {
console.log('');
console.log('Usage: gitzone <command> [options]');
console.log('');
console.log('Commands:');
console.log(' commit Create a semantic commit with versioning');
console.log(' format Format and standardize project files');
console.log(' config Manage release registry configuration');
console.log(' template Create a new project from template');
console.log(' services Manage dev services (MongoDB, S3/MinIO)');
console.log(' open Open project assets (GitLab, npm, etc.)');
console.log(' docker Docker-related operations');
console.log(' deprecate Deprecate a package on npm');
console.log(' meta Run meta commands');
console.log(' start Start working on a project');
console.log(' helpers Run helper utilities');
console.log('');
console.log('Run gitzone <command> --help for more information on a command.');
console.log('');
}