Skip to content

feat(config): support "engines" field in deno.json - #35686

Open
bartlomieju wants to merge 1 commit into
mainfrom
feat/deno-json-engines
Open

feat(config): support "engines" field in deno.json#35686
bartlomieju wants to merge 1 commit into
mainfrom
feat/deno-json-engines

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

Deno had no way to declare which runtime version a project expects. npm
projects can do this with the engines field of package.json, and Deno
already reads engines.deno / engines.node from package.json, but the
equivalent was missing for deno.json. This adds an engines field to
deno.json using the exact same shape (for example
{ "engines": { "deno": ">=2.0.0" } }).

When the current runtime does not satisfy a declared requirement, Deno
prints a warning, matching the way npm and yarn treat engines by
default. It is always a warning, never an error, and only the deno and
node keys are checked since Deno cannot reason about external tool
versions. Unlike the package.json check, which runs during install, the
deno.json check runs on every command so that running a project under an
incompatible Deno version surfaces the warning immediately. The
version-matching logic is shared with the existing package.json handling.

Closes #26415

Adds support for an `engines` field in `deno.json`, using the same shape
as the `engines` field of `package.json` (e.g. `{ "deno": ">=2.0.0" }`).
When the current runtime does not satisfy a declared requirement, Deno
emits a warning, matching npm/yarn behavior. This is always a warning,
never an error.

Only the `deno` and `node` keys are checked; other keys (`npm`, `pnpm`,
...) are ignored since Deno cannot reason about external tool versions.
The deno.json check runs on every command (not just `deno install`), so
running a project under an incompatible Deno version surfaces the
warning immediately.

The version-matching logic is shared with the existing package.json
`engines` handling via a new `cli/util/engines.rs` helper.

Closes #26415
@Hajime-san

Hajime-san commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What would happen if an option to swap out the JS engine were to appear in the configuration file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specify deno version in deno.json

2 participants