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
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,12 +38,13 @@ import { getUserAgent } from 'package-manager-detector/detect'
38
38
39
39
## Customize Detection Strategy
40
40
41
-
By default, the `detect` API searches through the current directory for lock files, and if none exists, the `package.json``packageManager` field. If both strategies couldn't detect the package manager, it'll crawl upwards to the parent directory and repeat the detection process until it reaches the root directory.
41
+
By default, the `detect` API searches through the current directory for lock files, and if none exists, it looks for the `packageManager` field in `package.json`. If that also doesn't exist, it will check the `devEngines.packageManager` field in `package.json`. If all strategies couldn't detect the package manager, it'll crawl upwards to the parent directory and repeat the detection process until it reaches the root directory.
42
42
43
43
The strategies can be configured through `detect`'s `strategies` option with the following accepted strategies:
44
44
45
45
-`'lockfile'`: Look up for lock files.
46
46
-`'packageManager-field'`: Look up for the `packageManager` field in package.json.
47
+
-`'devEngines-field'`: Look up for the `devEngines.packageManager` field in package.json.
47
48
-`'install-metadata'`: Look up for installation metadata added by package managers.
48
49
49
50
The order of the strategies can also be changed to prioritize one strategy over another. For example, if you prefer to detect the package manager used for installation:
@@ -52,7 +53,7 @@ The order of the strategies can also be changed to prioritize one strategy over
0 commit comments