UNPKG

engine-express-ts-setup

Version:

This is a Express Setup Boiler Plate with Typescript configured

36 lines (30 loc) 964 B
#! /usr/bin/env node import fs from "fs"; import path from "path"; import { exec } from "child_process"; import { promisify } from "util"; import { chdir, stderr, stdout } from "process"; const commands = process.argv; const folderName = commands?.[2]; const asyncExec = promisify(exec); const command = (folder = "") => `git clone https://github.com/Angryman18/node-express-npm.git ${folder}`; if (!folderName) { console.log("Folder name not found, creating into root"); process.exit(1); } console.log("Please Wait"); asyncExec(command(folderName)) .then((res) => { console.log("Installing Dependencies..."); chdir(folderName); exec("yarn install", (err, stdout) => { if (err) return console.log(err); exec("git remote remove origin"); return console.log(stdout); }); }) .catch((err) => { console.log("Error Occured", err?.message); exec(`rm -rf ${folderName}`); });