-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (44 loc) · 1.19 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
49
50
51
52
53
#!/usr/bin/env node
'use strict';
const program = require("commander");
const fs = require("fs");
const path = require('path');
const tasksDirectory = path.join(__dirname, "tasks");
const createDirectory = require(path.join(tasksDirectory, "createDirectory"));
const createAppDirectories = require(path.join(tasksDirectory, "createAppDirectories"));
const createProjectFiles = require(path.join(tasksDirectory, "createProjectFiles"));
const setProjectName = require(path.join(tasksDirectory, "setProjectName"));
const success = require(path.join(tasksDirectory, "success"));
/**
* Execute the program functions.
*/
const execute = name => {
createDirectory(name)
.then(createAppDirectories)
.then(createProjectFiles)
.then(setProjectName)
.then(success)
.catch(err => {
console.log(err);
});
};
/**
* Run program.
*/
program
.version("1.0.0")
.usage("<name>")
.arguments("<name>")
.description("Create a WordPress website with Docker support.")
.action(execute);
/**
* Read arguments to program.
*/
program.parse(process.argv);
/**
* Validate args.
*/
if (program.args.length === 0) {
console.error("Please provide a name for the app.");
process.exit(1);
}