axo-shrinkwrap
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -89,3 +89,3 @@ var parallel = require('run-parallel'); | ||
exec('git show ' + sha + ':npm-shrinkwrap.json', { | ||
exec('git show ' + sha + ':./npm-shrinkwrap.json', { | ||
cwd: cwd || process.cwd(), | ||
@@ -92,0 +92,0 @@ maxBuffer: 10000 * 1024 |
{ | ||
"name": "axo-shrinkwrap", | ||
"version": "1.0.0", | ||
"description": "A consistent shrinkwrap tool, fork of uber/npm-shirnkwrap", | ||
"version": "2.0.0", | ||
"description": "A consistent shrinkwrap tool, fork of uber/npm-shrinkwrap", | ||
"keywords": [], | ||
"author": "Raynos <raynos2@gmail.com>", | ||
"author": "Maxk <maxk@axosoft.com>", | ||
"repository": "git://github.com/axosoft/axo-shrinkwrap.git", | ||
@@ -11,3 +11,4 @@ "main": "index", | ||
"bugs": { | ||
"url": "https://github.com/axosoft/axo-shrinkwrap/issues" | ||
"url": "https://github.com/axosoft/axo-shrinkwrap/issues", | ||
"email": "maxk@axosoft.com" | ||
}, | ||
@@ -21,3 +22,3 @@ "dependencies": { | ||
"msee": "^0.1.1", | ||
"npm": "1.4.21", | ||
"npm": "^3.5.2", | ||
"rimraf": "^2.2.8", | ||
@@ -24,0 +25,0 @@ "run-parallel": "^1.0.0", |
@@ -34,4 +34,3 @@ # npm-shrinkwrap | ||
your package.json. npm happily says that the dependency in | ||
your node_modules tree is valid irregardless of what tag it | ||
is. | ||
your node_modules tree is valid regardless of what tag it is. | ||
@@ -242,4 +241,10 @@ ### Consistently set a `resolved` field. | ||
For usage with npm@1 | ||
`npm install npm-shrinkwrap` | ||
For usage with npm@2 | ||
`npm install npm-shrinkwrap@200.x` | ||
## Tests | ||
@@ -246,0 +251,0 @@ |
@@ -45,2 +45,11 @@ var path = require('path'); | ||
var existingVersion = json['npm-shrinkwrap-version']; | ||
if (existingVersion && semver.gt(existingVersion, version)) { | ||
return callback(errors.InvalidNPMVersion({ | ||
existing: existingVersion, | ||
current: version | ||
})); | ||
} | ||
json = fixResolved(json, null); | ||
@@ -47,0 +56,0 @@ |
@@ -56,2 +56,24 @@ var test = require('tape'); | ||
function gitSSHModuleFixture(name, version, opts) { | ||
opts = opts || {}; | ||
var module = { | ||
'package.json': JSON.stringify({ | ||
name : name, | ||
_id: name + '@' + version, | ||
_from: 'git+ssh://git@github.com:uber/' + name + '#v' + version, | ||
_resolved: 'git+ssh://git@github.com/uber/' + name + '#' + SHA, | ||
version: version, | ||
dependencies: opts.dependencies || undefined | ||
}) | ||
}; | ||
/*jshint camelcase: false*/ | ||
if (opts.node_modules) { | ||
module.node_modules = opts.node_modules; | ||
} | ||
return module; | ||
} | ||
test('npmShrinkwrap is a function', function (assert) { | ||
@@ -131,2 +153,37 @@ assert.strictEqual(typeof npmShrinkwrap, 'function'); | ||
test('create shrinkwrap for git+ssh dep', fixtures(__dirname, { | ||
'proj': moduleFixture('proj', '0.1.0', { | ||
dependencies: { | ||
baz: 'git+ssh://git@github.com:uber/baz#v2.0.0' | ||
}, | ||
'node_modules': { | ||
'baz': gitSSHModuleFixture('baz', '2.0.0') | ||
} | ||
}) | ||
}, function (assert) { | ||
npmShrinkwrap(PROJ, function (err) { | ||
assert.ifError(err); | ||
var shrinkwrap = path.join(PROJ, 'npm-shrinkwrap.json'); | ||
fs.readFile(shrinkwrap, 'utf8', function (err, file) { | ||
assert.ifError(err); | ||
assert.notEqual(file, ''); | ||
var json = JSON.parse(file); | ||
assert.equal(json.name, 'proj'); | ||
assert.equal(json.version, '0.1.0'); | ||
assert.deepEqual(json.dependencies, { | ||
baz: { | ||
version: '2.0.0', | ||
from: 'baz@git+ssh://git@github.com/uber/baz#' + SHA, | ||
resolved: 'git+ssh://git@github.com/uber/baz#' + SHA | ||
} | ||
}); | ||
assert.end(); | ||
}); | ||
}); | ||
})); | ||
test('error on removed module', fixtures(__dirname, { | ||
@@ -133,0 +190,0 @@ proj: moduleFixture('proj', '0.1.0', { |
@@ -57,2 +57,4 @@ var fs = require('graceful-fs'); | ||
'resolved', | ||
'npm-shrinkwrap-version', | ||
'node-version', | ||
'dependencies' | ||
@@ -145,4 +147,16 @@ ]); | ||
if (shaIsm !== resolveShaism) { | ||
return opts.name + '@' + | ||
opts.fromValue.replace(shaIsm, resolveShaism); | ||
var pathname = opts.fromUri.pathname; | ||
// normalize git+ssh links with a ':' after the host instead of a '/' | ||
if (pathname[1] === ':') { | ||
pathname = pathname[0] + pathname.slice(2); | ||
} | ||
var newValue = url.format({ | ||
protocol: opts.fromUri.protocol, | ||
slashes: opts.fromUri.slashes, | ||
auth: opts.fromUri.auth, | ||
host: opts.fromUri.host, | ||
pathname: pathname, | ||
hash: resolveShaism | ||
}); | ||
return opts.name + '@' + newValue; | ||
} | ||
@@ -244,1 +258,2 @@ | ||
} | ||
74024
1742
255
+ Addednpm@3.10.10(transitive)
- Removednpm@1.4.21(transitive)
Updatednpm@^3.5.2