From d37c2d63de9f15870cb324f1c69b319e0ef165e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Sun, 5 Sep 2021 15:46:08 +0200 Subject: [PATCH] fix: Add exe to binary name if windows --- npm/binary.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/npm/binary.js b/npm/binary.js index 15a12a0..d66bf98 100644 --- a/npm/binary.js +++ b/npm/binary.js @@ -1,13 +1,14 @@ const { Binary } = require("binary-install"); const os = require("os"); -const { join } = require("path"); + +const windows = "x86_64-pc-windows-msvc"; const getPlatform = () => { const type = os.type(); const arch = os.arch(); if (type === "Windows_NT" && arch === "x64") { - return "x86_64-pc-windows-msvc"; + return windows; } if (type === "Linux" && arch === "x64") { return "x86_64-unknown-linux-musl"; @@ -25,7 +26,7 @@ const getBinary = () => { const author = "rustwasm"; const name = "wasm-pack"; const url = `https://github.com/${author}/${name}/releases/download/v${version}/${name}-v${version}-${platform}.tar.gz`; - return new Binary(name, url ); + return new Binary(platform === windows ? "wasm-pack.exe" : "wasm-pack", url); }; const run = () => { @@ -46,5 +47,5 @@ const uninstall = () => { module.exports = { install, run, - uninstall + uninstall, };