-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
49 additions
and
53 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
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { RnvContext } from '@rnv/core'; | ||
import { RnvContext, RootProjectSchema, logSuccess } from '@rnv/core'; | ||
import { zodToJsonSchema } from 'zod-to-json-schema'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
// import path from 'path'; | ||
// import fs from 'fs'; | ||
export const generateSchema = async (c: RnvContext) => { | ||
const jsonSchema = zodToJsonSchema(RootProjectSchema, 'mySchema'); | ||
jsonSchema['$schema'] = 'http://json-schema.org/draft-04/schema#'; | ||
|
||
export const generateSchema = async (_c: RnvContext) => { | ||
//TODO: switch to zod parser | ||
// const schema: Record<string, any> = getRenativeJsonSchema(); | ||
// schema['$schema'] = 'http://json-schema.org/draft-04/schema#'; | ||
// const destPath = path.join(c.paths.project.dir, 'packages/core/schemas/renative.json'); | ||
// fs.writeFileSync(destPath, JSON.stringify(schema, null, 2)); | ||
const destPath = path.join(c.paths.project.dir, '.rnv/schema/renative.project.json'); | ||
fs.writeFileSync(destPath, JSON.stringify(jsonSchema, null, 2)); | ||
|
||
logSuccess('Sucessfully exported renative.project.json schema'); | ||
}; |
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 |
---|---|---|
@@ -1,20 +1,3 @@ | ||
// import Ajv from 'ajv'; | ||
// import { SCHEMAS_RENATIVE_JSON } from './schemaRenativeJson'; | ||
// import { SCHEMAS_RUNTIME_OBJECT } from './schemaRuntimeObject'; | ||
|
||
// const ajvRenativeJson = new Ajv({ schemas: SCHEMAS_RENATIVE_JSON, allErrors: true, allowUnionTypes: true }); | ||
// const ajvRuntimeObject = new Ajv({ schemas: SCHEMAS_RUNTIME_OBJECT, allErrors: true, allowUnionTypes: true }); | ||
|
||
// export const getRenativeJsonSchema = () => SCHEMAS_RENATIVE_JSON[0]; | ||
// export const validateRenativeJsonSchema = (cObj: any) => { | ||
// const valid = ajvRenativeJson.validate(SCHEMAS_RENATIVE_JSON[0], cObj); | ||
// return [valid, ajvRenativeJson]; | ||
// }; | ||
|
||
// export const getRuntimeObjectSchema = () => SCHEMAS_RUNTIME_OBJECT[0]; | ||
// export const validateRuntimeObjectSchema = (cObj: any) => { | ||
// const valid = ajvRuntimeObject.validate(SCHEMAS_RUNTIME_OBJECT[0], cObj); | ||
// return [valid, ajvRuntimeObject]; | ||
// }; | ||
|
||
export default {}; | ||
export { RootAppSchema } from './configRootApp'; | ||
export { RootProjectSchema } from './configRootProject'; | ||
export * from './validators'; |
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,5 @@ | ||
import type { _ConfigRootApp } from './configRootApp'; | ||
import type { _ConfigRootProject } from './configRootProject'; | ||
|
||
export type ConfigRootProject = _ConfigRootProject; | ||
export type ConfigRootApp = _ConfigRootApp; |
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,5 @@ | ||
import { RootProjectSchema } from './configRootProject'; | ||
|
||
export const validateRenativeProjectSchema = (inputJson: any) => { | ||
return RootProjectSchema.safeParse(inputJson); | ||
}; |
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