forked from lassjs/lass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·36 lines (27 loc) · 849 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
35
36
#!/usr/bin/env node
// Inspired by:
// <https://github.com/saojs/sao/issues/50>
// <https://github.com/nuxt-community/create-nuxt-app/blob/master/packages/create-nuxt-app/package.json>
const path = require('path');
const cac = require('cac');
const sao = require('sao');
const update = require('update-notifier');
const pkg = require('./package');
const cli = cac('lass');
cli
.command('<name>', 'Generate a new package')
.action((name) => {
const folderName = name;
const targetPath = path.resolve(folderName);
console.log(`> Generating package in ${targetPath}`);
const templatePath = path.dirname(require.resolve('./package'));
return sao({
template: templatePath,
targetPath
});
})
.example('lass my-new-project');
cli.version(pkg.version);
cli.help();
cli.parse();
update({ pkg }).notify();