UNPKG

@swell/cli

Version:

Swell's command line interface/utility

35 lines (34 loc) 1.09 kB
import { Flags } from '@oclif/core'; import path from 'node:path'; import CreateApp from '../create/app.js'; export default class InitApp extends CreateApp { static description = 'Initialize app swell.json in the current directory.'; static examples = [ { command: 'swell app init', description: 'Initialize app following command prompts.', }, { command: 'swell app init -y', description: 'Initialize app and accept all default values.', }, ]; static flags = { yes: Flags.boolean({ char: 'y', description: `accept all default values`, }), }; async run() { const { flags } = await this.parse(InitApp); const { yes: confirmYes } = flags; const id = process.cwd().split(path.sep).pop() || 'Swell App'; await this.createSwellConfig({ allowOverwrite: false, inputId: id, inputType: this.appType, inputYes: confirmYes, nestedPath: false, }); } }