Skip to content

Commit

Permalink
fix: remove go-platform dependency (#44)
Browse files Browse the repository at this point in the history
Remove `go-platform` npm dependency due to no longer maintain. Migrate it into `go-platform.js` and require it in `download.js`

Fixes #40 

Co-authored-by: Alex Potsides <alex@achingbrain.net>
  • Loading branch information
jenkijo and achingbrain authored Jan 19, 2022
1 parent 269d83a commit 8b0e3d9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
},
"dependencies": {
"cachedir": "^2.3.0",
"go-platform": "^1.0.0",
"got": "^11.7.0",
"gunzip-maybe": "^1.4.2",
"hasha": "^5.2.2",
Expand Down
3 changes: 1 addition & 2 deletions src/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
go-ipfs architecture: the architecture of the hardware this program is run from
go-ipfs install path: './go-ipfs'
*/
// @ts-ignore no types
const goenv = require('go-platform')
const goenv = require('./go-platform')
const gunzip = require('gunzip-maybe')
const got = require('got').default
const path = require('path')
Expand Down
33 changes: 33 additions & 0 deletions src/go-platform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict'

function getGoOs () {
switch (process.platform) {
case "sunos":
return "solaris"
case "win32":
return "windows"
}

return process.platform
}

function getGoArch () {
switch (process.arch) {
case "ia32":
return "386"
case "x64":
return "amd64"
case "arm":
return "arm"
case "arm64":
return "arm64"
}

return process.arch
}


module.exports = {
GOOS: getGoOs(),
GOARCH: getGoArch()
}

0 comments on commit 8b0e3d9

Please sign in to comment.