UNPKG

@puls-atlas/cli

Version:

The Puls Atlas CLI tool for managing Atlas projects

34 lines 871 B
import { execSync, logger } from '../../utils/index.js'; const authenticate = onError => { try { execSync('npx google-artifactregistry-auth', { stdio: 'pipe' }); } catch (error) { if (onError) { onError(error); } else { throw error; } } }; export default () => { const spinner = logger.spinner('Authenticating with Google Artifact Registry...'); try { authenticate(error => { if (error.message.includes('not recognized as an internal or external command')) { spinner.warn('google-artifactregistry-auth is not installed. Installing now...'); execSync('npm install -g google-artifactregistry-auth', { stdio: 'pipe' }); authenticate(); } else { throw error; } }); spinner.succeed(); } catch (error) { spinner.fail(); throw error; } };