diff --git a/__test__/common.spec.js b/__test__/common.spec.js index 0da162e..ad9589c 100644 --- a/__test__/common.spec.js +++ b/__test__/common.spec.js @@ -60,7 +60,7 @@ describe('common', () => { const url = common.getUrl({ default: 'http://url.tar.gz', windows: 'http://url.exe.zip' - }, { platform: 'windows' }); + }, { platform: 'win32' }); expect(url).toEqual('http://url.exe.zip'); }); @@ -82,7 +82,7 @@ describe('common', () => { default: 'http://url_darwin.tar.gz', 386: 'http://url_darwin_i386.tar.gz' } - }, { platform: 'darwin', arch: '386' }); + }, { platform: 'darwin', arch: 'ia32' }); expect(url).toEqual('http://url_darwin_i386.tar.gz'); }); diff --git a/package.json b/package.json index f4f9618..424a622 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "mkdirp": "^0.5.1", "request": "^2.81.0", - "tar": "^2.2.1" + "tar": "^2.2.2" }, "repository": { "type": "git", @@ -23,8 +23,8 @@ }, "homepage": "https://github.com/sanathkr/go-npm", "devDependencies": { - "babel-cli": "^6.24.1", - "babel-core": "^6.25.0", + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", "babel-preset-es2015": "^6.24.1", "jest": "^24.5.0" } diff --git a/src/common.js b/src/common.js index 5f277c9..5889166 100644 --- a/src/common.js +++ b/src/common.js @@ -78,8 +78,8 @@ function getUrl(url, process) { let _url; - if (url[process.platform]) { - _url = url[process.platform]; + if (url[PLATFORM_MAPPING[process.platform]]) { + _url = url[PLATFORM_MAPPING[process.platform]]; } else { _url = url.default; } @@ -88,8 +88,8 @@ function getUrl(url, process) { return _url; } - if (_url[process.arch]) { - _url = _url[process.arch] + if (_url[ARCH_MAPPING[process.arch]]) { + _url = _url[ARCH_MAPPING[process.arch]] } else { _url = _url.default; }