mirror of
https://github.com/hansjone/mind-map.git
synced 2026-10-09 03:20:49 +08:00
Initial commit: DSH mind-map canvas monorepo
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
2ecd300ada
92 changed files with 20486 additions and 0 deletions
40
scripts/extract-skins.mjs
Normal file
40
scripts/extract-skins.mjs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const srcPath =
|
||||
"C:/Users/zhout/.dsh/profiles/web/node_modules/dsh-dream-skin/lib/client.js";
|
||||
const src = fs.readFileSync(srcPath, "utf8");
|
||||
const start = src.indexOf("const SKINS = [");
|
||||
const end = src.indexOf("];", start);
|
||||
if (start < 0 || end < 0) throw new Error("SKINS not found");
|
||||
const block = src.slice(start, end + 2);
|
||||
const skins = new Function(`${block}; return SKINS;`)();
|
||||
|
||||
const names = {
|
||||
abyss: ["Abyss", "深渊"],
|
||||
aurora: ["Aurora", "极光"],
|
||||
nebula: ["Nebula", "星云"],
|
||||
ember: ["Ember", "余烬"],
|
||||
midnight: ["Midnight", "午夜"],
|
||||
ivory: ["Ivory", "象牙"],
|
||||
mist: ["Mist", "晨雾"],
|
||||
rose: ["Rose", "玫瑰"],
|
||||
};
|
||||
|
||||
const out = skins.map((s) => ({
|
||||
id: s.id,
|
||||
colorScheme: s.colorScheme,
|
||||
name: names[s.id]?.[0] ?? s.id,
|
||||
nameZh: names[s.id]?.[1] ?? s.id,
|
||||
tokens: s.tokens,
|
||||
}));
|
||||
|
||||
const dir = path.resolve("packages/dream-skin/src");
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, "skins.json"), JSON.stringify(out, null, 2));
|
||||
console.log(
|
||||
"wrote",
|
||||
out.length,
|
||||
"skins:",
|
||||
out.map((s) => s.id).join(","),
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue