UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

37 lines (36 loc) 1.37 kB
async function undeployStudio(args, context) { const { apiClient, chalk, output, prompt } = context, client = apiClient({ requireUser: !0, requireProject: !0 }); let spinner = output.spinner("Checking project info").start(); const project = await client.projects.getById(client.config().projectId), studioHost = project && project.studioHost; if (spinner.succeed(), !studioHost) { output.print("Your project has not been assigned a studio hostname."), output.print("Nothing to undeploy."); return; } output.print(""); const url = `https://${chalk.yellow(studioHost)}.sanity.studio`; if (!await prompt.single({ type: "confirm", default: !1, message: `This will undeploy ${url} and make it unavailable for your users. The hostname will be available for anyone to claim. Are you ${chalk.red("sure")} you want to undeploy?`.trim() })) return; const uri = `/projects/${client.config().projectId}`; spinner = output.spinner("Undeploying studio").start(); try { await client.request({ uri, method: "PATCH", body: { studioHost: null } }), spinner.succeed(); } catch (err) { throw spinner.fail(), err; } output.print( `Studio undeploy scheduled. It might take a few minutes before ${url} is unavailable.` ); } export { undeployStudio as default }; //# sourceMappingURL=undeployAction.js.map