mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
7b949d3d3c
Stabilize Bun compile on 1.2.19, align manifests with OSS consumers, and split gh / webhook / mode helpers out of binary-release.
30 lines
993 B
JavaScript
30 lines
993 B
JavaScript
/**
|
|
* Shared mode / channel / manifest naming for binary-build and binary-release.
|
|
*/
|
|
import { assertChannel } from "./validate.mjs";
|
|
|
|
/**
|
|
* @param {string} mode
|
|
* @param {string | null | undefined} channel
|
|
* @returns {{ mode: "stable" | "channel", channel: string | null }}
|
|
*/
|
|
export function normalizeModeChannel(mode = "stable", channel = null) {
|
|
if (mode !== "stable" && mode !== "channel") {
|
|
throw new Error(`--mode must be stable or channel, got: ${mode}`);
|
|
}
|
|
if (mode === "channel") {
|
|
if (!channel) throw new Error("--mode channel requires --channel <name>");
|
|
assertChannel(channel);
|
|
if (channel === "stable") {
|
|
throw new Error(`--channel cannot be "stable"; use --mode stable`);
|
|
}
|
|
return { mode, channel };
|
|
}
|
|
return { mode: "stable", channel: null };
|
|
}
|
|
|
|
/** Manifest basename written to dist-bin / uploaded to Releases. */
|
|
export function manifestFileName(mode, channel) {
|
|
return mode === "stable" ? "latest.json" : `${channel}.json`;
|
|
}
|