UNPKG

@supernovaio/cli

Version:

Supernova.io Command Line Interface

30 lines (28 loc) 1.66 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0c49f3f6-0a06-53b6-b0c8-0711729398a5")}catch(e){}}(); import inquirer from "inquirer"; import path from "node:path"; import { colorize } from "../../ui.js"; export async function promptTemplateDestination(input) { const cwd = process.cwd(); const fallbackPath = path.resolve(cwd, `supernova-container-${input.framework.toLowerCase()}`); const suggestedPath = path.resolve(input.defaultDestinationPath ?? fallbackPath); const relativeSuggestedPath = path.relative(cwd, suggestedPath); const promptDefaultValue = relativeSuggestedPath && !relativeSuggestedPath.startsWith("..") && !path.isAbsolute(relativeSuggestedPath) ? relativeSuggestedPath : suggestedPath; input.log("A new folder will be created at this location with the container template inside for further setup."); const response = await inquirer.prompt([ { default: promptDefaultValue, message: colorize("Where should we create the container?", "blue"), name: "templateDestinationPath", type: "input", }, ]); const rawTemplateDestinationPath = response.templateDestinationPath.trim(); if (!rawTemplateDestinationPath) input.error("Template destination path is required."); return path.resolve(rawTemplateDestinationPath); } //# sourceMappingURL=prompts.js.map //# debugId=0c49f3f6-0a06-53b6-b0c8-0711729398a5