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.
41 lines (40 loc) • 1.37 kB
text/typescript
import { Command } from 'commander';
import { getCliParams } from './gen/proto.js';
import { runInitScript } from './init.js';
import set from 'set-value';
getCliParams(process.argv, (program, run) => {
run.action(async (data) => {
let fontSplit;
if (process.versions.bun) {
fontSplit = (await import('./bun/index.js')).fontSplit;
} else {
fontSplit = (await import('./node/index.js')).fontSplit;
}
const newData = { ...data };
Object.entries(newData).forEach(([key, value]) => {
set(newData, key, value);
});
await fontSplit(newData);
});
program
.usage(
'\ncn-font-split -i <字体地址> -o <文件夹地址>\ncn-font-split run -h # 查看更详细信息',
)
.description('')
.addCommand(
new Command('i')
.description('安装指定源 wasm32-wasip1@版本号')
// .option('-f, --force', '强制下载源')
.action(async () => {
await runInitScript();
}),
)
.addCommand(
new Command('ls')
.description('列出本地和远程信息')
.action(async () => {
await runInitScript();
}),
);
});