zura-stack-native
Version:
A comprehensive React Native CLI project generator with production-ready setup
61 lines (51 loc) ⢠1.91 kB
JavaScript
const { Command } = require('commander');
const chalk = require('chalk');
const { createProject } = require('../src/commands/create');
const { checkRequirements } = require('../src/utils/requirements');
const { showBanner } = require('../src/utils/banner');
const program = new Command();
// Set up the CLI
program
.name('zura-stack-native')
.description('A comprehensive React Native CLI project generator with production-ready setup')
.version('1.0.0');
// Show banner
showBanner();
// Create command
program
.command('create <project-name>')
.description('Create a new React Native project with ZuraStackNative')
.option('-t, --template <template>', 'Project template to use', 'default')
.option('--typescript', 'Use TypeScript (default: true)', true)
.option('--no-typescript', 'Disable TypeScript')
.option('--testing', 'Include testing framework (Jest + React Native Testing Library + Detox)')
.option('--no-testing', 'Disable testing framework')
.option('-y, --yes', 'Skip prompts and use defaults')
.option('--verbose', 'Enable verbose output')
.action(async (projectName, options) => {
try {
console.log(chalk.blue('\nš Starting ZuraStackNative project creation...\n'));
// Check system requirements
await checkRequirements();
// Create the project
await createProject(projectName, options);
} catch (error) {
console.error(chalk.red('\nā Error creating project:'), error.message);
process.exit(1);
}
});
// Info command
program
.command('info')
.description('Show information about the current setup')
.action(async () => {
try {
await checkRequirements(true);
} catch (error) {
console.error(chalk.red('\nā Error checking requirements:'), error.message);
process.exit(1);
}
});
// Parse command line arguments
program.parse();