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: add json schema for lerna.json #3229
Conversation
ba32c0e
to
79f618d
Compare
I might be wrong, but I think you'd also want the schema to be published as part of the lerna website somehow, such that it can be referred to via uri instead of relative file path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fahslaj The source for this should be within the lerna package so that it is published and can be referenced by other workspaces not just the lerna repo itself. I had already done that on the initial branch: main...lerna-json-schema
Please also add the reference to the schema as part of lerna create
as I had done on that branch.
NOTE: one thing I hadn't yet done on there was update the files
array in the lerna package's package.json
, you will need to do that as well please
Ok there are so many newlines, I'm guessing they are actually not random? 😅 |
Yes, they are not random. I put a new line between the filter options, global options, and command specific options to make it slightly more readable. |
Ah ok fair enough, shame we can't force it to stay like that over time, but then again hopefully this shouldn't need too many major updates anyway! |
9907d3c
to
ef4f120
Compare
I have moved the lerna-schema.json inside of core/lerna. It will now be published with the lerna package. Running |
Adds a json schema for lerna.json.
Motivation and Context
This change improves the developer experience of Lerna. Now, when modifying lerna.json, users can see what properties are valid and a brief description of what they do (taken from the lerna command options documentation).
Note: All options for commands (as described in the command docs) are valid configuration options in lerna.json. They can be provided at three levels, in order of priority:
The json schema for lerna.json supports supplying options at both level 2 and 3 above.
How Has This Been Tested?
I tested the schema by changing lerna.json in this repo and observing (in my editor) the metadata from the schema. I did not manually test every configuration option for every command. I obtained the metadata from the configuration code for each of the Lerna commands (command.js), with some input from the docs.
Types of changes
Checklist: