-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·81 lines (73 loc) · 1.5 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const boxen = require('boxen');
const checkTools = require('./lib/check-tools');
const askQuestions = require('./lib/ask-questions');
const createProject = require('./lib/project');
const createNFD = require('.');
const cli = meow(
`
Usage
$ nfd <orgname>
Options
--url, -u Define a url
--next, -n Initialise NextJS
--sanity, -s Initialise Sanity
--theme, -t Initialise theme files with automated defaults
--extended, -e Install NewFrontDoor UI library elements
--dry, -d Dry run
Examples
$ nfd "Sample church" --next --url sample.church
Sample church
{
next: true,
extended: true,
sanity: true,
theme: true,
url: 'sample.church'
}
`,
{
flags: {
dry: {
type: 'boolean',
alias: 'd'
},
url: {
type: 'string',
alias: 'u'
},
next: {
type: 'boolean',
alias: 'n'
},
sanity: {
type: 'boolean',
alias: 's'
},
theme: {
type: 'boolean',
alias: 't'
},
extended: {
type: 'boolean',
alias: 'e'
}
}
}
);
/*
{
input: ['unicorns'],
flags: {rainbow: true},
...
}
*/
console.clear();
console.log(boxen('Welcome to the Create project for NFD', {padding: 1}));
// Run index.js
checkTools()
.then(() => askQuestions(cli.input[0], cli.flags))
.then(createProject)
.then(createNFD);