-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgatsby-node.ts
More file actions
31 lines (27 loc) · 816 Bytes
/
gatsby-node.ts
File metadata and controls
31 lines (27 loc) · 816 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
30
31
import * as fsP from "node:fs/promises";
import { exec } from "node:child_process";
const FILENAME = new URL(`file://${__filename}`);
async function exists(filepath: URL): Promise<boolean> {
try {
await fsP.access(filepath);
return true;
} catch {
return false;
}
}
async function execute(command: string): Promise<string> {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
error ? reject(error) : resolve(stdout);
});
});
}
export async function onPreBootstrap() {
// const caipsDir = new URL("./originals/CAIPs", FILENAME);
// const isCaipsDirPresent = await exists(caipsDir);
// if (!isCaipsDirPresent) {
// await execute(
// `git clone https://github.com/ChainAgnostic/CAIPs.git ${caipsDir.pathname}`
// );
// }
}