-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify that devEngines is a conceptual subset of engines; solve for CI use #28
Comments
Isn’t this assumption perhaps the root problem? If you want to test how a library works for consumers, you should probably install it and run it as a consumer. So from a new app/project, Then you would need to figure out how to run the tests from this context, but that’s its own solvable problem. They could be copied into this new folder and run from there, for example. |
That's a very reasonable position to hold, but it's not what basically anyone ever does (meaning, testing the tarball contents). |
For an application,
engines
is useless, so one would only usedevEngines
(or only useengines
), and the incremental value fordevEngines
is minimalFor a node npm package, the intended and common usage will be something perhaps like this (noting that "see a warning" may be replaced with "fail with an error" if configured as such):
engines.node
would be eg^20 || >= 22
, indicating you can use node 20 or 22+devEngines.runtime.node
would be eg22
, indicating you should develop the package with node 22npm install
is ran by a developer of the package, users should see a warning unless they're on node 22This matches npm's current implementation of devEngines, as far as I'm aware.
However, there's an additional critically important scenario: CI.
One should be testing this hypothetical package on node 20 and 22+ (every major, or every minor, to the maintainer's preference). However, tests run
npm install
as if they were a developer of the package. Thus, CI runs that are on node 20 will see a warning (not that big a deal) or, fail the tests. That defeats the entire purpose ofdevEngines
.Current possible solutions:
devEngines
before the workflow run, and hope it doesn't get accidentally committed before you restore package.jsonI'm planning to make a PR to npm to create a config setting (that can be set in
.npmrc
or by environment variable) that when enabled, will check the union ofengines
anddevEngines
(instead of justdevEngines
). Depending on how the npm team's feedback to that plays out, ofc, we should strive to communicate very clearly that such a mechanism is necessary - and that without such a mechanism,devEngines
isn't worth implementing at all.The text was updated successfully, but these errors were encountered: