UNPKG

@controlla/cli

Version:

Command line interface for rapid Controlla projects development

38 lines (30 loc) 952 B
const chalk = require('chalk') const shouldBackend = require('./util/shouldBackend') const loadUserOptions = require('./loadUserOptions') const { error, stopSpinner, log, logWithSpinner, execa } = require('@vue/cli-shared-utils') async function view (name, options = {}, context = process.cwd()) { const userOptions = await loadUserOptions(context) const isShouldBackend = await shouldBackend(userOptions.type) log() if (isShouldBackend) { } log() logWithSpinner('🔥', `Generating view... \n \n`) log() await execa( `php artisan view:new ${name}`, { cwd: context, shell: true } ) stopSpinner() log(`🎉 Successfully created ${chalk.yellow(name)} view on ${chalk.yellow(userOptions.siteName)}.`) log() } module.exports = (...args) => { return view(...args).catch(err => { stopSpinner(false) // do not persist error(err) if (!process.env.CONTROLLA_CLI_TEST) { process.exit(1) } }) }