The best way to control Claude Code, Codex and more from any computer or phone

main
ts 24 lines 817 Bytes
Raw
1 import { createRequire } from "node:module";
2
3 // `make-dir` is installed into the artifact by `build.install`, not bundled,
4 // so it is loaded through a runtime require against the artifact's
5 // node_modules — exactly what a deployed function does.
6 const nodeRequire = createRequire(import.meta.url);
7
8 const handler = async () => {
9 const makeDir = nodeRequire("make-dir") as (path: string) => Promise<string>;
10 await makeDir("/tmp/alchemy-lockfile-pinning");
11 return {
12 statusCode: 200,
13 headers: {
14 "content-type": "application/json",
15 },
16 body: JSON.stringify({
17 makeDir: (nodeRequire("make-dir/package.json") as { version: string }).version,
18 semver: (nodeRequire("semver/package.json") as { version: string }).version,
19 }),
20 };
21 };
22
23 export { handler };
24 export default handler;