Repository navigation
feat: add JSON schema for config - #1074
Conversation
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
|
The JSON Schema is too large to maintain manually, so we need automated tooling to keep it up to date. Please include the generator in this PR; without it, ongoing maintenance would not be feasible. The schema file is also quite large and would increase the npm package size. I'd prefer to keep it in the GitHub repository and let users load it via a URL, rather than include it in the published npm package. |
|
Yeah, i totally agree. Will follow up on that. |
|
Actually, I'd prefer to have the generator produce a Zod (or Zod-like) schema first, then convert it to JSON Schema. This would make the code more intuitive to maintain and the process more reliable. |
|
Since Rolldown uses Valibot, I'd actually prefer Valibot over Zod here. |
|
Agreed. I’ll rework the generator to produce Valibot schemas first and convert those to JSON Schema, then include the generator and generated schema in the PR. I’ll also keep the generated schema out of the npm package and serve it from the repository instead. :) |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Also run |
|
Question Should the JSON-specific schema omit all function/API-only options recursively, or should these remain unconstrained? |
|
I'd prefer to keep these options unconstrained in the JSON Schema, including nested ones, rather than omit them. |
Cool, then this PR is ready for final review. Nothing else from me. |
|
looks good to me |
|
LGTM. Maybe we can also introduce a new package |
Great! Should @tsdown/schema be a follow-up issue, or would you rather have it included in this pr? |
|
I'm okay for both. It's up to you. BTW, I'm currently on vacation, and this PR will be delayed by few days. |
|
Have a nice vacation 🌴 |
|
@sxzz |
AI usage
Description
Attempt at adding a generated JSON Schema for
tsdown.config.json.Generation
The schema was generated from tsdown’s
UserConfigTypeScript type using the TypeScript compiler API.It preserves:
@defaultvalues when they are JSON-compatible literals@deprecatedannotations$defsand$refdefinitionsFunction-only options, plugins, and callbacks are omitted because they cannot be represented in JSON.
The generator is currently kept separate from this PR. If preferred, it can be added to the repository later to regenerate the schema automatically.
Linked Issues
fix #679
Additional context
Verified with: