Files
book-test/node_modules/dbmate/dist/resolveBinary.js
T
chris d4fae15f5c
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-internal (push) Has been cancelled
Initial code test
2026-08-26 11:51:58 -04:00

25 lines
751 B
JavaScript

import { createRequire } from "node:module";
import { arch, platform } from "node:process";
const require = createRequire(import.meta.url);
/**
* Resolve path to dbmate for the current platform
* */
export function resolveBinary() {
const ext = platform === "win32" ? ".exe" : "";
const path = `@dbmate/${platform}-${arch}/bin/dbmate${ext}`;
try {
return require.resolve(path);
}
catch (err) {
if (err != undefined &&
typeof err === "object" &&
"code" in err &&
err.code === "MODULE_NOT_FOUND") {
throw new Error(`Unable to locate dbmate binary '${path}'`);
}
else {
throw err;
}
}
}
//# sourceMappingURL=resolveBinary.js.map