UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

34 lines (32 loc) • 1.54 kB
import { colors } from "../utils/theme.mjs"; import { compareSemver, getStatus, pickDistTagVersion, resolveUpdateDistTag } from "../services/status.mjs"; //#region src/cli/status.ts /** Outdated-framework warning, printed after the command's status probe. */ async function warnIfOutdated(client, command) { if (![ "dev", "build", "start" ].includes(command)) return; try { const status = await client.status(); if (status.status === "error" || !status.packages) return; const frameworkPackages = ["everything-dev", "every-plugin"]; const linked = status.packages.filter((p) => p.isLinked); const outdated = status.packages.filter((p) => !p.isLinked && p.installed && p.latest && compareSemver(p.installed, p.latest) < 0 && frameworkPackages.includes(p.name)); if (linked.length > 0) for (const pkg of linked) console.log(colors.dim(` ${pkg.name} is linked locally (v${pkg.installed})`)); if (outdated.length === 0) return; const warn = (line) => { if (command === "dev" || command === "start") process.stderr.write(`${line}\n`); else console.log(line); }; warn(""); warn(colors.yellow(` ! Outdated packages detected:`)); for (const pkg of outdated) warn(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`)); warn(colors.dim(` Run ${colors.cyan("bos upgrade")} to update packages and sync template files.`)); warn(""); } catch {} } //#endregion export { compareSemver, getStatus, pickDistTagVersion, resolveUpdateDistTag, warnIfOutdated }; //# sourceMappingURL=status.mjs.map