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

feat(registry): replace yq exec in file: source #1696

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

baod-rate
Copy link
Contributor

for the file: registry source, replace the call to yq with a vendored pure-lua yaml parser.

This reduces our dependencies on external programs, especially since yq is not easily available on every system. e.g. the default yq program in Arch is kislyuk/yq rather than mikefarah/yq as command seems to expect.

I confirmed by comparing the json output of the github:mason-org/mason-registry source against the json-encoded output of the file: source pointing at a local copy. Other than the order of some fields they are exactly the same

Vendors pure-lua lib tinyyaml (https://github.com/api7/lua-tinyyaml)
(@ commit 197632c5aca09321ed89ed975613e7c16c7aaa00)
fix for the case where the value in a map begins a new line. e.g.

```yaml
name: foo
description:
  some long string here
  possibly continued here
homepage: http://foobar
...
```
Copy link
Owner

@williamboman williamboman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I'd definitely prefer a no-dependency variant of this. I don't believe I ever tried tinyyaml when initially adding this capability, all other options I tried failed to properly parse simple YAML so I decided to offload it to yq.

I'm unable to find details on exactly what "subset" of YAML this implementation supports. I see you've modified the upstream code to support multi-line strings. Before moving to this implementation I'd like to better understand its limitations to avoid situations where the registry changes in such a way that it no longer is parseable. Do you happen to know what it doesn't support? I tried a couple of YAML documents from different sources and the only issue I discovered so far was multi-document files.

I'd also like to add that the file: protocol is so far only really added to aid in testing registries and is not really meant to be used "permanently".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants