@hutson/set-npm-auth-token-for-ci
Advanced tools
Comparing version 2.1.0 to 3.0.0
@@ -7,5 +7,3 @@ { | ||
}, | ||
"bin": { | ||
"set-npm-auth-token-for-ci": "./src/cli.js" | ||
}, | ||
"bin": "", | ||
"bugs": { | ||
@@ -40,5 +38,4 @@ "url": "https://gitlab.com/hyper-expanse/open-source/set-npm-auth-token-for-ci/issues" | ||
}, | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"dependencies": { | ||
"commander": "^2.19.0", | ||
"debug": "^4.0.0", | ||
@@ -59,3 +56,2 @@ "local-or-home-npmrc": "^1.1.0", | ||
"semantic-release-gitlab": "^7.0.0", | ||
"shelljs": "^0.8.3", | ||
"sinon": "^7.0.0", | ||
@@ -62,0 +58,0 @@ "sinon-chai": "^3.2.0", |
@@ -12,2 +12,5 @@ # @hutson/set-npm-auth-token-for-ci | ||
- [Usage](#usage) | ||
- [CLI Tool](#cli-tool) | ||
- [Programmatically](#programmatically) | ||
- [How It Works](#how-it-works) | ||
- [Debugging](#debugging) | ||
@@ -24,9 +27,34 @@ - [Node Support Policy](#node-support-policy) | ||
```bash | ||
yarn [global] add [--dev] @hutson/set-npm-auth-token-for-ci | ||
yarn add [--dev] @hutson/set-npm-auth-token-for-ci | ||
``` | ||
> **Note:** Whether you install the package globally, as a runtime dependency, or a development dependency, depends on how you plan to use this package. If you are planning to use the CLI from this package to set auth tokens for multiple projects, consider a global installation. Otherwise, consider adding this package as a dependency on the project for which it will be used. | ||
> **Note:** Whether you install the package as a runtime dependency, or a development dependency, depends on how you plan to use this package. | ||
## Usage | ||
### CLI Tool | ||
Please see our documentation for the [`@hutson/set-npm-auth-token-for-ci-cli`](https://www.npmjs.com/package/@hutson/set-npm-auth-token-for-ci-cli) command line tool. | ||
### Programmatically | ||
```javascript | ||
const setNpmAuthTokenForCI = require(`@hutson/set-npm-auth-token-for-ci`); | ||
// To write the authentication token placeholder, invoke the imported function: | ||
setNpmAuthTokenForCI(); | ||
``` | ||
If an issue is encountered while writing to the `.npmrc` file, an exception will be thrown. Consider wrapping `setNpmAuthTokenForCI` in a `try`/`catch`. | ||
```javascript | ||
try { | ||
setNpmAuthTokenForCI(); | ||
} catch (error) { | ||
/* Handle the error. */ | ||
} | ||
``` | ||
### How It Works | ||
When you need to authenticate with an npm-compatible package registry using the `npm` or `yarn` package manager, and you are authenticating with that registry from within a Continuous Integration environment, you are strongly encouraged to use an [authentication token placeholder](http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules). | ||
@@ -62,35 +90,2 @@ | ||
**CLI Tool** | ||
After you've installed `set-npm-auth-token-for-ci`, you can call the tool based on whether you installed it globally or locally: | ||
_Globally_ | ||
```bash | ||
set-npm-auth-token-for-ci | ||
``` | ||
_Locally_ | ||
```bash | ||
$(yarn bin)/set-npm-auth-token-for-ci | ||
``` | ||
**Programmatically** | ||
```javascript | ||
const setNpmAuthTokenForCI = require(`@hutson/set-npm-auth-token-for-ci`); | ||
// To write the authentication token placeholder, invoke the imported function: | ||
setNpmAuthTokenForCI(); | ||
``` | ||
If an issue is encountered while writing to the `.npmrc` file, an exception will be thrown. Consider wrapping `setNpmAuthTokenForCI` in a `try`/`catch`. | ||
```javascript | ||
try { | ||
setNpmAuthTokenForCI(); | ||
} catch (error) { | ||
/* Handle the error. */ | ||
} | ||
``` | ||
## Debugging | ||
@@ -113,15 +108,2 @@ | ||
If you are using the CLI, it would be: | ||
```bash | ||
DEBUG=set-npm-auth-token-for-ci set-npm-auth-token-for-ci | ||
``` | ||
On the Windows command line you may do: | ||
```bash | ||
set DEBUG=set-npm-auth-token-for-ci | ||
set-npm-auth-token-for-ci | ||
``` | ||
## Node Support Policy | ||
@@ -128,0 +110,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
3
13
13
26235
5
137
122
- Removedcommander@^2.19.0
- Removedcommander@2.20.3(transitive)