UNPKG

@puls-atlas/cli

Version:

The Puls Atlas CLI tool for managing Atlas projects

33 lines 876 B
import fs from 'fs'; import path from 'path'; import inquirer from 'inquirer'; import { logger } from '../../utils/index.js'; export default async () => { const authJsonPath = path.join(process.cwd(), 'auth.json'); if (fs.existsSync(authJsonPath)) { logger.error('An auth.json file already exists.'); } const { token } = await inquirer.prompt([{ type: 'input', name: 'token', message: 'Enter the vendor token from packagist.com:', validate: input => { if (input.length === 0) { return 'Please enter a valid developer token.'; } return true; } }]); const authJson = { 'http-basic': { 'puls.repo.packagist.com': { username: 'token', password: token } } }; fs.writeFileSync(authJsonPath, JSON.stringify(authJson, null, 4)); logger.success('auth.json file created.'); };