-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): show Node.js version support status in version command #20881
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding an additional place where we need to update once we change support for Node
Can we instead of engines.node
from package JSON and if the current Node doesn't fall within the specified semver, using the semver package we issue a warning?
If I understand him correctly, I think I agree with @alan-agius4 here. Instead of hiding this information in the
Then it is available to developers and external tooling if they want to read or consume it, while not causing a hard-error if a different version is used. |
@petebacondarwin @alan-agius4 I think I read Alan's proposal a bit differently which was to use the values in I actually tried to do this yesterday after I made the feature request initially before Charles ended up creating this. What I had was (roughly): private isNodeSupportedForPackages(moduleNames: string[]): boolean {
const nodeEnginesEntries = new Set<string>();
let isUnsupportedVersion = false;
for (const moduleName of moduleNames) {
// Find the package in the workspace
try {
const packagePath = require.resolve(`${moduleName}/package.json`, {
paths: [this.context.root],
});
if (packagePath) {
const { engines } = require(packagePath) as { engines: { node: string } };
nodeEnginesEntries.add(engines.node.replace(/(\>=?)/g, '^'));
}
} catch {}
}
nodeEnginesEntries.forEach((entry: string) => {
isUnsupportedVersion =
isUnsupportedVersion || !semver.satisfies(process.versions.node, entry);
});
return isUnsupportedVersion;
} The concern/issue notably is the requirement of doing something like |
@josephperrott / @petebacondarwin, following a convo with @clydin on Slack, we decided that for the time being we roll with the current approach. And indeed I did mean to use the |
Custom engine fields can also cause install-time errors. We ran into that issue when |
…mmand Unsupported versions of Node.js will now show an unsupported warning when the `ng version` command is executed. Currently Node.js major versions 12 and 14 are considered supported and tested. Closes angular#20879
8123591
to
9292bf1
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Unsupported versions of Node.js will now show an unsupported warning when the
ng version
command is executed.Currently Node.js major versions 12 and 14 are considered supported and tested.
Closes #20879