这是indexloc提供的服务,不要输入任何密码
Skip to content

Add schema.json to have a better IDE intellisense #634

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

Merged
merged 15 commits into from
Feb 9, 2022
Merged

Add schema.json to have a better IDE intellisense #634

merged 15 commits into from
Feb 9, 2022

Conversation

arthurfiorette
Copy link
Contributor

This PR adds an schema.d.ts file with all (documented ones) properties in the turbo.json file. This way, and combining with the new npm run jsonschema script, it's possible to generate an Json schema file.

I configured to the generated file be placed at docs/public/schema.json , so it can be requested from the url https://turborepo.org/schema.json. You can test how powerfull it is with in IDE autocompletion, intellisense and inline documentation.

Try it out in your IDE by adding "$schema": "./docs/public/schema.json"

image

It also updated all (that i saw :P) documentation examples to include the $schema property, this way, it will go by default for all Ctrl C/V users out there.

But i still need to point out some things:

  • As the jsonschema (Is that even a good name?) script is going to be ran a lot, may we add ts-json-schema-generator to the devDependencies group?
  • In the root turbo.json file, i saw an env property, but it is not documented, should i add it or it just shouldn't be there?
  • I am not a native english speaker, even that i mostly copy pasted the tsdocs in the schema.d.ts file, it is not perfect and it probably has some typos.

That's it for now. Thanks for this amazing package!

@vercel
Copy link

vercel bot commented Jan 28, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vercel/turbo-site/F3tW9nj4vsT5hEGsXLUK2re33ZvD
✅ Preview: https://turbo-site-git-fork-arthurfiorette-main.vercel.sh

@arthurfiorette
Copy link
Contributor Author

arthurfiorette commented Jan 28, 2022

https://turbo-site-git-fork-arthurfiorette-main.vercel.sh/schema.json

Another thing that can be done is also mention the hability to get from https://raw.githubusercontent.com/vercel/turborepo/v1.1.0/docs/public/schema.json, so that people can use the correct version of their schema.json. Or even include it at the npm turbo package, so it can be used as "$schema": "node_modules/turbo/schema.json"

@arthurfiorette
Copy link
Contributor Author

@jaredpalmer anything more?

Copy link

@pdroamaral pdroamaral left a comment

Choose a reason for hiding this comment

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

thats nice!

@gsoltis gsoltis added the area: ergonomics Issues and features impacting the developer experience of using turbo label Feb 3, 2022
Copy link
Contributor

@jaredpalmer jaredpalmer left a comment

Choose a reason for hiding this comment

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

Let's move everything into docs folder since this is essentially part of documentation at the moment because it is not directly derived from actual source code

@jaredpalmer jaredpalmer added pr: automerge Kodiak will merge these automatically after checks pass and removed pr: automerge Kodiak will merge these automatically after checks pass labels Feb 9, 2022
@kodiakhq kodiakhq bot merged commit e5c093c into vercel:main Feb 9, 2022
Schniz added a commit that referenced this pull request Mar 3, 2022
This commit continues the amazing work done in #634 and #726.

Instead of generating the JSON schema from a separate TypeScript file,
this commit introduces a new CLI (to avoid bloating the main one) that
will output a JSON schema from the struct definition itself, including
the actual code comments.

This will allow to better integration and to avoid differences between
the two codebases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ergonomics Issues and features impacting the developer experience of using turbo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants