-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
build.ts
28 lines (27 loc) 路 926 Bytes
/
build.ts
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
import { existsSync } from "https://deno.land/std/fs/exists.ts";
import { resolve, extname } from "https://deno.land/std/path/mod.ts";
export async function copyTargets() {
await Deno.mkdir(".deno_plugins", { recursive: true });
const targets = ["libdeno_mongo.dylib", "libdeno_mongo.so", "deno_mongo.dll"];
for (const target of targets) {
const targetPath = resolve("./target/release", target);
const targetToPath = resolve(
".deno_plugins",
`deno_mongo${extname(target)}`
);
if (existsSync(targetPath)) {
console.log(`Copy "${targetPath}" to "${targetToPath}"`);
await Deno.copyFile(targetPath, targetToPath);
}
}
}
export async function cargoBuild() {
const cargoCommand = Deno.run({
args: ["cargo", "build", "--release", "--locked"],
stderr: "inherit",
stdin: "inherit",
stdout: "inherit"
});
await cargoCommand.status();
await copyTargets();
}