GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: //usr/local/lib/node_modules/firebase-tools/lib/apphosting/utils.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.promptForAppHostingYaml = exports.getEnvironmentName = void 0;
const error_1 = require("../error");
const config_1 = require("./config");
const prompt = require("../prompt");
function getEnvironmentName(apphostingYamlFileName) {
    const found = apphostingYamlFileName.match(config_1.APPHOSTING_YAML_FILE_REGEX);
    if (!found || found.length < 2 || !found[1]) {
        throw new error_1.FirebaseError("Invalid apphosting environment file");
    }
    return found[1].replaceAll(".", "");
}
exports.getEnvironmentName = getEnvironmentName;
async function promptForAppHostingYaml(apphostingFileNameToPathMap, promptMessage = "Please select an App Hosting config:") {
    const fileNames = Array.from(apphostingFileNameToPathMap.keys());
    const baseFilePath = apphostingFileNameToPathMap.get(config_1.APPHOSTING_BASE_YAML_FILE);
    const listOptions = fileNames.map((fileName) => {
        if (fileName === config_1.APPHOSTING_BASE_YAML_FILE) {
            return {
                name: `base (${config_1.APPHOSTING_BASE_YAML_FILE})`,
                value: baseFilePath,
            };
        }
        const environment = getEnvironmentName(fileName);
        return {
            name: baseFilePath
                ? `${environment} (${config_1.APPHOSTING_BASE_YAML_FILE} + ${fileName})`
                : `${environment} (${fileName})`,
            value: apphostingFileNameToPathMap.get(fileName),
        };
    });
    const fileToExportPath = await prompt.promptOnce({
        name: "apphosting-yaml",
        type: "list",
        message: promptMessage,
        choices: listOptions,
    });
    return fileToExportPath;
}
exports.promptForAppHostingYaml = promptForAppHostingYaml;