@aditya6838/angular-starter
Version:
1. make changes 2. change version 3. run `npm i`
37 lines (25 loc) • 971 B
JavaScript
const { execSync } = require("child_process");
const runCommand = (command) => {
try {
execSync(`${command}`, { stdio: `inherit` });
} catch (e) {
console.error(`Failed to execute ${command}`, e);
return false;
}
return true;
};
let repoName = process.argv[2];
if(repoName === undefined) repoName = 'angular-app';
const gitCheckoutCommand = `git clone --depth 1 https://github.com/Khot-Aditya/Angular-Tailwindcss ${repoName}`;
const installDepsCommand = `cd ${repoName} && npm install`;
console.log(`Cloning the repository with name ${repoName}`);
const checkedOut = runCommand(gitCheckoutCommand);
if (!checkedOut) process.exit(-1);
console.log(`Installing dependencies for ${repoName}`);
const installDeps = runCommand(installDepsCommand);
if (!installDeps) process.exit(-1);
console.log(
"Congratulations! You are ready. Follow the following commands to start"
);
console.log(`cd ${repoName} && ng serve --open`);