UNPKG

convex

Version:

Client for the Convex Cloud

87 lines (86 loc) 3.1 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var reinit_exports = {}; __export(reinit_exports, { reinit: () => reinit }); module.exports = __toCommonJS(reinit_exports); var import_context = require("../../bundler/context.js"); var import_api = require("./api.js"); var import_codegen = require("./codegen.js"); var import_config = require("./config.js"); var import_deployment = require("./deployment.js"); var import_init = require("./init.js"); var import_utils = require("./utils.js"); async function reinit(ctx, deploymentType = "prod", config) { const { teamSlug } = await (0, import_utils.validateOrSelectTeam)(ctx, config.team, "Team:"); const projectSlug = await (0, import_utils.validateOrSelectProject)( ctx, config.project, teamSlug, "Configure project", "Project:" ); if (!projectSlug) { (0, import_context.logFailure)(ctx, "Run the command again to create a new project instead."); await ctx.crash(1); return; } (0, import_context.showSpinner)(ctx, `Reinitializing project ${projectSlug}... `); const { deploymentName, url, adminKey } = await (0, import_api.fetchDeploymentCredentialsProvisioningDevOrProd)( ctx, { teamSlug, projectSlug }, deploymentType ); const { configPath, projectConfig: existingProjectConfig } = await (0, import_config.readProjectConfig)(ctx); const functionsPath = (0, import_utils.functionsDir)((0, import_config.configName)(), existingProjectConfig); const { wroteToGitIgnore } = await (0, import_deployment.writeDeploymentEnvVar)( ctx, deploymentType, { team: teamSlug, project: projectSlug, deploymentName } ); const projectConfig = await (0, import_config.upgradeOldAuthInfoToAuthConfig)( ctx, existingProjectConfig, functionsPath ); await (0, import_config.writeProjectConfig)(ctx, projectConfig, { deleteIfAllDefault: true }); await (0, import_codegen.doCodegen)({ ctx, functionsDirectoryPath: (0, import_utils.functionsDir)(configPath, projectConfig), typeCheckMode: "disable", quiet: true }); await (0, import_init.finalizeConfiguration)( ctx, (0, import_utils.functionsDir)(configPath, projectConfig), deploymentType, url, wroteToGitIgnore ); return { deploymentName, url, adminKey }; } //# sourceMappingURL=reinit.js.map