UNPKG

create-web3-dapp-dev

Version:

<p align="center"> <br /> <a href="https://createweb3dapp.alchemy.com"> <img src=".github/images/cw3d-logo.png" width="200" alt=""/></a> <br /> </p>

69 lines 2.73 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 context from "../core/context.js"; import prompts from "prompts"; import open from "open"; export var FileExtensions; (function (FileExtensions) { FileExtensions["JAVASCRIPT"] = "js"; FileExtensions["TYPESCRIPT"] = "ts"; })(FileExtensions || (FileExtensions = {})); const templates = { "nft-explorer": { id: "nft-explorer", hasTypescript: false, repository: "https://github.com/alchemyplatform/cw3d-nft-explorer.git", }, }; export const getTemplateSpecs = (templateName) => __awaiter(void 0, void 0, void 0, function* () { const template = templates[templateName]; if (template) { if (template.useBackend) { context.dappInfo.useBackend = template.useBackend; context.dappInfo.backendProvider = template.backendProvider; } context.dappInfo.template = template.id; context.dappInfo.isTemplate = true; if (template.extraSteps) { for (const extraStep of template.extraSteps) { if (extraStep.open) { open(extraStep.open); } const answer = yield prompts({ type: "text", name: "input", message: extraStep.question, }); context.dappInfo.apiKeys[extraStep.contextKey] = answer.input; } } return true; } return false; }); export const getTemplateFiles = (templateName, fileExtension = FileExtensions.JAVASCRIPT) => { if (supportsTypescript(templateName) && fileExtension == FileExtensions.TYPESCRIPT) { return templates[templateName].typescriptRepository; } else if (templates[templateName]) { return templates[templateName].repository; } else { return false; } }; export const supportsTypescript = (templateName) => { if (templates[templateName]) { return templates[templateName].hasTypescript; } return false; }; //# sourceMappingURL=templatesDB.js.map