makeRelease
uses tcmts.studio.editableCodebase, which uses tcmts.share.servedCodebase, which uses process
Release name at the version its changes call for, as tcm release <name> does (it's run, in the codebase's
directory: its notes from the draft if there is one, a mirror's record of it, all as the command makes them). Only
for the studio's maintainer, and only on main, the codebase's own branch: releases are main's. Says what the command
said, or why it refused.
import { publishingList } from "#codebase/tcmts/cli/release_pages"; import { HttpError } from "#codebase/tcmts/server"; import { editableCodebase, runTcm } from "#codebase/tcmts/studio"; export async function makeRelease(name: string): Promise<string> { const cb = editableCodebase(); if (cb.store.branch().name !== "main") throw new HttpError( 409, `Releases are made on main: this codebase is on ${cb.store.branch().name}.`, ); if (!publishingList(cb).some((p) => p.name === name)) throw new HttpError(404, `There's no package named ${name}.`); const out = await runTcm(cb.lay.root, ["release", name]); if (out.code !== 0) throw new HttpError( 400, out.text.split("\n").slice(0, 6).join("\n") || `tcm release ${name} failed`, ); return out.text.split("\n")[0]!; }
uses
- tcmts.cli.release_pages.publishingList
- tcmts.server.HttpError
- tcmts.studio.editableCodebase
- tcmts.studio.runTcm