Skip to content

Commit

Permalink
Merge pull request #1055 from rustwasm/look-for-exe
Browse files Browse the repository at this point in the history
fix: Add exe to binary name if windows
  • Loading branch information
drager authored Sep 5, 2021
2 parents c6f9b1c + 6d81411 commit f71675e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions npm/binary.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = () => {
Expand All @@ -46,5 +47,5 @@ const uninstall = () => {
module.exports = {
install,
run,
uninstall
uninstall,
};
12 changes: 6 additions & 6 deletions npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f71675e

Please # to comment.