-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
45 lines (39 loc) · 1.38 KB
/
app.js
File metadata and controls
45 lines (39 loc) · 1.38 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
import { Command } from 'commander';
import { blueConsole, copyFiles, firstLower, greenConsole, redConsole, spinners, updateHelper } from './global.js';
const program = new Command();
program
.name('make:controller')
.description('Create a Wonderful Express Templating')
.version('1.0.0');
program.command('make:controller')
.description('Command to make a Controller Template Express JS')
.argument('Filename', 'Namefile of Controller')
.option('-r', 'Buat router nya sekalian')
.option('-d', 'Buat dokumentasi nya sekalian')
.action((str, options) => {
if (str.includes('Controller')) {
str = firstLower(str)
}
if (str.includes('controller')) {
str = firstLower(str.replace('controller', 'Controller'))
}
const nameFile = str.replace('Controller', '');
copyFiles('templateController.js', `${str}.js`, nameFile)
if (options.r) {
copyFiles('templateRoute.js', `${nameFile}Route.js`, nameFile)
}
console.log(str)
})
program.command('update:helper')
.description('Command to update a Helper Controller Express JS')
.action((str, options) => {
updateHelper()
console.log(str)
})
program.command('make:template')
.description('Command to make a SRC Dir templating Express JS')
.argument('location', 'location of Template')
.action((str, options) => {
console.log(str, options)
})
program.parse(process.argv);