Skip to content

Commit c50424d

Browse files
committed
Add script to test finding runtime
1 parent 821ce10 commit c50424d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

scripts/find-runtime.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// benchmark
2+
const start = process.hrtime.bigint();
3+
4+
// start code
5+
const args = process.argv.slice(2);
6+
7+
if (args.length === 0) {
8+
console.log(`
9+
Usage: node find-runtime.mjs <project-folder>
10+
Find @rescript/runtime directories in a project's node_modules.
11+
Arguments:
12+
project-folder Path to the project directory to search
13+
Examples:
14+
node find-runtime.mjs /path/to/project
15+
node find-runtime.mjs .
16+
`);
17+
process.exit(1);
18+
}
19+
20+
const project = args[args.length - 1];
21+
22+
import { findRuntime } from "../server/src/find-runtime.ts";
23+
24+
const runtimes = await findRuntime(project);
25+
26+
console.log("Found @rescript/runtime directories:", runtimes);
27+
28+
// end code
29+
const end = process.hrtime.bigint();
30+
const durationMs = Number(end - start) / 1e6; // convert ns → ms
31+
32+
console.log(`Script took ${durationMs.toFixed(3)}ms`);

0 commit comments

Comments
 (0)