Skip to content

Commit 57f133a

Browse files
committed
fix: add fallback for Mac arm64
1 parent 2c87403 commit 57f133a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- windows-latest
1515
- macos-latest
1616
- ubuntu-latest
17-
- macos-11 # arm64
17+
# - macos-11 # arm64
1818
d:
1919
- "ldc-1.28.0"
2020
node:

src/node/lib.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { execFile } from "child_process"
2+
import { readFile, writeFile } from "fs/promises";
23
import { join } from "path"
34

45
/**
@@ -10,6 +11,17 @@ import { join } from "path"
1011
* @throws {Promise<string | Error>} The promise is rejected with the reason for failure
1112
*/
1213
export async function minifyFiles(files: string[], hasComment = false): Promise<void> {
14+
if (process.platform === "darwin" && process.arch === "arm64") {
15+
// fallback to jasonminify due to missing ARM64 binaries
16+
// eslint-disable-next-line @typescript-eslint/no-var-requires
17+
const jsonminify = require("jsonminify");
18+
files.map(async (file) => {
19+
const jsonString = await readFile(file, 'utf8');
20+
const minifiedJsonString = jsonminify(jsonString) as string;
21+
await writeFile(file, minifiedJsonString);
22+
})
23+
}
24+
1325
const filesNum = files.length
1426
if (filesNum === 0) {
1527
return Promise.resolve()

0 commit comments

Comments
 (0)