mirror of
https://github.com/panatgithub/AnkiHeadingSync.git
synced 2026-07-22 17:10:28 +00:00
- Settings page action buttons now use Obsidian theme accent colors. - Settings toggles now have clearer themed states. - Styling is scoped to the plugin settings page. 功能:设置页面按钮和切换开关现在使用 Obsidian 主题色 - 设置页面的操作按钮现在使用 Obsidian 主题强调色。 - 设置切换开关现在具有更清晰的主题化状态。 - 样式已限定在插件设置页面范围内。
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
import { access, copyFile, mkdir, writeFile } from "node:fs/promises";
|
|
import { dirname, join, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
const rootDir = resolve(scriptDir, "..");
|
|
const outputDir = join(rootDir, "dist", "plugin");
|
|
const stylesSourcePath = join(rootDir, "styles.css");
|
|
|
|
await mkdir(outputDir, { recursive: true });
|
|
|
|
let hasStylesheet = false;
|
|
try {
|
|
await access(stylesSourcePath);
|
|
hasStylesheet = true;
|
|
} catch {
|
|
hasStylesheet = false;
|
|
}
|
|
|
|
const stageTasks = [
|
|
copyFile(join(rootDir, "manifest.json"), join(outputDir, "manifest.json")),
|
|
copyFile(join(rootDir, "versions.json"), join(outputDir, "versions.json")),
|
|
];
|
|
|
|
if (hasStylesheet) {
|
|
stageTasks.push(copyFile(stylesSourcePath, join(outputDir, "styles.css")));
|
|
}
|
|
|
|
await Promise.all(stageTasks);
|
|
|
|
await writeFile(
|
|
join(outputDir, "README.md"),
|
|
[
|
|
"Anki Heading Sync — Obsidian plugin package",
|
|
"",
|
|
"Build output lives in this folder for packaging, release zips, and manual vault sync.",
|
|
"This build flow only overwrites plugin package files and does not touch data.json.",
|
|
"",
|
|
"Included files:",
|
|
"- manifest.json",
|
|
"- main.js",
|
|
"- versions.json",
|
|
...(hasStylesheet ? ["- styles.css"] : []),
|
|
].join("\n"),
|
|
"utf8",
|
|
);
|