-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·41 lines (30 loc) · 1.08 KB
/
index.js
File metadata and controls
executable file
·41 lines (30 loc) · 1.08 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
#!/usr/bin/env node
import chalk from "chalk";
import inquirer from "inquirer";
import { Command } from "commander";
import { setupProjectDirectory } from "./src/utils/setup-project.js";
import { setupChain } from "./src/utils/setup-chain.js";
import { logo } from "./src/utils/ascii-art.js";
import { projectNamePrompt } from "./src/prompts/project-prompts.js";
import { printOutroMessage } from "./src/utils/outro.js";
import { checkNodeVersion } from "./src/utils/version-check.js";
const program = new Command();
program
.option("-c, --chain <chain>", "specify the chain to use")
.parse(process.argv);
const options = program.opts();
async function handleNewProject() {
console.log(chalk.blue(logo));
const { projectName } = await inquirer.prompt([projectNamePrompt]);
const { projectDir } = await setupProjectDirectory(projectName, inquirer);
await setupChain(projectDir, options);
await printOutroMessage(projectName);
}
async function main() {
await handleNewProject();
checkNodeVersion();
}
main().catch((error) => {
console.error(chalk.red("Error:"), error);
process.exit(1);
});