diff --git a/build.ts b/build.ts index 16b75655..ddc64dfb 100644 --- a/build.ts +++ b/build.ts @@ -1,12 +1,15 @@ import { existsSync } from "https://deno.land/std/fs/exists.ts"; -import { resolve } from "https://deno.land/std/path/mod.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", target); + const targetToPath = resolve( + ".deno_plugins", + `deno_mongo${extname(target)}` + ); if (existsSync(targetPath)) { console.log(`Copy "${targetPath}" to "${targetToPath}"`); await Deno.copyFile(targetPath, targetToPath); diff --git a/test.ts b/test.ts index b4dcd36d..cd81ae7d 100644 --- a/test.ts +++ b/test.ts @@ -74,5 +74,5 @@ test(async function testDeleteOne() { }); await cargoBuild(); -await init(); +await init("master"); await runTests(); diff --git a/ts/util.ts b/ts/util.ts index f09c3fdc..39648f9e 100644 --- a/ts/util.ts +++ b/ts/util.ts @@ -17,9 +17,8 @@ interface Command { command_id?: number; } -export async function init() { - let releaseUrl = - "https://github.com/manyuanrong/deno_mongo/releases/download/master"; +export async function init(binVer: string = "master") { + let releaseUrl = `https://github.com/manyuanrong/deno_mongo/releases/download/${binVer}`; const options = { name: PLUGIN_NAME,