UNPKG

@puls-atlas/cli

Version:

The Puls Atlas CLI tool for managing Atlas projects

29 lines 3.96 kB
#!/usr/bin/env node --no-warnings=ExperimentalWarning import { program } from 'commander'; import cmd from './cmd/index.js'; import hooks from './hooks/index.js'; const init = program.command('init').description('Initialize a new Atlas project.'); const start = program.command('start').description('Start the local development server.'); const auth = program.command('auth').description('Authentication commands.'); const deploy = program.command('deploy').description('Deploy commands.').alias('d'); const install = program.command('install').description('Install commands.').alias('i'); program.option('-v, --version', 'Print the current version of the CLI.').action(cmd.version).hook('preAction', hooks.npmAuth); init.action(cmd.init).option('--secrets', 'Initialize secrets only for the project.').option('--local-env', 'Initialize local environment variables only for the project.').option('--database', 'Initialize required Firestore databases for the project.').option('--task-queue', 'Initialize required Task queues for the project.').hook('preAction', hooks.versionCheck); start.option('--link', 'Symlink local core packages defined in your link.json file.').option('--watch', 'Watch local packages for changes.').option('--clear-cache', 'Clear the local cache.').action(cmd.start).hook('preAction', hooks.versionCheck); auth.command('print-developer-token <email>').description('Print a developer token for local development.').action(cmd.auth.printDeveloperToken).hook('preAction', hooks.npmAuth); auth.command('npm').description('Authenticate with Google Cloud Artifacts Registry to access private NPM packages.').action(cmd.auth.npm); auth.command('composer').description('Authenticate with Composer to access private PHP packages.').action(cmd.auth.composer); deploy.command('functions [functionNames...]').description('Deploy one or more Firebase functions.').option('--interactive', 'Select functions to deploy from a list.').option('--editor', 'Provide functions to deploy from your editor.').option('--codebase <path>', 'Define the source path for the functions you want to deploy.').action(cmd.deploy.functions).hook('preAction', hooks.npmAuth).hook('preAction', hooks.versionCheck); deploy.command('app').description('Deploy your application to App Engine in the production environment.').action(cmd.deploy.app).hook('preAction', hooks.versionCheck); deploy.command('cron').description('Deploy cron jobs to Google Cloud.').action(cmd.deploy.cron).hook('preAction', hooks.versionCheck); deploy.command('rules').description('Deploy Firestore or Storage rules.').option('--firestore', 'Deploy Firestore rules.').option('--storage', 'Deploy Storage rules.').action(cmd.deploy.rules).hook('preAction', hooks.versionCheck); deploy.command('indexes').description('Deploy Firestore indexes.').action(cmd.deploy.indexes).hook('preAction', hooks.versionCheck); install.command('app').description('Install the latest dependencies for the app.').option('--composer', 'Install the latest Composer dependencies.').option('--npm', 'Install the latest NPM dependencies.').option('--force', 'Force install the dependencies.').option('--legacy-peer-deps', 'Install with legacy peer dependencies.').action(cmd.install.app).hook('preAction', hooks.npmAuth).hook('preAction', hooks.versionCheck); install.command('functions').description('Install the latest dependencies for the functions.').option('--force', 'Force install the dependencies.').option('--legacy-peer-deps', 'Install with legacy peer dependencies.').option('--codebase <path>', 'Define the path to where you want to install the dependencies.').action(cmd.install.functions).hook('preAction', hooks.npmAuth).hook('preAction', hooks.versionCheck); program.parse(process.argv); process.on('uncaughtException', error => { if (error instanceof Error && error.name === 'ExitPromptError') {} else { console.error('An unexpected error occurred:', error.message); process.exit(1); } });