-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration JSON Schema support (#60)
* Add configuration JSON Schema support * Create eleven-glasses-peel.md
- Loading branch information
1 parent
a7e07b2
commit a1d05f4
Showing
8 changed files
with
62 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@lunariajs/core": patch | ||
"create-lunaria": patch | ||
--- | ||
|
||
Add configuration JSON Schema support |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { writeFileSync } from 'node:fs'; | ||
import { z } from 'zod'; | ||
import { zodToJsonSchema } from 'zod-to-json-schema'; | ||
import { LunariaConfigSchema } from '../src/schemas/config.js'; | ||
|
||
const mergedSchema = LunariaConfigSchema.merge( | ||
z | ||
.object({ | ||
$schema: z.string().optional(), | ||
}) | ||
.describe('A path or URL to a valid Lunaria JSON Schema.') | ||
); | ||
|
||
const jsonSchema = JSON.stringify(zodToJsonSchema(mergedSchema, 'LunariaConfigSchema')); | ||
|
||
writeFileSync('./dist/config.schema.json', jsonSchema); | ||
|
||
console.log('Lunaria JSON schema generated!'); |
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.