-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
29 lines (22 loc) · 965 Bytes
/
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
#!/usr/bin/env node
const { execSync } = require('child_process');
const runCommand = (cmd) => {
try {
execSync(cmd, { stdio: 'inherit' });
} catch (error) {
console.log(`Failed to execute ${error}`);
return false;
}
return true;
};
console.log('Cloning the repository');
const repoName = process.argv[2];
const gitCheckoutCommand = `git clone --depth 1 https://github.com/MonoInfinity/mono-node-kit-ts.git ${repoName}`;
const installDepsCommand = `cd ${repoName} && npm install win-node-env -g && npm install yarn -g && yarn install`;
const checkoutCmd = runCommand(gitCheckoutCommand);
if (!checkoutCmd) process.exit(-1);
console.log('Install all dependencies');
const installCmd = runCommand(installDepsCommand);
if (!installCmd) process.exit(-1);
console.log('----------------------------------------------');
console.log(`%c Let's create your awesome server 🍀🍀🍀 `, 'color: #047867');