create-app-setup
Version:
A CLI tool to quickly set up frontend & backend projects with various frameworks.
28 lines (27 loc) ā¢ 1.07 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const path_1 = __importDefault(require("path"));
const startProcess_1 = require("./action/startProcess");
const Chalk_1 = require("./helper/Chalk");
const program = new commander_1.Command();
// Path of the Directory where the templates are stored
const TEMPLATES_DIR = path_1.default.join(__dirname, "templates");
// Configuration
program.version("0.0.2");
// Command
program.argument("<projectName>").action((projectName) => {
(0, startProcess_1.startProcess)(projectName, TEMPLATES_DIR);
});
// Custom exit handler
const handleExit = () => {
console.log(Chalk_1.chalk.red("\nš Exiting the setup process..."));
process.exit(0); // Exit with code 0 (success)
};
// Listen for Ctrl+C (SIGINT) event to handle user exit
process.on("SIGINT", handleExit);
program.parse(process.argv);
;