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.

47 lines (46 loc) 1.26 kB
import { execFile as a, spawn as h } from "child_process"; import l, { dirname as m } from "path"; import { fileURLToPath as u } from "url"; const f = u(import.meta.url), n = m(f); function x() { const c = process.platform === "win32", t = process.argv.slice(2); if (c) { const o = [ "-ExecutionPolicy", "Bypass", "-File", l.resolve(n, "./init.ps1"), ...t ]; return new Promise((r, s) => { a( "powershell.exe", o, (e, p, w) => { if (e) { console.error( `Error executing PowerShell script: ${e.message}` ), s(e); return; } r(null), console.log(`PowerShell script output: ${p}`); } ); }); } else { const i = l.resolve(n, "./init.sh"), o = h("bash", [i, ...t], { stdio: "inherit" }); return new Promise((r, s) => { o.on("close", (e) => { e !== 0 ? (s(), console.error(`Shell script exited with code ${e}`)) : (r(null), console.log("Shell script executed successfully.")); }).on("error", (e) => { s(e), console.error("Failed to start shell script:", e); }); }); } } export { x as runInitScript }; //# sourceMappingURL=init.mjs.map