nestia
Version:
Nestia CLI tool
46 lines • 2.24 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NestiaTemplate = void 0;
const child_process_1 = __importDefault(require("child_process"));
const fs_1 = __importDefault(require("fs"));
var NestiaTemplate;
(function (NestiaTemplate) {
NestiaTemplate.clone = (halter) => (argv) => __awaiter(this, void 0, void 0, function* () {
// VALIDATION
const dest = argv[0];
if (dest === undefined)
halter();
else if (fs_1.default.existsSync(dest) === true)
halter("The target directory already exists.");
console.log("-----------------------------------------");
console.log(" Nestia Template Kit");
console.log("-----------------------------------------");
// COPY PROJECTS
execute(`git clone https://github.com/samchon/backend ${dest}`);
console.log(`cd "${dest}"`);
process.chdir(dest);
// INSTALL DEPENDENCIES
execute("npm install");
// BUILD TYPESCRIPT
execute("npm run build");
// REMOVE .GIT DIRECTORY
child_process_1.default.execSync("npx rimraf .git");
});
function execute(command) {
console.log(`\n$ ${command}`);
child_process_1.default.execSync(command, { stdio: "inherit" });
}
})(NestiaTemplate || (exports.NestiaTemplate = NestiaTemplate = {}));
//# sourceMappingURL=NestiaTemplate.js.map