Skip to content

Commit 574efb2

Browse files
committed
adds devEngines
1 parent 4f67b3d commit 574efb2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

content/cli/v10/configuring-npm/package-json.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,33 @@ Like the `os` option, you can also block architectures:
905905
906906
The host architecture is determined by `process.arch`
907907
908+
### devEngines
909+
910+
You can specify a `devEngines` property in your `package.json` which will run before `install`, `ci`, and `run` commands.
911+
912+
The `devEngines` field aids engineers working on a codebase to all be using the same tooling.
913+
914+
> Note: `engines` and `devEngines` differ in object shape. They also function very differently. `engines` is designed to alert the user when a dependency uses a differening npm or node version that the project it's being used in, whereas `devEngines` is used to alert people interacting with the source code of a project.
915+
916+
The supported keys under the `devEngines` property are `cpu`, `os`, `libc`, `runtime`, and `packageManager`. Each property can be an object or an array of objects. Objects must contain `name`, and optionally can specify `version`, and `onFail`. `onFail` can be `warn`, `error`, or `ignore`, and if left undefined is of the same value as `error`. `npm` will assume that you're running with `node`.
917+
918+
Here's an example of a project that will fail if the environment is not `node` and `npm`. If you set `runtime.name` or `packageManager.name` to any other string, it will fail within the npm CLI.
919+
920+
```json
921+
{
922+
"devEngines": {
923+
"runtime": {
924+
"name": "node",
925+
"onFail": "error"
926+
},
927+
"packageManager": {
928+
"name": "npm",
929+
"onFail": "error"
930+
}
931+
}
932+
}
933+
```
934+
908935
### private
909936

910937
If you set `"private": true` in your package.json, then npm will refuse to publish it.

0 commit comments

Comments
 (0)