Add generic support for LTS rules#32
Merged
Merged
Conversation
miketimofeev
approved these changes
Jun 16, 2021
AlenaSviridenko
approved these changes
Jun 16, 2021
gordey4doronin
approved these changes
Jun 16, 2021
dmitry-shibanov
approved these changes
Jun 16, 2021
al-cheb
approved these changes
Jun 16, 2021
8 tasks
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.
Context
We need to add new additional property for Node.js versions-manifest.json to show lts title based on https://raw.githubusercontent.com/nodejs/Release/main/schedule.json
We shouldn't implement any node-specific logic on manifest-generator level because we need to keep it generic.
I have decided to add support for custom expressions on config level.
How it works
Manifest generator imports
lts_rule_expressionfrom config, run it and use expression result as a source of rules for LTS decisionDrawbacks
It is not super convenient to keep PowerShell expression as a JSON property but it will allow us to stay generic.
How Node.js config will look like
{ "regex": "node-\\d+\\.\\d+\\.\\d+-(\\w+)-(x\\d+)", "groups": { "arch": 2, "platform": 1 }, "lts_rule_expression": "(Invoke-RestMethod 'https://raw.githubusercontent.com/nodejs/Release/main/schedule.json').PSObject.Properties | Where-Object { $_.Value.codename } | ForEach-Object { @{ Name = $_.Name.TrimStart('v'); Value = $_.Value.codename } }" }