libnpmpublish
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/npm/libnpmpublish/compare/v1.0.1...v1.1.0) (2018-08-31) | ||
### Features | ||
* **publish:** add support for publishConfig on manifests ([161723b](https://github.com/npm/libnpmpublish/commit/161723b)) | ||
<a name="1.0.1"></a> | ||
@@ -7,0 +17,0 @@ ## [1.0.1](https://github.com/npm/libnpmpublish/compare/v1.0.0...v1.0.1) (2018-08-31) |
{ | ||
"name": "libnpmpublish", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Programmatic API for the bits behind npm publish and unpublish", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -36,3 +36,3 @@ 'use strict' | ||
// NOTE: spec is used to pick the appropriate registry/auth combo. | ||
opts = opts.concat({ spec }) | ||
opts = opts.concat(manifest.publishConfig, { spec }) | ||
const reg = npmFetch.pickRegistry(spec, opts) | ||
@@ -39,0 +39,0 @@ const auth = npmAuth(reg, opts) |
@@ -858,1 +858,63 @@ 'use strict' | ||
}) | ||
test('publishConfig on manifest', t => { | ||
const manifest = { | ||
name: 'libnpmpublish', | ||
version: '1.0.0', | ||
description: 'some stuff', | ||
publishConfig: { | ||
registry: REG | ||
} | ||
} | ||
return mockTar({ | ||
'package.json': JSON.stringify(manifest), | ||
'index.js': 'console.log("hello world")' | ||
}).then(tarData => { | ||
const shasum = crypto.createHash('sha1').update(tarData).digest('hex') | ||
const integrity = ssri.fromData(tarData, { algorithms: ['sha512'] }) | ||
const packument = { | ||
name: 'libnpmpublish', | ||
description: 'some stuff', | ||
readme: '', | ||
_id: 'libnpmpublish', | ||
'dist-tags': { | ||
latest: '1.0.0' | ||
}, | ||
versions: { | ||
'1.0.0': { | ||
_id: 'libnpmpublish@1.0.0', | ||
_nodeVersion: process.versions.node, | ||
name: 'libnpmpublish', | ||
version: '1.0.0', | ||
description: 'some stuff', | ||
dist: { | ||
shasum, | ||
integrity: integrity.toString(), | ||
tarball: `http://mock.reg/libnpmpublish/-/libnpmpublish-1.0.0.tgz` | ||
}, | ||
publishConfig: { | ||
registry: REG | ||
} | ||
} | ||
}, | ||
_attachments: { | ||
'libnpmpublish-1.0.0.tgz': { | ||
'content_type': 'application/octet-stream', | ||
data: tarData.toString('base64'), | ||
length: tarData.length | ||
} | ||
} | ||
} | ||
const srv = tnock(t, REG) | ||
srv.put('/libnpmpublish', body => { | ||
t.deepEqual(body, packument, 'posted packument matches expectations') | ||
return true | ||
}, { | ||
authorization: 'Bearer deadbeef' | ||
}).reply(201, {}) | ||
return publish(manifest, tarData, { token: 'deadbeef' }).then(ret => { | ||
t.ok(ret, 'publish succeeded') | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84061
1461