# @blackpepper/enforce

> Verify an npm environment is as expected

Latest version **1.2.0** (published 2019-06-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @blackpepper/enforce
pnpm add @blackpepper/enforce
yarn add @blackpepper/enforce
bun add @blackpepper/enforce
```

Provides the commands `enforce`, `enforce-yarn`, `enforce-registry`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-06-06 |
| First published | 2019-05-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 144.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryan Pickett |
| Maintainers | hdpe, nandish, simonajones |

## Links

- npm: https://www.npmjs.com/package/@blackpepper/enforce
- Homepage: https://github.com/BlackPepperSoftware/enforce
- npm.io page: https://npm.io/package/@blackpepper/enforce

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [yargs](https://npm.io/package/yargs.md) ^13.2.2
- [semver](https://npm.io/package/semver.md) ^6.1.1
- [registry-url](https://npm.io/package/registry-url.md) ^5.1.0

## Recent versions

- 1.2.0 (latest) — 2019-06-06
- 1.1.0 — 2019-06-04
- 1.0.0 — 2019-05-09

## README

# @blackpepper/enforce

Verify an npm environment is as expected before install.

## Installation

Setup via an npm `preinstall` script. For example:

`package.json`:

```json
{
  "scripts": {
    "preinstall": "ENFORCE_VERSION=1.2.0; ENFORCE_DIR=\"$HOME/.npm/enforce/$ENFORCE_VERSION\"; 
\"$ENFORCE_DIR/bin/enforce\" present || npm i -g --prefix=\"$ENFORCE_DIR\"
@blackpepper/enforce@$ENFORCE_VERSION || exit 1; PATH=\"$ENFORCE_DIR/bin:$PATH\"; 
enforce --npm --registry http://my.com/registry/"
  }
}
```

You can reduce configuration, or use an organisation-wide `enforce` script, by pulling it down from a known location.

`package.json`:
 
```json
{
  "scripts": {
    "preinstall": "curl -s http://my.com/enforce/config | bash"
  }
}
```

## Options

### `--npm [version]`
### `--no-npm`

Enforce, or prohibit, the use of `npm` as a package manager.

In the `--npm` form, resolution of the optional `version` argument uses [semver](https://www.npmjs.com/package/semver). 

```
$ enforce --npm
$ enforce --npm ">=6.9.0"
$ enforce --no-npm
```

### `--yarn [version]`
### `--no-yarn`

Enforce, or prohibit, the use of `yarn` as a package manager.

In the `--yarn` form, resolution of the optional `version` argument uses [semver](https://www.npmjs.com/package/semver).

```
$ enforce --yarn
$ enforce --yarn ">=1.12.3"
$ enforce --no-yarn
```

### `--registry`

Enforce the use of a given registry.

```
$ enforce --registry http://my.com/registry/
```

### `present`

Convenience command to verify `enforce` is installed. Just terminates normally with
a zero exit code.

```
$ enforce present
```

---
_Source: https://npm.io/package/@blackpepper/enforce · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
