feat(config): support "engines" field in deno.json - #35686
Open
bartlomieju wants to merge 1 commit into
Open
Conversation
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
Contributor
|
What would happen if an option to swap out the JS engine were to appear in the configuration file? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deno had no way to declare which runtime version a project expects. npm
projects can do this with the
enginesfield ofpackage.json, and Denoalready reads
engines.deno/engines.nodefrompackage.json, but theequivalent was missing for
deno.json. This adds anenginesfield todeno.jsonusing 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
enginesbydefault. It is always a warning, never an error, and only the
denoandnodekeys are checked since Deno cannot reason about external toolversions. Unlike the
package.jsoncheck, which runs during install, thedeno.jsoncheck runs on every command so that running a project under anincompatible Deno version surfaces the warning immediately. The
version-matching logic is shared with the existing
package.jsonhandling.Closes #26415