Open annakrystalli opened 1 month ago
Going forward, it would be good to stick to such standard formatting as it will make pin-pointing changes between versiions much clearer.
THIS SO MUCH THIS.
I think it would be good to include this as a small shell script in the repo so that people don't have to think about the exact jq incantation (below).
We could have a GitHub workflow that does this via a PR command a la /diff
that would do the transformation and automatically push to the PR (see https://github.com/r-lib/actions/blob/v2-branch/examples/pr-commands.yaml) (NOTE: for people to be able to run this, their membership in this organization needs to be public).
Regarding sponge... I don't think we need it. We are not so constrained for space that we can't do this with a temp file:
tmp=$(mktemp) && jq -c --indent 4 . v3.0.1/tasks-schema.json > $tmp && cp $tmp v3.0.1/tasks-schema.json && rm $tmp
Written as a BASH script, we could have it transform both at once.
#!/usr/bin/env bash
version="${1:-v3.0.1}"
tasks="${version}/tasks-schema.json"
admin="${version}/admin-schema.json"
tmp="$(mktemp)"
# clean up the tasks schema
jq -c --indent 4 . "${tasks}" > "${tmp}"
cp "${tmp}" "${tasks}"
# clean up the admin schema
jq -c --indent 4 . "${admin}" > "${tmp}"
cp "${tmp}" "${admin}"
rm "${tmp}"
Cool! I think it would be cool if we did not have to specify the latest version number but for the script to auto-detect it.
The one thing I am not at all a fan of is PR actions that modify the contents of the remote branch. The unsynching of local and remote can cause annoying merge conflicts. It would be preferable for me if we had a way to remind folks to do this before they commit/push etc.
In #106 I used the following commands to un-collapse any arrays in the schema files:
This does not change any of the content of the files, just the formatting but will allow diffs in #103 to be show up correctly.
Going forward, it would be good to stick to such standard formatting as it will make pin-pointing changes between versiions much clearer.
I can see to needs for folks updating the schema:
sponge
which is something chatgpt suggested when I asked it not to not to create temp files when re-writing the styled files, which it was initially. Perhaps we don't want to add more dependencies on top ofjq
.@zkamvar would be interested in your thoughts about how best to ensure all our schemas undergo this transformation prior to making a PR but suggestions welcome by anyone!