UNPKG

create-node-blueprint

Version:

A cli tool to generate nodejs project

53 lines (52 loc) 2.46 kB
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()); }); }; import { getOrm } from "./get-orm.js"; import { getDatabase } from "./get-database.js"; import { getFeatures } from "./get-features.js"; import { getFramework } from "./get-framework.js"; import { getProjectName } from "./get-project-name.js"; import { getInitializeGit } from "./get-initialize-git.js"; import { getInstallDependencies } from "./get-install-deps.js"; import { getAuth } from "./get-auth.js"; export function prompt() { return __awaiter(this, void 0, void 0, function* () { var _a; try { const projectName = yield getProjectName(); const framework = yield getFramework(); const database = yield getDatabase(); const orm = yield getOrm(database); const auth = yield getAuth(); const features = yield getFeatures(); const initializeGit = yield getInitializeGit(); const installDeps = yield getInstallDependencies(); return { projectName: projectName, framework: framework, database: database, orm: orm, auth: auth, features: features, installDependencies: installDeps, initializeGit: initializeGit }; } catch (error) { if (((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes("ExitPromptError")) || (error === null || error === void 0 ? void 0 : error.name) === "ExitPromptError") { console.log("\nPrompt cancelled. Goodbye!"); process.exit(0); } else { console.error("An error occurred:", error.message); } return process.exit(1); } }); }