Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions npm_publish/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ var path = require('path'),
var ARCH_MAPPING = {
"ia32": "386",
"x64": "amd64",
"arm": "arm"
"arm": "arm",
"arm64": "arm64"
};

// Mapping between Node's `process.platform` to Golang's
Expand Down Expand Up @@ -86,11 +87,9 @@ function validateConfiguration(packageJson) {
}

function parsePackageJson() {
if (process.arch !== "arm64" && process.platform !== "darwin") {
if (!(process.arch in ARCH_MAPPING)) {
console.error("Installation is not supported for this architecture: " + process.arch);
return;
}
if (!(process.arch in ARCH_MAPPING)) {
console.error("Installation is not supported for this architecture: " + process.arch);
return;
}

if (!(process.platform in PLATFORM_MAPPING)) {
Expand Down Expand Up @@ -146,10 +145,6 @@ async function install(callback) {
mkdirp.sync(opts.binPath);
console.info(`Copying the relevant binary for your platform ${process.platform}`);
let src = `./dist/go-ios-${PLATFORM_MAPPING[process.platform]}-${ARCH_MAPPING[process.arch]}_${PLATFORM_MAPPING[process.platform]}_${ARCH_MAPPING[process.arch]}/${opts.binName}`;
if (process.arch === "arm64" && process.platform === "darwin") {
console.log("using amd64 build on M1 mac")
src = `./dist/go-ios-${process.platform}-amd64_${process.platform}_amd64/${opts.binName}`;
}

if (process.arch === "ia32" && process.platform === "w32") {
src = `./dist/go-ios-${PLATFORM_MAPPING[process.platform]}-amd64_${PLATFORM_MAPPING[process.platform]}_amd64/${opts.binName}`;
Expand Down