async function promptConfigSettings()

in src/cli/commands/init/init.ts [163:256]


async function promptConfigSettings(disablePrompts: boolean, detectedConfig: FrameworkConfig): Promise<FrameworkConfig> {
  const trimValue = (value: string) => {
    value = value.trim();
    return value === "" ? undefined : value;
  };

  const response = await promptOrUseDefault(disablePrompts, [
    {
      type: "text",
      name: "appLocation",
      message: "What's your app location?",
      initial: detectedConfig.appLocation,
      validate: (value: string) => value.trim() !== "" || "App location cannot be empty",
      format: trimValue,
    },
    {
      type: "text",
      name: "outputLocation",
      message: "What's your build output location?",
      hint: "If your app doesn't have a build process, use the same location as your app",
      initial: detectedConfig.outputLocation,
      validate: (value: string) => value.trim() !== "" || "Output location cannot be empty",
      format: trimValue,
    },
    {
      type: "text",
      name: "apiLocation",
      message: "What's your API location? (optional)",
      initial: detectedConfig.apiLocation,
      format: trimValue,
    },
    {
      type: (prev) => (prev != null ? "select" : null),
      name: "apiLanguage",
      message: "What's your API language? (optional)",
      choices: [
        { title: "Node.js", value: "node" },
        { title: "Python", value: "python" },
        { title: "Dotnet", value: "dotnet" },
        { title: "Dotnet isolated", value: "dotnetisolated" },
      ],
    },
    {
      type: (prev) => (prev != null ? "select" : null),
      name: "apiVersion",
      message: "What's your API version? (optional)",
      choices: (prev) => getChoicesForApiLanguage(prev),
    },
    {
      type: "text",
      name: "dataApiLocation",
      message: "What's your data API location? (optional)",
      initial: detectedConfig.dataApiLocation,
      format: trimValue,
    },
    {
      type: "text",
      name: "appBuildCommand",
      message: "What command do you use to build your app? (optional)",
      initial: detectedConfig.appBuildCommand,
      format: trimValue,
    },
    {
      type: "text",
      name: "apiBuildCommand",
      message: "What command do you use to build your API? (optional)",
      initial: detectedConfig.apiBuildCommand,
      format: trimValue,
    },
    {
      type: "text",
      name: "appDevserverCommand",
      message: "What command do you use to run your app for development? (optional)",
      initial: detectedConfig.appDevserverCommand,
      format: trimValue,
    },
    {
      type: "text",
      name: "appDevserverUrl",
      message: "What's your app development server URL (optional)",
      initial: detectedConfig.appDevserverUrl,
      format: trimValue,
    },
    {
      type: "text",
      name: "apiDevserverUrl",
      message: "What's your API development server URL (optional)",
      initial: detectedConfig.apiDevserverUrl,
      format: trimValue,
    },
  ]);

  return response;
}