Initial code test
This commit is contained in:
commit
d4fae15f5c
1696 files changed
+271223
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
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
|
||||
Reference in new issue
Block a user