runUpgrade
uses tcmts.cli.main.execute, which uses tcmts.cli.help.usageError, which uses tcmts.cli.help.usageOf, which uses tcmts.cli.style.bold, which uses node:util
Runs tcm upgrade.
import { routeUpgrade } from "#codebase/tcmts/cli/commands"; import { execute } from "#codebase/tcmts/cli/main"; import type { Context } from "#codebase/tcmts/cli/run"; import { choose } from "#codebase/tcmts/cli/ui"; import { upgradeTo, upgradeWithin } from "#codebase/tcmts/cli/upgrade"; import { parse } from "@bomb.sh/router"; export async function runUpgrade({ cb, cmd, rest }: Context): Promise<number> { const { model } = execute(cmd, parse(routeUpgrade(), { argv: rest })); const spec = model.package ?? (await choose( "upgrade <package>[@range|@latest] [namespace] [--force]", "Upgrade which package?", [ ...new Map( cb.store .lockedPackages() .filter((l) => !l.name.startsWith("@types/")) .map((l) => [l.name, l]), ).values(), ].map((l) => ({ value: l.name, label: l.name, hint: `${l.range} → ${l.version}` })), )); const at = spec.lastIndexOf("@"); const [name, target] = at > 0 ? [spec.slice(0, at), spec.slice(at + 1)] : [spec, undefined]; const ok = target ? upgradeTo(cb, name, target, model.namespace) : upgradeWithin(cb, name, model.force); if (ok) cb.refreshShim(); return ok ? 0 : 1; }
uses
- tcmts.cli.commands.routeUpgrade
- tcmts.cli.main.execute
- tcmts.cli.run.Context
- tcmts.cli.ui.choose
- tcmts.cli.upgrade.upgradeTo
- tcmts.cli.upgrade.upgradeWithin