feat: publish changed packages independently
This commit is contained in:
@@ -79,24 +79,7 @@ export function repairProject(appRoot: string): DoctorRepair[] {
|
||||
try {
|
||||
const source = readFileSync(pkgPath, "utf8");
|
||||
const pkg = JSON.parse(source) as Record<string, unknown>;
|
||||
const ranges = frameworkRanges(pkg);
|
||||
const preferred = [...ranges.keys()].sort((left, right) => {
|
||||
const a = parseVersion(left);
|
||||
const b = parseVersion(right);
|
||||
return b[0] - a[0] || b[1] - a[1] || b[2] - a[2];
|
||||
})[0];
|
||||
let changed = false;
|
||||
if (preferred && ranges.size > 1) {
|
||||
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
||||
const dependencies = pkg[field] as Record<string, string> | undefined;
|
||||
for (const name of Object.keys(dependencies ?? {})) {
|
||||
if (name.startsWith("@wrnexus/") && dependencies![name] !== preferred) {
|
||||
dependencies![name] = preferred;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const marker = (pkg.wrnexus as Record<string, unknown> | undefined) ?? {};
|
||||
if (!marker.version || !versionAtLeast(String(marker.version), "0.8.0")) {
|
||||
marker.version = "0.8.0";
|
||||
@@ -108,9 +91,7 @@ export function repairProject(appRoot: string): DoctorRepair[] {
|
||||
repairs.push({
|
||||
name: "package.json",
|
||||
changed: true,
|
||||
detail: preferred
|
||||
? `aligned framework packages to ${preferred}`
|
||||
: "recorded 0.8.0 marker",
|
||||
detail: "recorded 0.8.0 migration marker",
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
@@ -154,15 +135,13 @@ export function inspectProject(appRoot: string): DoctorCheck[] {
|
||||
try {
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as Record<string, unknown>;
|
||||
const ranges = frameworkRanges(pkg);
|
||||
const invalid = [...ranges.keys()].filter((range) => !/[~^]?\d+\.\d+\.\d+/.test(range));
|
||||
checks.push({
|
||||
name: "framework package versions",
|
||||
ok: ranges.size <= 1,
|
||||
detail:
|
||||
ranges.size <= 1
|
||||
? ([...ranges.keys()][0] ?? "No @wrnexus packages declared")
|
||||
: `version skew: ${[...ranges.entries()]
|
||||
.map(([range, names]) => `${range} (${names.join(", ")})`)
|
||||
.join("; ")}`,
|
||||
ok: invalid.length === 0,
|
||||
detail: invalid.length
|
||||
? `invalid ranges: ${invalid.join(", ")}`
|
||||
: `${[...ranges.values()].reduce((count, names) => count + names.length, 0)} independently versioned package(s)`,
|
||||
});
|
||||
const marker = (pkg.wrnexus as { version?: string } | undefined)?.version;
|
||||
checks.push({
|
||||
|
||||
Reference in New Issue
Block a user