-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-tinyexec.js
More file actions
29 lines (23 loc) · 793 Bytes
/
fix-tinyexec.js
File metadata and controls
29 lines (23 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { copyFileSync, existsSync, mkdirSync, readdirSync } from "fs";
import { join } from "path";
const root = process.cwd();
const nodeModules = join(root, "node_modules");
const tinyexecPath = join(nodeModules, "tinyexec");
if (!existsSync(tinyexecPath)) {
console.log("tinyexec not found");
process.exit(1);
}
// Ensure dist exists
const distPath = join(tinyexecPath, "dist");
if (!existsSync(distPath)) {
console.log("tinyexec/dist not found");
process.exit(1);
}
// Create a .js alias to .mjs if missing
const mainMjs = join(distPath, "main.mjs");
const mainJs = join(distPath, "main.js");
if (existsSync(mainMjs) && !existsSync(mainJs)) {
copyFileSync(mainMjs, mainJs);
console.log("Created main.js alias for tinyexec");
}
console.log("Tinyexec fix applied successfully");