feat: 完成 v0.6.0 墨呈品牌迁移
This commit is contained in:
@@ -3,14 +3,25 @@ import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
interface PackageManifest {
|
||||
version?: string;
|
||||
productName?: string;
|
||||
scripts?: Record<string, string>;
|
||||
}
|
||||
|
||||
interface ProductBrand {
|
||||
appId: string;
|
||||
englishName: string;
|
||||
displayName: string;
|
||||
windowTitle: string;
|
||||
executableName: string;
|
||||
artifactPrefix: string;
|
||||
}
|
||||
|
||||
const desktopRoot = fileURLToPath(new URL("../", import.meta.url));
|
||||
const projectRoot = fileURLToPath(new URL("../../../", import.meta.url));
|
||||
|
||||
function readManifest(path: string): PackageManifest {
|
||||
return JSON.parse(readFileSync(path, "utf8")) as PackageManifest;
|
||||
function readManifest<T = PackageManifest>(path: string): T {
|
||||
return JSON.parse(readFileSync(path, "utf8")) as T;
|
||||
}
|
||||
|
||||
describe("桌面发行构建链", () => {
|
||||
@@ -58,6 +69,49 @@ describe("桌面发行构建链", () => {
|
||||
expect(builderConfig).toContain('to: "samples"');
|
||||
});
|
||||
|
||||
it("保持安装身份并从统一配置生成 MorphDoc 发行名称", () => {
|
||||
const brand = readManifest<ProductBrand>(
|
||||
`${projectRoot}/product.json`
|
||||
);
|
||||
const desktopManifest = readManifest(
|
||||
`${desktopRoot}/package.json`
|
||||
);
|
||||
const builderConfig = readFileSync(
|
||||
`${desktopRoot}/electron-builder.config.cjs`,
|
||||
"utf8"
|
||||
);
|
||||
const installerInclude = readFileSync(
|
||||
`${desktopRoot}/build/installer.nsh`,
|
||||
"utf8"
|
||||
);
|
||||
|
||||
expect(brand).toMatchObject({
|
||||
appId: "com.md-to-pdf.desktop",
|
||||
englishName: "MorphDoc",
|
||||
displayName: "墨呈",
|
||||
windowTitle: "墨呈 · MorphDoc",
|
||||
executableName: "MorphDoc",
|
||||
artifactPrefix: "MorphDoc"
|
||||
});
|
||||
expect(desktopManifest).toMatchObject({
|
||||
version: "0.6.0",
|
||||
productName: "MorphDoc"
|
||||
});
|
||||
expect(builderConfig).toContain("appId: brand.appId");
|
||||
expect(builderConfig).toContain("productName: brand.englishName");
|
||||
expect(builderConfig).toContain("executableName: brand.executableName");
|
||||
expect(builderConfig).toContain("shortcutName: brand.displayName");
|
||||
expect(installerInclude).toContain(
|
||||
'!define MORPHDOC_EXECUTABLE "MorphDoc.exe"'
|
||||
);
|
||||
expect(installerInclude).toContain(
|
||||
'!define MORPHDOC_DISPLAY_NAME "墨呈"'
|
||||
);
|
||||
expect(installerInclude).toContain(
|
||||
"Software\\Classes\\Applications\\${MORPHDOC_LEGACY_EXECUTABLE}"
|
||||
);
|
||||
});
|
||||
|
||||
it("仅在组合构建时接入经过哈希校验的同目录字体包", () => {
|
||||
const builderConfig = readFileSync(
|
||||
`${desktopRoot}/electron-builder.config.cjs`,
|
||||
|
||||
Reference in New Issue
Block a user