UNPKG

@nucel.cloud/cli

Version:

The open-source deployment platform for modern web apps

71 lines 2.57 kB
#!/usr/bin/env node import { Command } from 'commander'; import chalk from 'chalk'; import { deploy } from './commands/deploy.js'; import { handleError } from './utils/errors.js'; import { readFileSync } from 'fs'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __dirname = dirname(fileURLToPath(import.meta.url)); const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8')); // Always show version when running any command console.log(chalk.gray(`Nucel CLI v${packageJson.version}\n`)); const program = new Command(); program .name('nucel') .description('Deploy modern web apps to AWS') .version(packageJson.version) .option('-v, --verbose', 'Enable verbose output') .option('-d, --debug', 'Enable debug output (includes verbose)'); program .command('deploy') .description('Deploy your application') .option('-s, --stack <stack>', 'Stack name', 'dev') .option('--preview', 'Preview changes without deploying') .option('--build', 'Force build even if output exists') .option('--skip-build', 'Skip build step') .option('--build-command <command>', 'Custom build command') .option('--backend <backend>', 'State backend (local, s3, auto)', 'auto') .action(async (options, command) => { try { const parentOpts = command.parent?.opts() || {}; await deploy({ stack: options.stack, destroy: false, preview: options.preview || false, verbose: parentOpts.verbose || parentOpts.debug || false, debug: parentOpts.debug || false, build: options.build || false, skipBuild: options.skipBuild || false, buildCommand: options.buildCommand, backend: options.backend || 'auto', }); } catch (error) { handleError(error); } }); program .command('destroy') .description('Destroy your application infrastructure') .option('-s, --stack <stack>', 'Stack name', 'dev') .action(async (options, command) => { try { const parentOpts = command.parent?.opts() || {}; await deploy({ stack: options.stack, destroy: true, preview: false, verbose: parentOpts.verbose || parentOpts.debug || false, debug: parentOpts.debug || false, }); } catch (error) { handleError(error); } }); program.parse(process.argv); if (!process.argv.slice(2).length) { program.outputHelp(); } //# sourceMappingURL=index.js.map