-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·48 lines (37 loc) · 1.26 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env node
'use strict'
const chalk = require('chalk')
const clear = require('clear')
const figlet = require('figlet')
const program = require('commander')
const pkg = require('./package.json')
const helper = require('./lib/helper')
const Manager = require('./lib/manager')
const manager = new Manager()
program
.version(pkg.version)
program
// .help(false)
.command('init [projectName]')
.alias('i')
.description('Initiliaze the project, with directly project name if wanted')
.option('-G, --gulp', 'Used Gulp system instead of manual npm scripts')
.option('-f, --force', 'Force the installation regardless of the folder\'s state')
.action((env, options) => {
console.log(`the gulp mode is : ${options.gulp}`)
console.log(`the projectName is : ${env}`)
// Clear terminal
clear()
// Init cli head
console.log(chalk.yellow(figlet.textSync('|| WASA-CLI ||', { horizontalLayout: 'full' })))
console.log(chalk.blue('Welcome to the Wasa Builder. Let\'s initiliaze together your boilerplate !'))
if (helper.directoryExists('.git')) {
manager.askContinue(options.force)
} else {
manager.askProjectName(env)
}
})
program.parse(process.argv)
if (!process.argv.slice(2).length) {
program.outputHelp(chalk.red)
}