UNPKG

cn-font-split

Version:

划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.

39 lines (38 loc) 1.11 kB
import e, { dirname as t } from "path"; import { execFile as n, spawn as r } from "child_process"; import { fileURLToPath as i } from "url"; //#region src/init.ts var a = t(i(import.meta.url)); function o() { let t = process.platform === "win32", i = process.argv.slice(2); if (t) { let t = [ "-ExecutionPolicy", "Bypass", "-File", e.resolve(a, "./init.ps1"), ...i ]; return new Promise((e, r) => { n("powershell.exe", t, (t, n, i) => { if (t) { console.error(`Error executing PowerShell script: ${t.message}`), r(t); return; } e(null), console.log(`PowerShell script output: ${n}`); }); }); } else { let t = r("bash", [e.resolve(a, "./init.sh"), ...i], { stdio: "inherit" }); return new Promise((e, n) => { t.on("close", (t) => { t === 0 ? (e(null), console.log("Shell script executed successfully.")) : (n(), console.error(`Shell script exited with code ${t}`)); }).on("error", (e) => { n(e), console.error("Failed to start shell script:", e); }); }); } } //#endregion export { o as runInitScript }; //# sourceMappingURL=init.mjs.map