create-koii-fundraise
Version:
Create your own Koii Fundraiser DApp - https://koii.network
61 lines (47 loc) • 1.77 kB
JavaScript
const packageJson = require("./package.json");
const chalk = require("chalk");
const commander = require("commander");
console.log("Installing Koii Fundraiser App...");
const boxen = require("boxen");
const package = `${chalk.white.bold(
`${packageJson.name} v${packageJson.version}`
)}`;
const nodeVersion = `${chalk.green(`Node: ${process.version}`)}`;
const description = `${chalk.blue.bold(`${packageJson.description}`)}`;
const labels = package + "\n" + description + "\n" + nodeVersion + " ";
const boxenOptions = {
padding: 1,
margin: 1,
borderStyle: "classic",
borderColor: "green",
backgroundColor: "#555555",
align: "center",
};
const msgBox = boxen(labels, boxenOptions);
console.log(msgBox);
let projectName;
const program = new commander.Command(packageJson.name)
.version(packageJson.version)
.arguments("[project-directory]")
.usage(`${chalk.green("<project-directory>")}`)
.action((name) => {
projectName = name || "Koii-Fundraiser";
});
program.parse(process.argv);
// .option("--typescript", "ts");
const execSync = require("child_process").execSync;
execSync(`mkdir ${projectName}`);
execSync(
`git clone https://github.com/koii-network/crowdfunding.git ${projectName}`
)
.toString()
.trim();
console.log(chalk.green("Installing dependencies..."));
execSync(`cd ${projectName} && yarn install --ignore-engines`);
console.log(chalk.blueBright.bold("yarn start" + " \n " + "to start the app"));
console.log(chalk.blueBright.bold("yarn test", " \n ", "to run the tests"));
console.log(chalk.green.bold("We suggest that you begin by typing: "));
console.log(chalk.white.bold(`cd ${projectName}`));
console.log(chalk.green.bold("yarn start"));
console.log(chalk.white.bold("Happy hacking"));