You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 18, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+19-11Lines changed: 19 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,16 @@
2
2
3
3
Execute allowed `npm install` lifecycle scripts.
4
4
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.
6
12
7
-
Run your `npm install` with `--ignore-scripts` (or add `ignore-scripts=true` in your `.npmrc`), then:
13
+
14
+
## Usage
8
15
9
16
```
10
17
$ npx allow-scripts [--dry-run]
@@ -21,20 +28,21 @@ Running the command will scan the list of installed dependencies (from the first
21
28
-`prepublish` in the main package
22
29
-`prepare` in the main package
23
30
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
32
32
33
-
Example for `package.json`:
34
33
```
35
34
"allowScripts": {
36
35
"fsevents": "*", # allow install scripts in all versions
37
36
"node-sass": false, # ignore install scripts for all versions
38
37
"webpack-cli": "3.x.x" # allow all minors for v3, ignore everything else
39
38
}
40
39
```
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