Skip to content
This repository was archived by the owner on Aug 18, 2024. It is now read-only.

Commit 7c6d215

Browse files
committed
docs: add tl;dr
1 parent 6f847d7 commit 7c6d215

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
Execute allowed `npm install` lifecycle scripts.
44

5-
## Usage
5+
## tl;dr
6+
7+
- Whitelist packages that you trust in your `package.json`: `"allowScripts": { "packageName": "1.x.x - 2.x.x" }`
8+
- Run `npm install --ignore-scripts` or `yarn install --ignore-scripts`
9+
- Run `npx allow-scripts`
10+
11+
Only the explicitly allowed `[pre|post]install` scripts will be executed.
612

7-
Run your `npm install` with `--ignore-scripts` (or add `ignore-scripts=true` in your `.npmrc`), then:
13+
14+
## Usage
815

916
```
1017
$ npx allow-scripts [--dry-run]
@@ -21,20 +28,21 @@ Running the command will scan the list of installed dependencies (from the first
2128
- `prepublish` in the main package
2229
- `prepare` in the main package
2330

24-
Allowed package list is configurable in `package.json` by adding an `allowScripts` property, with an object where the key is a package name and the value is one of:
25-
26-
* a string with a semver specifier for allowed versions
27-
- non-matching versions will be ignored
28-
* `true` - allow all versions (equivalent to `'*'` semver specifier)
29-
* `false` - ignore all versions
30-
31-
If a package has a lifecycle script, but is neither allowed nor ignored, `allow-scripts` will exit with an error.
31+
### Configuration
3232

33-
Example for `package.json`:
3433
```
3534
"allowScripts": {
3635
"fsevents": "*", # allow install scripts in all versions
3736
"node-sass": false, # ignore install scripts for all versions
3837
"webpack-cli": "3.x.x" # allow all minors for v3, ignore everything else
3938
}
4039
```
40+
41+
Allowed package list is configurable in `package.json` by adding an `allowScripts` property, with an object where the key is a package name and the value is one of:
42+
43+
* a string with a semver specifier for allowed versions
44+
- non-matching versions will be ignored
45+
* `true` - allow all versions (equivalent to `'*'` semver specifier)
46+
* `false` - ignore all versions
47+
48+
If a package has a lifecycle script, but is neither allowed nor ignored, `allow-scripts` will exit with an error.

0 commit comments

Comments
 (0)