Skip to content

Commit caa21c0

Browse files
committed
fix: 修复异步构建问题
1 parent 9bdba02 commit caa21c0

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

packages/performance/package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"name": "performance",
3-
"version": "1.0.0",
4-
"description": "",
5-
"main": "index.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
9-
"keywords": [],
10-
"author": "",
11-
"license": "ISC",
12-
"dependencies": {
13-
"@japont/unicode-range": "^1.0.0",
14-
"cn-font-split": "7.2.2",
15-
"byte-size": "^8.1.1",
16-
"solid-js": "^1.7.8"
17-
}
2+
"name": "performance",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"@japont/unicode-range": "^1.0.0",
14+
"cn-font-split": "7.2.4",
15+
"byte-size": "^8.1.1",
16+
"solid-js": "^1.7.8"
17+
}
1818
}

packages/performance/src/sweet_point.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ export async function main(build = false) {
1313
const input = '../demo/public/NotoSerifSC-Regular.ttf';
1414
const sample = generateNumbers(10, 100, 5);
1515
// 生成字体
16-
build &&
17-
sample.forEach((size) => {
18-
fontSplit({
16+
if (build) {
17+
for (let size of sample) {
18+
await fontSplit({
1919
input,
2020
outDir: './build/' + size,
2121
chunkSize: size * 1024,
2222
});
23-
});
23+
}
24+
}
2425
// 拿到 unicode -> subset 的报告
2526
const sampleReporter: Mapper[] = [];
2627
for (const element of sample) {
@@ -109,7 +110,7 @@ export async function main(build = false) {
109110
});
110111
}
111112

112-
main();
113+
main(true);
113114

114115
type Mapper = Map<number, proto.OutputReport['subsetDetail'][number]>;
115116

0 commit comments

Comments
 (0)