chore(core): add map.json jsonschema (#12701)
This commit is contained in:
parent
e8359d1d0d
commit
6520905fc9
3233
docs/map.json
3233
docs/map.json
File diff suppressed because it is too large
Load Diff
@ -24,10 +24,10 @@ export const packagesApi = new PackagesApi({
|
||||
export const nxDocumentsApi = new DocumentsApi({
|
||||
publicDocsRoot: 'nx-dev/nx-dev/public/documentation',
|
||||
documentSources: [
|
||||
documents.find(
|
||||
documents.content.find(
|
||||
(x) => x.id === 'nx-documentation'
|
||||
) as Partial<DocumentMetadata>,
|
||||
documents.find(
|
||||
documents.content.find(
|
||||
(x) => x.id === 'additional-api-references'
|
||||
) as Partial<DocumentMetadata>,
|
||||
]
|
||||
@ -37,15 +37,15 @@ export const nxDocumentsApi = new DocumentsApi({
|
||||
});
|
||||
export const nxRecipesApi = new DocumentsApi({
|
||||
publicDocsRoot: 'nx-dev/nx-dev/public/documentation',
|
||||
documentSources: [documents.find((x) => x.id === 'nx-recipes')].filter(
|
||||
(x) => !!x
|
||||
) as DocumentMetadata[],
|
||||
documentSources: [
|
||||
documents.content.find((x) => x.id === 'nx-recipes'),
|
||||
].filter((x) => !!x) as DocumentMetadata[],
|
||||
addAncestor: { id: 'recipes', name: 'Recipes' },
|
||||
});
|
||||
export const nxCloudDocumentsApi = new DocumentsApi({
|
||||
publicDocsRoot: 'nx-dev/nx-dev/public/documentation',
|
||||
documentSources: [
|
||||
documents.find(
|
||||
documents.content.find(
|
||||
(x) => x.id === 'nx-cloud-documentation'
|
||||
) as Partial<DocumentMetadata>,
|
||||
]
|
||||
|
||||
@ -37,7 +37,7 @@ function filePathExtractor(file: any): string[] {
|
||||
const mapPathList: string[] = readJsonSync(`${basePath}/map.json`, {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
.map((file: any) => filePathExtractor(file))
|
||||
.content.map((file: any) => filePathExtractor(file))
|
||||
.flat();
|
||||
const readmeMissList = readmePathList.filter((x) => !mapPathList.includes(x));
|
||||
const mapMissList = mapPathList.filter((x) => !readmePathList.includes(x));
|
||||
|
||||
67
scripts/documentation/map-schema.json
Normal file
67
scripts/documentation/map-schema.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "documentation-map-schema",
|
||||
"title": "JSON schema for documentation map",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "Title of the document"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Description of the document"
|
||||
},
|
||||
"content": {
|
||||
"type": "array",
|
||||
"description": "Dictionary map section",
|
||||
"items": {
|
||||
"$ref": "#/definitions/entry"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"entry": {
|
||||
"type": "object",
|
||||
"required": ["name", "id"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name for the current item"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Identifier for the current item"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Description for the item"
|
||||
},
|
||||
"file": {
|
||||
"type": "string",
|
||||
"description": "Path to the markdown file"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"description": "Tags are used on nx.dev to link related piece of content together (e.g: Related Documentation)"
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Custom path or URL to find the item on nx.dev"
|
||||
},
|
||||
"isExternal": {
|
||||
"type": "boolean",
|
||||
"description": "Is the path provided is external to nx.dev?"
|
||||
},
|
||||
"itemList": {
|
||||
"type": "array",
|
||||
"description": "Children for the item",
|
||||
"items": {
|
||||
"$ref": "#/definitions/entry"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@ import { Canvas, Image, SKRSContext2D } from '@napi-rs/canvas';
|
||||
import { ensureDir, readFile, readJSONSync, writeFileSync } from 'fs-extra';
|
||||
import { resolve } from 'path';
|
||||
|
||||
const mapJson = readJSONSync('./docs/map.json', 'utf8');
|
||||
const mapJson = readJSONSync('./docs/map.json', 'utf8').content;
|
||||
|
||||
const documents: any[] = [
|
||||
...mapJson.find((x) => x.id === 'nx-documentation')?.['itemList'],
|
||||
|
||||
@ -85,7 +85,7 @@ export function getPackageMetadataList(
|
||||
/**
|
||||
* Get all the custom overview information on each package if available
|
||||
*/
|
||||
const additionalApiReferences: any = DocumentationMap.find(
|
||||
const additionalApiReferences: any = DocumentationMap.content.find(
|
||||
(data) => data.id === 'additional-api-references'
|
||||
).itemList;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user