docs: generate config from json schema#1008
Merged
arcanis merged 5 commits intoMar 4, 2020
Merged
Conversation
arcanis
reviewed
Mar 2, 2020
Member
|
I really like the idea btw 👍 |
1 task
arcanis
reviewed
Mar 3, 2020
Comment on lines
+36
to
+38
| "json-ref-lite@*": | ||
| dependencies: | ||
| "sync-request": "*" |
Member
Member
Author
There was a problem hiding this comment.
You're right, it's not actually needed. I added it a few days ago to get rid of a weird error message that happened only in specific cases that I don't remember anymore and that I can't reproduce anymore.😅
As I was writing this, Netlify just made me remember.😄
Module not found: Error: A package is trying to access another package without the second one being listed as a dependency of the first one
11:07:16 PM: Required package: sync-request (via "sync-request")
11:07:16 PM: Required by: json-ref-lite@npm:1.1.0
Member
Author
There was a problem hiding this comment.
If instead I do
"json-ref-lite@*":
peerDependenciesMeta:
"sync-request":
optional: trueI get:
Module not found: Error: A package is trying to access a peer dependency that should be provi
ded by its direct ancestor but isn't
Required package: sync-request (via "sync-request")
Required by: json-ref-lite@virtual
Member
There was a problem hiding this comment.
Indeed 🙁 This is because Webpack resolves the require call even if it's a dead call... annoying, but I guess that's the way to go.
3 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.

This PR is an experiment.
What's the problem this PR addresses?
.yarnrc.ymlfiles don't currently have an official / community-made JSON schema. I decided to create a JSON schema, but after I had made it, I realized that the descriptions would have to be kept in sync with the website.How did you fix it?
This PR adds a way to generate a configuration page from a JSON schema.
It is currently only implemented for Yarnrc files.
What does this PR add?
packages/gatsby/src/pages/configuration/yarnrc.json). I have triple-checked it. The descriptions are up-to-date with the website. It also includes types for all of the entries (including regex patterns for some string properties).convertSchemaToConfigurationfunction used to generate a configuration page from a JSON schema (Currently only works for YAML configs, it can easily be made to work with JSON). It doesn't support options that aren't currently used for generating the Yarnrc configuration page, but it can be easily tweaked. Config entries can be configured using the$commentkeyword. It is parsed as JSON.What possibilities does this open up?
https://yarnpkg.com/configuration/yarnrc.jsonorhttps://yarnpkg.com/configuration/schemas/yarnrc.detailssection that includestypesfor every config entry.