jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.66k stars 201 forks source link

[plugins] support reading (and discarding) comments plugin.json files #1923

Closed savil closed 7 months ago

savil commented 7 months ago

Summary

Fixes #1911

This PR cleans the json-file-content of comments before processing it as "json content" i.e. we discard the comments prior to invoking existing logic for ingesting the plugin.json file.

This PR relies on Devbox not programmatically modifying the plugin.json. For now, users hand edit the plugin.json files. This is different from devbox.json which we do programmatically modify due to devbox add, devbox rm and similar commands, and so need to keep track of the json-with-comments' AST.

How was it tested?

To test, I added comments to the following:

  1. local plugin example
  2. a builtin plugin (python)

I did NOT test remote Github plugin. But I tried to modify its code path. Did i get it right?

savil commented 7 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @savil and the rest of your teammates on Graphite Graphite

savil commented 7 months ago

I did NOT test remote Github plugin. But I tried to modify its code path. Did i get it right?

You can use the devbox repo and test with example plugins?

pushed this github repo with comments in the plugin.json: https://github.com/savil/devbox-plugin-example-with-spaces-/blob/main/plugin.json#L13-L18

works once I modify examples/v2-github/devbox.json to use this one

sentry-io[bot] commented 7 months ago

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎