Socket
Socket
Sign inDemoInstall

@semantic-release/npm

Package Overview
Dependencies
150
Maintainers
4
Versions
130
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.2 to 2.2.0

lib/set-legacy-token.js

4

index.js

@@ -0,1 +1,2 @@

const setLegacyToken = require('./lib/set-legacy-token');
const getPkg = require('./lib/get-pkg');

@@ -9,2 +10,3 @@ const verifyNpm = require('./lib/verify');

async function verifyConditions(pluginConfig, {logger}) {
setLegacyToken();
const pkg = await getPkg();

@@ -16,2 +18,3 @@ await verifyNpm(pkg, logger);

async function getLastRelease(pluginConfig, {logger}) {
setLegacyToken();
// Reload package.json in case a previous external step updated it

@@ -27,2 +30,3 @@ const pkg = await getPkg();

async function publish(pluginConfig, {nextRelease: {version}, logger}) {
setLegacyToken();
// Reload package.json in case a previous external step updated it

@@ -29,0 +33,0 @@ const pkg = await getPkg();

7

lib/set-npmrc-auth.js

@@ -14,8 +14,3 @@ const {appendFile} = require('fs-extra');

if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) {
// Using the old auth token format is not considered part of the public API
// This might go away anytime (i.e. once we have a better testing strategy)
await appendFile(
'./.npmrc',
`\n_auth = ${Buffer.from(`${NPM_USERNAME}:${NPM_PASSWORD}`, 'utf8').toString('base64')}\nemail = \${NPM_EMAIL}`
);
await appendFile('./.npmrc', `\n_auth = ${Buffer.from(`\${LEGACY_TOKEN}\nemail = \${NPM_EMAIL}`)}`);
logger.log('Wrote NPM_USERNAME, NPM_PASSWORD and NPM_EMAIL to .npmrc.');

@@ -22,0 +17,0 @@ } else if (NPM_TOKEN) {

@@ -1,1 +0,1 @@

{"name":"@semantic-release/npm","description":"Set of semantic-release plugins to publish to a npm registry","version":"2.1.2","author":"Pierre Vanduynslager (https://twitter.com/@pvdlg_)","bugs":{"url":"https://github.com/semantic-release/npm/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"contributors":["Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","Gregor Martynus (https://twitter.com/gr2m)"],"dependencies":{"@semantic-release/error":"^2.1.0","execa":"^0.8.0","fs-extra":"^4.0.2","nerf-dart":"^1.0.0","npm-conf":"^1.1.3","npm-registry-client":"^8.5.0","read-pkg-up":"^3.0.0","registry-auth-token":"^3.3.1"},"devDependencies":{"ava":"^0.24.0","clear-module":"^2.1.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","dockerode":"^2.5.3","eslint-config-prettier":"^2.5.0","eslint-plugin-prettier":"^2.3.0","get-stream":"^3.0.0","got":"^8.0.0","nock":"^9.1.0","nyc":"^11.2.1","p-retry":"^1.0.0","prettier":"~1.8.2","semantic-release":"^10.0.0","sinon":"^4.1.2","tempy":"^0.2.1","xo":"^0.18.2"},"engines":{"node":">=4"},"files":["lib","index.js"],"homepage":"https://github.com/semantic-release/npm#readme","keywords":["npm","publish","registry","semantic-release","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/npm.git"},"scripts":{"cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"xo","pretest":"npm run lint","semantic-release":"semantic-release","test":"nyc ava -v"},"xo":{"extends":["prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}}}
{"name":"@semantic-release/npm","description":"Set of semantic-release plugins to publish to a npm registry","version":"2.2.0","author":"Pierre Vanduynslager (https://twitter.com/@pvdlg_)","bugs":{"url":"https://github.com/semantic-release/npm/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"contributors":["Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","Gregor Martynus (https://twitter.com/gr2m)"],"dependencies":{"@semantic-release/error":"^2.1.0","execa":"^0.8.0","fs-extra":"^4.0.2","nerf-dart":"^1.0.0","npm-conf":"^1.1.3","npm-registry-client":"^8.5.0","read-pkg-up":"^3.0.0","registry-auth-token":"^3.3.1"},"devDependencies":{"ava":"^0.24.0","clear-module":"^2.1.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","dockerode":"^2.5.3","eslint-config-prettier":"^2.5.0","eslint-plugin-prettier":"^2.3.0","get-stream":"^3.0.0","got":"^8.0.0","nock":"^9.1.0","nyc":"^11.2.1","p-retry":"^1.0.0","prettier":"~1.8.2","semantic-release":"^10.0.0","sinon":"^4.1.2","tempy":"^0.2.1","xo":"^0.18.2"},"engines":{"node":">=4"},"files":["lib","index.js"],"homepage":"https://github.com/semantic-release/npm#readme","keywords":["npm","publish","registry","semantic-release","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/npm.git"},"scripts":{"cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"xo","pretest":"npm run lint","semantic-release":"semantic-release","test":"nyc ava -v"},"xo":{"extends":["prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}}}

@@ -23,7 +23,22 @@ # @semantic-release/npm

For each plugin, the `npm` authentication token has to be configured with the environment variable `NPM_TOKEN`.
### Environment variables
All the plugins are based on `npm` and will use the configuration from `.npmrc`. Any parameter returned by `npm config list` will be used by each plugin.
The `npm` authentication configuration is **required** and can be set via environment variables.
The registry and dist-tag can be configured in the `package.json` and will take precedence on the configuration in `.npmrc`:
Both the [token](https://docs.npmjs.com/getting-started/working_with_tokens) and the legacy (`username`, `password` and `email`) authentication are supported. It is recommended to use the [token](https://docs.npmjs.com/getting-started/working_with_tokens) authentication. The legacy authentication is supported as the alternative npm registries [Artifactory](https://www.jfrog.com/open-source/#os-arti) and [npm-registry-couchapp](https://github.com/npm/npm-registry-couchapp) only supports that form of authentication at this point.
| Variable | Description
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `NPM_TOKEN` | Npm token created via [npm token create](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) |
| `NPM_USERNAME` | Npm username created via [npm adduser](https://docs.npmjs.com/cli/adduser) or on [npmjs.com](https://www.npmjs.com) |
| `NPM_PASSWORD` | Password of the npm user. |
| `NPM_EMAIL` | Email address associated with the npm user |
Use either `NPM_TOKEN` for token authentication or `NPM_USERNAME`, `NPM_PASSWORD` and `NPM_EMAIL` for legacy authentication
### Options
The plugins are based on `npm` and will use the configuration from [`.npmrc`](https://docs.npmjs.com/files/npmrc). See [npm config](https://docs.npmjs.com/misc/config) for the option list.
The [`registry`](https://docs.npmjs.com/misc/registry) and [`dist-tag`](https://docs.npmjs.com/cli/dist-tag) can be configured in the `package.json` and will take precedence over the configuration in `.npmrc`:
```json

@@ -37,2 +52,5 @@ {

```
### Usage
The plugins are used by default by [semantic-release](https://github.com/semantic-release/semantic-release) so no specific configuration is requiered to use them.

@@ -39,0 +57,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc