upgradePackage

tcmts.studio.upgradePackage · #usw25igb · term · runs on the server

uses tcmts.studio.editableCodebase, which uses tcmts.share.servedCodebase, which uses process

Move package name to the newest versions in the ranges the codebase runs it at, as tcm upgrade <name> does (it's run: no hash changes, everything using it is checked again, and if anything breaks the lock goes back): what it said.

import { packageList } from "#codebase/tcmts/cli/package_pages";
import { HttpError } from "#codebase/tcmts/server";
import { editableCodebase, runTcm } from "#codebase/tcmts/studio";

export async function upgradePackage(name: string): Promise<string> {
  const cb = editableCodebase();
  if (!packageList(cb).some((p) => p.name === name))
    throw new HttpError(404, `The codebase doesn't run ${name}.`);
  const out = await runTcm(cb.lay.root, ["upgrade", name], { branch: true });
  if (out.code !== 0)
    throw new HttpError(
      400,
      out.text.split("\n").slice(0, 10).join("\n") || `tcm upgrade ${name} failed`,
    );
  return out.text.split("\n").slice(0, 3).join("\n") || `${name} is as new as its ranges go.`;
}

uses

used by