mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* fix(pack): add missing download and host packages to Linux INTERNAL_PACKAGES The native (non-containerized) Linux AppImage build fails with npm 404 errors because @open-design/download and @open-design/host — runtime dependencies of @open-design/desktop and @open-design/web — were not included in the INTERNAL_PACKAGES list. Without tarballs for these two packages, npm install in the assembled app directory tries to resolve them from the public registry where they don't exist. Add both packages to INTERNAL_PACKAGES and their build steps to buildWorkspaceArtifacts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(pack): apply same download/host fix to mac and win lanes, add regression test 1. Extend the INTERNAL_PACKAGES fix to mac/constants.ts, mac/workspace.ts, win/constants.ts, and win/app.ts so all three pack lanes produce tarballs for @open-design/download and @open-design/host. 2. Add internal-packages-coverage.test.ts that derives required workspace runtime deps from apps/desktop and apps/web package.json files and asserts every pack lane's INTERNAL_PACKAGES includes them. This prevents the same drift from recurring when a new workspace dependency is added. 3. Update win-app.test.ts and workspace-build.test.ts mock directory lists to include the two new packages. * fix(pack): include runtime packages in workspace build cache * fix(pack): install platform with desktop prebundle packages --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Siri-Ray <2667192167@qq.com>
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const ROOT = join(fileURLToPath(import.meta.url), "..", "..", "..", "..");
|
|
|
|
type PackageJson = {
|
|
dependencies?: Record<string, string>;
|
|
};
|
|
|
|
function readPackageJson(relativePath: string): PackageJson {
|
|
return JSON.parse(readFileSync(join(ROOT, relativePath, "package.json"), "utf8")) as PackageJson;
|
|
}
|
|
|
|
function collectWorkspaceRuntimeDeps(relativePath: string): string[] {
|
|
const pkg = readPackageJson(relativePath);
|
|
if (pkg.dependencies == null) return [];
|
|
return Object.keys(pkg.dependencies).filter((name) => name.startsWith("@open-design/"));
|
|
}
|
|
|
|
function loadInternalPackageNames(modulePath: string): string[] {
|
|
const source = readFileSync(join(ROOT, modulePath), "utf8");
|
|
const matches = source.matchAll(/name:\s*"(@open-design\/[^"]+)"/g);
|
|
return [...matches].map((m) => m[1]!);
|
|
}
|
|
|
|
const PACKAGED_APPS = ["apps/desktop", "apps/web", "apps/packaged", "apps/daemon"];
|
|
const PACK_LANES = [
|
|
{ lane: "linux", file: "tools/pack/src/linux.ts" },
|
|
{ lane: "mac", file: "tools/pack/src/mac/constants.ts" },
|
|
{ lane: "win", file: "tools/pack/src/win/constants.ts" },
|
|
];
|
|
|
|
describe("INTERNAL_PACKAGES covers all workspace runtime deps", () => {
|
|
const requiredPackages = new Set<string>();
|
|
for (const app of PACKAGED_APPS) {
|
|
for (const dep of collectWorkspaceRuntimeDeps(app)) {
|
|
requiredPackages.add(dep);
|
|
}
|
|
}
|
|
|
|
for (const { lane, file } of PACK_LANES) {
|
|
it(`${lane} lane includes all required workspace packages`, () => {
|
|
const declared = new Set(loadInternalPackageNames(file));
|
|
const missing = [...requiredPackages].filter((pkg) => !declared.has(pkg));
|
|
expect(missing, `${lane} INTERNAL_PACKAGES is missing: ${missing.join(", ")}`).toEqual([]);
|
|
});
|
|
}
|
|
});
|