Skip to content
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

Scripts: Enhance check-engines to consider "latest" versions #14201

Open
aduth opened this issue Mar 1, 2019 · 4 comments
Open

Scripts: Enhance check-engines to consider "latest" versions #14201

aduth opened this issue Mar 1, 2019 · 4 comments
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Package] Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.

Comments

@aduth
Copy link
Member

aduth commented Mar 1, 2019

Previously: #12721
Related: #14192 (comment)

Currently, wp-scripts check-engines is hard-coded to default to Node >=10.0.0 and npm >=6.0.0:

'--node', '>=10.0.0',
'--npm', '>=6.0.0',

This doesn't faithfully represent the versions Gutenberg expects, which are respectively "latest Node LTS" and "latest npm version"

You should be running a Node version matching the current active LTS release or newer for this plugin to work correctly.

You also should have the latest release of npm installed.

https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md#getting-started

If the check-engines script is intended to adhere to this recommendation, it should ideally do so in a way which doesn't require manual updates.

It does not appear that the underlying check-node-version project supports this, but perhaps part of the script can be to retrieve the latest versions information.

cc @gziolo @ntwb @adamsilverstein

@aduth aduth added [Type] Enhancement A suggestion for improvement. [Package] Scripts /packages/scripts labels Mar 1, 2019
@ntwb
Copy link
Member

ntwb commented Mar 3, 2019

I wonder if this could be added as an enhancement to the existing valid-values-engines rule of npm-package-json-lint?

https://github.com/tclindner/npm-package-json-lint/wiki/valid-values-engines

@gziolo
Copy link
Member

gziolo commented Mar 4, 2019

I like this proposal. It would be very helpful. The very naive implementation we have at the moment was very easy to implement. It runs as predev and prebuild scripts. My only concern would be how it is handled when someone is offline. At the moment it's a non-issue as those numbers are hardcoded. We would need to ensure it has some cached value as a fallback to be used in a scenario like that.

@aduth
Copy link
Member Author

aduth commented Mar 5, 2019

My only concern would be how it is handled when someone is offline. At the moment it's a non-issue as those numbers are hardcoded. We would need to ensure it has some cached value as a fallback to be used in a scenario like that.

That's true. Another thought which had occurred to me is that we set something up which acts similar to Greenkeeper in automating pull requests to bump the version once a new one becomes available. It just seemed a bit cumbersome / more involved to implement this way.

I wonder if this could be added as an enhancement to the existing valid-values-engines rule of npm-package-json-lint?

How then would it be captured? Is the idea that check-engines script would be updated to compare against the engines entry? Seems to me like it should be doing that anyways.

Update to my own comment: If we wanted this fully automated, the Node Release WG does publish a JSON file with the current LTS codenames:

https://github.com/nodejs/Release/blob/eb91c94/schedule.json#L46-L52

@gziolo
Copy link
Member

gziolo commented Feb 1, 2021

As of #28143, check-engines uses the engines config from @wordpress/scripts by default.

It still would be great to implement the solution that would allow to pass a flag like --latest that is able to detect proper versions.

@gziolo gziolo added Needs Dev Ready for, and needs developer efforts Good First Issue An issue that's suitable for someone looking to contribute for the first time labels Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Package] Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants