@sap/cds-dk
Version:
Command line client and development toolkit for the SAP Cloud Application Programming Model
31 lines (26 loc) • 899 B
JavaScript
const cds = require('../../../cds')
const { path, sh: $ } = cds.utils
const { ask4 } = require('../../../util/question')
const { renderAndCopy } = require('../../template')
module.exports = class VueTemplate extends require('../../plugin') {
options() {
return {
'into': {
type: 'string',
short: 'i',
help: `Name of the app folder in 'app/'. Example: 'catalog' → 'app/catalog'.`
}
}
}
static help() {
return 'user interface for Vue.js'
}
async run() {
const app = cds.cli.options.into ?? await ask4([`app name: `])
let into = path.join(cds.env.folders.app, app)
await renderAndCopy(path.join(__dirname, 'files'), into, { app, isJava: cds.env['project-nature'] === 'java', literal: () => text => text,
})
if (cds.cli.command === 'init') into = path.join(cds.cli.argv[0], into)
await $`npm i --prefix ${into}`
}
}