UNPKG

@puls-atlas/cli

Version:

The Puls Atlas CLI tool for managing Atlas projects

40 lines 1.37 kB
import fs from 'fs'; import path from 'path'; import chalk from 'chalk'; import inquirer from 'inquirer'; import { logger } from './../../utils/logger.js'; import { warnIfNotReleaseBranch } from './../../utils/git.js'; import { execSync, selectProject } from './../../utils/index.js'; export default () => { warnIfNotReleaseBranch(); selectProject('.firebaserc', { promptMessage: 'Select a Google Cloud Project to deploy to:' }).then(async ({ projectId }) => { if (!fs.existsSync(path.join(process.cwd(), 'cron.yaml'))) { logger.error('No cron.yaml file found. Make sure you run this command in the root of the Atlas project.'); } const confirm = await inquirer.prompt([{ type: 'confirm', name: 'value', default: false, message: `Deploy all cron jobs to ${chalk.bold(projectId)}?` }]); if (confirm.value) { const spinner = logger.spinner('Deploying Cron jobs...'); try { execSync('gcloud app deploy cron.yaml', { stdio: 'inherit', project: projectId }); spinner.succeed('Cron jobs deployed successfully.'); } catch (error) { logger.error(`Failed to deploy cron jobs: ${error.message}`); spinner.fail('Failed to deploy cron jobs.'); } } else { logger.info('Deployment of cron jobs cancelled.'); } }); };