-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Description of the issue
In our elements' package.jsons, the engines setting for node is >=10 <13, which equates to node 10 and 12. As far as I remember, the intent of this restriction was to be a guardrail for PFE contributors, because node-sass won't run on node 14 and above. By restricting node to 10 and 12, contributors get a clear error about their node version when attempting to run the build.
In an ideal world, this would be better accomplished through a devEngines flag, because the only thing we wanted to restrict was what node version is used when building PFE. Unfortunately no devEngines flag exists.
Meanwhile, the engines flag also limits what node versions users of PFE can be running. For instance, I'm using node 16, and I can't install PFE components into a project because my node verison is outside the range. Because our components run in the browser and not in node, the engines flag is less useful.
I think nvm and the .nvmrc we already have do a good job of being a guardrail for contributors. As for the engines flag, I think we should either:
a. Remove engines entirely and rely on nvm
b. Keep engines but expand it to be very generous, such as >=10
Thoughts, opinions, ideas?
Impacted component(s)
- All of them
Steps to reproduce
With nvm installed.
nvm install 14 && nvm use 14npx yarn add @patternfly/pfelementnpm i @patternfly/pfelement
Actual behavior
npm successfully installs @patternfly/pfelement, but issues a warning:
npm WARN notsup Unsupported engine for @patternfly/[email protected]: wanted: {"node":">=10 <13"} (current: {"node":"14.17.1","npm":"6.14.13"})
yarn refuses to install @patternfly/pfelement
$ npx yarn add @patternfly/pfelement
yarn add v1.22.11
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error @patternfly/[email protected]: The engine "node" is incompatible with this module. Expected version ">=10 <13". Got "14.17.1"
error Found incompatible module.
Note, yarn does have an --ignore-engines flag, but using it is problematic because it has to be included on every single dependency installation, even ones unrelated to PFE. For instance, if I want to yarn add lodash, I must include --ignore-engines.
Expected behavior
yarn is able to install @patternfly/pfelement (and all other elements) successfully. npm is able to install @patternfly/pfelement (and all other elements) without a warning.