feat: 完成 v0.6.0 墨呈品牌迁移
This commit is contained in:
+2
-2
@@ -17,9 +17,9 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="description"
|
||||
content="可配置、可主题化的 Markdown PDF 导出工具"
|
||||
content="面向结构化 Markdown 的主题化文档创作与发布工具"
|
||||
/>
|
||||
<title>Markdown PDF 导出器</title>
|
||||
<title>墨呈 · MorphDoc</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -44,6 +44,10 @@ import {
|
||||
type PdfExportRequest
|
||||
} from "./pdf-export";
|
||||
import { APP_VERSION_LABEL } from "./app-version";
|
||||
import {
|
||||
APP_DISPLAY_NAME,
|
||||
APP_SLOGAN
|
||||
} from "./app-brand";
|
||||
import { getSyncedScrollTop } from "./scroll-sync";
|
||||
import {
|
||||
loadPreviewZoom,
|
||||
@@ -1487,9 +1491,9 @@ export function App() {
|
||||
<header className="topbar">
|
||||
<div className="topbar-primary">
|
||||
<div className="topbar-brand">
|
||||
<p className="eyebrow">内网文档工具</p>
|
||||
<p className="eyebrow">{APP_SLOGAN}</p>
|
||||
<div className="topbar-brand-title">
|
||||
<h1>Markdown PDF 导出器</h1>
|
||||
<h1>{APP_DISPLAY_NAME}</h1>
|
||||
<span className="app-version">{APP_VERSION_LABEL}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export const APP_DISPLAY_NAME = __APP_DISPLAY_NAME__;
|
||||
export const APP_WINDOW_TITLE = __APP_WINDOW_TITLE__;
|
||||
export const APP_SLOGAN = __APP_SLOGAN__;
|
||||
export const APP_DESCRIPTION = __APP_DESCRIPTION__;
|
||||
@@ -1,8 +1,12 @@
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { App } from "./App";
|
||||
import { APP_WINDOW_TITLE } from "./app-brand";
|
||||
import { APP_VERSION_LABEL } from "./app-version";
|
||||
import "./styles.css";
|
||||
|
||||
document.title = `${APP_WINDOW_TITLE} ${APP_VERSION_LABEL}`;
|
||||
|
||||
const rootElement = document.getElementById("root");
|
||||
|
||||
if (!rootElement) {
|
||||
|
||||
Vendored
+4
@@ -16,6 +16,10 @@ import type {
|
||||
|
||||
declare global {
|
||||
const __APP_VERSION__: string;
|
||||
const __APP_DISPLAY_NAME__: string;
|
||||
const __APP_WINDOW_TITLE__: string;
|
||||
const __APP_SLOGAN__: string;
|
||||
const __APP_DESCRIPTION__: string;
|
||||
|
||||
interface DesktopPdfResult {
|
||||
pdf: Uint8Array;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
APP_DESCRIPTION,
|
||||
APP_DISPLAY_NAME,
|
||||
APP_SLOGAN,
|
||||
APP_WINDOW_TITLE
|
||||
} from "../src/app-brand";
|
||||
|
||||
const webRoot = fileURLToPath(new URL("../", import.meta.url));
|
||||
|
||||
describe("产品品牌", () => {
|
||||
it("在主界面使用中文名和产品标语", () => {
|
||||
expect(APP_DISPLAY_NAME).toBe("墨呈");
|
||||
expect(APP_SLOGAN).toBe("一稿多式,即写即呈");
|
||||
expect(APP_WINDOW_TITLE).toBe("墨呈 · MorphDoc");
|
||||
expect(APP_DESCRIPTION).toBe(
|
||||
"面向结构化 Markdown 的主题化文档创作与发布工具"
|
||||
);
|
||||
});
|
||||
|
||||
it("在静态入口中移除旧工具名称", () => {
|
||||
const indexHtml = readFileSync(`${webRoot}/index.html`, "utf8");
|
||||
const mainSource = readFileSync(`${webRoot}/src/main.tsx`, "utf8");
|
||||
|
||||
expect(indexHtml).toContain("<title>墨呈 · MorphDoc</title>");
|
||||
expect(mainSource).toContain(
|
||||
"document.title = `${APP_WINDOW_TITLE} ${APP_VERSION_LABEL}`"
|
||||
);
|
||||
expect(indexHtml).not.toContain("Markdown PDF 导出器");
|
||||
expect(indexHtml).not.toContain("内网文档工具");
|
||||
});
|
||||
});
|
||||
@@ -10,8 +10,8 @@ const webRoot = fileURLToPath(new URL("../", import.meta.url));
|
||||
|
||||
describe("应用版本", () => {
|
||||
it("从统一构建版本生成标题徽标", () => {
|
||||
expect(APP_VERSION).toBe("0.5.1");
|
||||
expect(APP_VERSION_LABEL).toBe("v0.5.1");
|
||||
expect(APP_VERSION).toBe("0.6.0");
|
||||
expect(APP_VERSION_LABEL).toBe("v0.6.0");
|
||||
});
|
||||
|
||||
it("允许浏览器加载同源 Web Manifest", () => {
|
||||
|
||||
+16
-1
@@ -9,6 +9,17 @@ const rootPackage = JSON.parse(
|
||||
"utf8"
|
||||
)
|
||||
) as { version: string };
|
||||
const productBrand = JSON.parse(
|
||||
readFileSync(
|
||||
fileURLToPath(new URL("../../product.json", import.meta.url)),
|
||||
"utf8"
|
||||
)
|
||||
) as {
|
||||
displayName: string;
|
||||
windowTitle: string;
|
||||
slogan: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
@@ -16,7 +27,11 @@ export default defineConfig({
|
||||
new URL("../../logos/web", import.meta.url)
|
||||
),
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(rootPackage.version)
|
||||
__APP_VERSION__: JSON.stringify(rootPackage.version),
|
||||
__APP_DISPLAY_NAME__: JSON.stringify(productBrand.displayName),
|
||||
__APP_WINDOW_TITLE__: JSON.stringify(productBrand.windowTitle),
|
||||
__APP_SLOGAN__: JSON.stringify(productBrand.slogan),
|
||||
__APP_DESCRIPTION__: JSON.stringify(productBrand.description)
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
|
||||
Reference in New Issue
Block a user