mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
32 lines
826 B
JavaScript
32 lines
826 B
JavaScript
const path = require('path');
|
|
const execa = require('execa');
|
|
|
|
module.exports = {
|
|
command: 'create <name>',
|
|
desc: 'Create a supernova',
|
|
builder(yargs) {
|
|
yargs.positional('name', {
|
|
type: 'string',
|
|
description: 'name of the project',
|
|
});
|
|
yargs.option('install', {
|
|
type: 'boolean',
|
|
default: true,
|
|
description: 'Run package installation step',
|
|
});
|
|
},
|
|
async handler(argv) {
|
|
const generator = path.resolve(__dirname, 'generator/index.js');
|
|
const args = `${argv.name} ${!argv.install ? '--no-install' : ''}`;
|
|
try {
|
|
execa.shell(`yo ${generator} ${args} --no-insight`, {
|
|
localDir: path.resolve(__dirname, 'node_modules', '.bin'),
|
|
preferLocal: true,
|
|
stdio: 'inherit',
|
|
});
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
},
|
|
};
|