-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
47 lines (41 loc) · 1.03 KB
/
index.js
File metadata and controls
47 lines (41 loc) · 1.03 KB
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
#! /usr/bin/env node
const fs = require('fs');
const path = require('path');
const colors = require('colors');
const componentGen = require('./components');
const templateGen = require('./templates');
var argv = require('minimist')(process.argv.slice(2));
const componentsFactory = new componentGen();
const templateFactory = new templateGen()
const inquirer = require('inquirer');
const genQuestions = [{
name: 'gen-type',
type: 'list',
message: 'What would you like to genrate?',
choices: ['Component', 'Theme']
}];
if (argv.g) {
if (argv.c) {
componentsFactory.validateName(argv.c);
}
else if (argv.t) {
templateFactory.validateName(argv.t);
}
else {
ask();
}
} else {
ask();
};
function ask(){
inquirer.prompt(genQuestions)
.then(answer => {
var choice = answer['gen-type'];
if (choice === 'Component') {
componentsFactory.generate();
}
else if (choice === 'Theme') {
templateFactory.generate();
}
});
}