Skip to content

Commit 01f2530

Browse files
committed
refactor(scripts): switch from async file reading to synchronous for ignores and version scripts
1 parent 7cb4f6d commit 01f2530

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

scripts/ignores.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212
// Effect.map(Array.filter(Str.isNonEmpty)),
1313
// );
1414

15-
import fs from "fs/promises";
15+
import fs from "node:fs";
1616

17-
export const ignores = await fs
18-
.readFile(".gitignore", "utf-8")
19-
.then((v) => {
20-
return v
21-
.split("\n")
22-
.map((v) => v.trim())
23-
.filter((v) => !v.startsWith("#") && !v.startsWith("!"))
24-
.map((v) => v.replace(/^\//, ""))
25-
.filter((v) => v !== "");
26-
});
17+
export const ignores = fs
18+
.readFileSync(".gitignore", "utf-8")
19+
.split("\n")
20+
.map((v) => v.trim())
21+
.filter((v) => !v.startsWith("#") && !v.startsWith("!"))
22+
.map((v) => v.replace(/^\//, ""))
23+
.filter((v) => v !== "");

scripts/version.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import fs from "fs/promises";
1+
import fs from "node:fs";
22

3-
import { isVersion } from "./libs";
4-
5-
export const version = await fs.readFile("VERSION", "utf-8")
6-
.then((v) => {
7-
const trimmed = v.trim();
8-
const version = trimmed.replace("v", "");
9-
if (!isVersion(version)) {
10-
throw new Error("Invalid version format");
11-
}
12-
return version;
13-
});
3+
export const version = fs
4+
.readFileSync("VERSION", "utf-8")
5+
.trim()
6+
.replace("v", "");

0 commit comments

Comments
 (0)