-
Notifications
You must be signed in to change notification settings - Fork 3
/
cli.js
34 lines (27 loc) · 783 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env node
const path = require('path');
const sao = require('sao');
const cac = require('cac');
const chalk = require('chalk');
const { version } = require('./package.json');
const generator = path.resolve(__dirname, './');
const cli = cac('janak');
cli
.command(
'[out-dir] [options]',
'Generate in a custom directory or current directory',
)
.action((outDir = '.') => {
console.log(chalk`{cyan janak v${version}}`);
console.log(chalk`✨ Generating new Vue.js package in {cyan ${outDir}}`);
// See https://saojs.org/api.html#standalone-cli
sao({ generator, outDir, logLevel: 2 })
.run()
.catch((err) => {
console.trace(err);
process.exit(1);
});
});
cli.help();
cli.version(version);
cli.parse();