52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { Command } from 'commander';
|
|
import chalk from 'chalk';
|
|
import { readFileSync } from 'fs';
|
|
import { fileURLToPath } from 'url';
|
|
import path from 'path';
|
|
import { initCommand } from './commands/init.js';
|
|
import { createAppCommand } from './commands/create-app.js';
|
|
import { createPackageCommand } from './commands/create-package.js';
|
|
import { generateCommand } from './commands/generate.js';
|
|
import { deployCommand } from './commands/deploy.js';
|
|
import { upgradeCommand } from './commands/upgrade.js';
|
|
import { doctorCommand } from './commands/doctor.js';
|
|
import { infoCommand } from './commands/info.js';
|
|
import { devCommand } from './commands/dev.js';
|
|
import { buildCommand } from './commands/build.js';
|
|
import { testCommand } from './commands/test.js';
|
|
import { lintCommand } from './commands/lint.js';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
|
|
const program = new Command();
|
|
|
|
program
|
|
.name('fischerx')
|
|
.alias('fx')
|
|
.description('FischerX CLI - A modern full-stack development toolkit')
|
|
.version(packageJson.version, '-v, --version', 'Output the current version')
|
|
.helpOption('-h, --help', 'Display help for command');
|
|
|
|
program.addCommand(initCommand);
|
|
program.addCommand(createAppCommand);
|
|
program.addCommand(createPackageCommand);
|
|
program.addCommand(generateCommand);
|
|
program.addCommand(deployCommand);
|
|
program.addCommand(upgradeCommand);
|
|
program.addCommand(doctorCommand);
|
|
program.addCommand(infoCommand);
|
|
program.addCommand(devCommand);
|
|
program.addCommand(buildCommand);
|
|
program.addCommand(testCommand);
|
|
program.addCommand(lintCommand);
|
|
|
|
program.parse();
|
|
|
|
if (!process.argv.slice(2).length) {
|
|
program.outputHelp();
|
|
}
|