Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const shasum = createHash('sha1').update(buffer).digest('hex');
const integrity = ssri.fromData(buffer).toString();
if (typeof access === `undefined`) {
if (workspace.manifest.publishConfig && typeof workspace.manifest.publishConfig.access === `string`) {
access = workspace.manifest.publishConfig.access;
} else if (configuration.get(`npmPublishAccess`) !== null) {
access = configuration.get(`npmPublishAccess`);
} else if (ident.scope) {
access = `restricted`;
} else {
access = `public`;
}
}
const raw = await packUtils.genPackageManifest(workspace);
return {
_id: name,
_attachments: {
[`${name}-${version}.tgz`]: {
[`content_type`]: `application/octet-stream`,
data: buffer.toString(`base64`),
length: buffer.length,
},
},
name,
access,
[`dist-tags`]: {
[tag]: version,