Skip to content

Commit 3fc77ea

Browse files
committed
add back support for passing additional cmdline args
1 parent ff82f2f commit 3fc77ea

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/process-release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var semver = require('semver')
1010
// file names. Inputs come from command-line switches (--target, --dist-url),
1111
// `process.version` and `process.release` where it exists.
1212
function processRelease (argv, gyp, defaultVersion, defaultRelease) {
13-
var version = argv[0] || gyp.opts.target || defaultVersion
13+
var version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion
1414
, versionSemver = semver.parse(version)
1515
, overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
1616
, isDefaultVersion

test/test-process-release.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,3 +421,31 @@ test('test process release - process.release ~ [email protected] passed as argv[0]
421421
})
422422
})
423423

424+
425+
test('test process release - process.release ~ [email protected] - bogus string passed as argv[0]', function (t) {
426+
t.plan(2)
427+
428+
// additional arguments can be passed in on the commandline that should be ignored if they
429+
// are not specifying a valid version @ position 0
430+
var release = processRelease([ 'this is no version!' ], { opts: {} }, 'v4.0.0-rc.4', {
431+
name: 'node',
432+
headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
433+
})
434+
435+
t.equal(release.semver.version, '4.0.0-rc.4')
436+
delete release.semver
437+
438+
t.deepEqual(release, {
439+
version: '4.0.0-rc.4',
440+
name: 'node',
441+
baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
442+
tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
443+
shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
444+
versionDir: '4.0.0-rc.4',
445+
libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
446+
libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
447+
libPath32: 'win-x86/node.lib',
448+
libPath64: 'win-x64/node.lib'
449+
})
450+
})
451+

0 commit comments

Comments
 (0)