mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-01 06:02:56 +00:00
* Serve the web client from the daemon Keep the bundled browser UI opt-in and exclude it from desktop packaging so desktop builds do not ship a duplicate renderer. * Escape daemon web UI bootstrap hint * Fix bundled web UI dist path
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
|
|
describe("desktop packaging", () => {
|
|
it("unpacks server zsh shell integration files for external shells", () => {
|
|
const config = readFileSync(join(packageRoot, "electron-builder.yml"), "utf8");
|
|
|
|
expect(config).toContain(
|
|
"node_modules/@getpaseo/server/dist/server/terminal/shell-integration/**/*",
|
|
);
|
|
expect(config).not.toContain(
|
|
"node_modules/@getpaseo/server/dist/src/terminal/shell-integration/**/*",
|
|
);
|
|
});
|
|
|
|
it("excludes package debug/source files from the packaged app", () => {
|
|
const config = readFileSync(join(packageRoot, "electron-builder.yml"), "utf8");
|
|
|
|
expect(config).toContain("!**/*.map");
|
|
expect(config).toContain("!node_modules/@getpaseo/*/src/**");
|
|
expect(config).toContain("!node_modules/@getpaseo/**/*.test.*");
|
|
expect(config).toContain("!node_modules/@getpaseo/**/*.spec.*");
|
|
});
|
|
|
|
it("excludes the bundled daemon web UI from the packaged app", () => {
|
|
const config = readFileSync(join(packageRoot, "electron-builder.yml"), "utf8");
|
|
|
|
expect(config).toContain("!node_modules/@getpaseo/server/dist/server/web-ui/**");
|
|
});
|
|
|
|
// electron-builder packs production dependencies declared in package.json into
|
|
// app.asar. Runtime code in runtime-paths.ts and bin/paseo dynamically resolves
|
|
// these workspace packages by string, so static analysis (TypeScript, Knip) cannot
|
|
// see the link. If a runtime-required workspace dep is dropped from
|
|
// dependencies, the build still succeeds but ships a broken bundle. This
|
|
// assertion is the safety net.
|
|
it("declares all workspace packages required at runtime", () => {
|
|
const pkg = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")) as {
|
|
dependencies?: Record<string, string>;
|
|
};
|
|
const deps = pkg.dependencies ?? {};
|
|
|
|
for (const required of ["@getpaseo/cli", "@getpaseo/server"]) {
|
|
expect(deps[required], `${required} must be declared in dependencies`).toBe("*");
|
|
}
|
|
});
|
|
});
|