UNPKG

@puls-atlas/cli

Version:

The Puls Atlas CLI tool for managing Atlas projects

39 lines 1.32 kB
import fs from 'fs'; import path from 'path'; import chalk from 'chalk'; import inquirer from 'inquirer'; import { workspace, logger, selectProject, execSync } from './../../utils/index.js'; export default () => { if (!workspace.isOnBranch('master', 'main')) { logger.warning('You are not on the master/main branch. Be careful selecting the project!'); } 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) { spinner.fail('Failed to deploy cron jobs.'); } } else { logger.info('Deployment of cron jobs cancelled.'); } }); };