-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·56 lines (45 loc) · 1.64 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
54
55
56
#!/usr/bin/env node
const chalk = require('chalk');
const clear = require('clear');
const minimist = require('minimist');
const repo = require('./scripts/boilerplate');
const inquirer = require('./scripts/inquirer');
const directories = require('./scripts/directories');
clear();
console.log(chalk.yellow(`
◍ ◍ ◍ _____ _ _ _ _
\\___◍__◍_/ |_ _|_ _| |__ | | ___ ___(_) __| | ___
|######| | |/ _\` | '_ \\| |/ _ \\/ __| |/ _\` |/ _ \\
|######| | | (_| | |_) | | __/\\__ \\ | (_| | __/
|______| |_|\\__,_|_.__/|_|\\___||___/_|\\__,_|\\___|
____o______o_________________________________________________\n`));
const run = async () => {
try {
const argv = minimist(process.argv.slice(2));
const projectName = argv._[0] || '';
if (projectName) {
console.log(`Initializing ${chalk.cyan(projectName)}\n`);
const directoryExists = directories.directoryExists(projectName);
if (directoryExists) {
console.error(chalk.red('Directory already exist.\n'));
return;
}
}
const responses = await inquirer.askProjectInfo(projectName);
if (projectName) {
responses.name = projectName;
}
await repo.setupBoilerplate(responses);
console.log(chalk.green('Done!\n'));
console.log('To start the project:');
console.log(` cd ${chalk.green(responses.name)}`);
console.log(' meteor\n');
console.log(`Thank you for using ${chalk.yellow('Tableside')}.`);
console.log(`Have fun with ${chalk.cyan(responses.name)}!\n`);
} catch (err) {
if (err) {
console.log(chalk.red(err));
}
}
};
run();