-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-all.ts
More file actions
61 lines (51 loc) · 2.21 KB
/
Copy pathrun-all.ts
File metadata and controls
61 lines (51 loc) · 2.21 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import "dotenv/config";
import { execSync } from "child_process";
import { scriptConfig, scriptNames } from "./scripts.config";
const include: string[] = [
"smartwallet:gelato",
"smartwallet:kernel:4337",
"smartwallet:kernel:4337+7702",
"bundler:send:gas-tank",
];
function runScript(id: string, path: string): void {
const name = scriptNames[id] || id;
console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
console.log(`▶ ${name}`);
console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
try {
execSync(`npx tsx ${path}`, {
stdio: "inherit",
cwd: process.cwd(),
});
console.log(`\n✓ ${name} completed successfully\n`);
} catch (error: any) {
console.error(`\n✗ ${name} failed\n`);
throw error;
}
}
function main() {
const allScriptIds = Object.keys(scriptConfig);
const scriptsToRun = include.filter((id) => {
if (!scriptConfig[id]) {
console.warn(`Warning: Script "${id}" not found in config, skipping`);
return false;
}
return true;
});
if (scriptsToRun.length === 0) {
console.log("No scripts to run. Add scripts to the include array.");
process.exit(0);
}
const includedNames = scriptsToRun.map((id) => scriptNames[id] || id).filter(Boolean);
console.log(`Running ${scriptsToRun.length} script(s): ${includedNames.join(", ")}\n`);
for (let i = 0; i < scriptsToRun.length; i++) {
const scriptId = scriptsToRun[i];
const scriptPath = scriptConfig[scriptId];
console.log(`[${i + 1}/${scriptsToRun.length}]`);
runScript(scriptId, scriptPath);
}
console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
console.log(`✓ All ${scriptsToRun.length} scripts completed successfully`);
console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
}
main();