-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·48 lines (44 loc) · 1.14 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
#! /usr/bin/env node
import inquirer from "inquirer";
import {exec} from "child_process";
import chalk from "chalk";
const templates = [
"push-video-starter-with-cra",
"push-video-starter-with-nextjs",
"push-dapp",
"push-website",
];
const questions = [
{
type: "list",
name: "template",
message: "Choose a template:",
choices: templates,
},
];
inquirer.prompt(questions).then((answers) => {
const selectedTemplate = answers.template;
exec(
`git clone https://github.com/push-protocol/${selectedTemplate}.git`,
(error, stdout, stderr) => {
if (error) {
console.error(chalk.red(`Error: ${error.message}`));
return;
}
console.log(
chalk.green(`Cloned ${selectedTemplate} template successfully.`)
);
console.log("-------------------------------------------------");
console.log(chalk.greenBright(`cd ${selectedTemplate} && npm install`));
console.log(
chalk.greenBright(
`npm run ${
selectedTemplate === "push-video-starter-with-nextjs"
? "dev"
: "start"
}`
)
);
}
);
});