Skip to content
This repository has been archived by the owner on Dec 24, 2018. It is now read-only.

adds support for node 4 and 5 #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 9 additions & 5 deletions get_npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ var util = require('util'),
path = require('path'),
wget = require('./wget');

var NPM_PKG_JSON_URL = 'https://raw.githubusercontent.com/%s/%s/deps/npm/package.json';
// https://github.com/npm/npm/tags
var NPM_PKG_JSON_URL = 'https://raw.githubusercontent.com/nodejs/node/%s/deps/npm/package.json';
// https://github.com/npm/npm/tags
var NVMW_NPM_MIRROR = process.env.NVMW_NPM_MIRROR || 'https://github.com/npm/npm/archive';
var BASE_URL = NVMW_NPM_MIRROR + '/v%s.zip';

var targetDir = process.argv[2];
var versions = process.argv[3].split('/');
var binType = versions[0];
var binVersion = versions[1];
var branchName = binVersion === 'latest' ? 'master' : binVersion;

if (+binVersion.split('')[1] < 4) {
branchName += '-release';
}

if (binType === 'iojs') {
// detect npm version from https://iojs.org/dist/index.json
Expand Down Expand Up @@ -41,8 +46,7 @@ if (binType === 'iojs') {
downloadNpmZip(npmVersion);
});
} else {
var pkgUri = util.format(NPM_PKG_JSON_URL, 'joyent/node',
binVersion === 'latest' ? 'master' : binVersion);
var pkgUri = util.format(NPM_PKG_JSON_URL, branchName);
wget(pkgUri, function (filename, pkg) {
if (filename === null) {
return noNpmAndExit();
Expand Down
13 changes: 11 additions & 2 deletions nvmw.bat
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ if not %NODE_VERSION:~0,1% == v if not %NODE_VERSION:~0,1% == l (
set NODE_VERSION=v%NODE_VERSION%
)

set BRANCH=%ARCH%

:: nvmw install >=4.0.0
if %NODE_VERSION:~1,1% GEQ 4 (
set BRANCH=win-%ARCH%
)

if %NODE_TYPE% == iojs (
set DIST_URL=%%
if %ARCH% == x32 (
Expand All @@ -132,9 +139,11 @@ if %NODE_TYPE% == iojs (
)
) else (
if %ARCH% == x32 (
set NODE_EXE_URL=%NVMW_NODEJS_ORG_MIRROR%/%NODE_VERSION%/node.exe
if %BRANCH% == %ARCH% (
set NODE_EXE_URL=%NVMW_NODEJS_ORG_MIRROR%/%NODE_VERSION%/node.exe
)
) else (
set NODE_EXE_URL=%NVMW_NODEJS_ORG_MIRROR%/%NODE_VERSION%/x64/node.exe
set NODE_EXE_URL=%NVMW_NODEJS_ORG_MIRROR%/%NODE_VERSION%/%BRANCH%/node.exe
)
)

Expand Down