docs(angular): update docs generation to account for builders (#13469)

This commit is contained in:
Leosvel Pérez Espinosa 2022-11-29 21:11:20 +01:00 committed by GitHub
parent 6c59cbbb3b
commit 81aef458c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1260 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,11 @@
"delegate-build", "delegate-build",
"ng-packagr-lite", "ng-packagr-lite",
"package", "package",
"file-server" "file-server",
"webpack-browser",
"webpack-dev-server",
"webpack-server",
"module-federation-dev-server"
], ],
"generators": [ "generators": [
"add-linting", "add-linting",

View File

@ -50,14 +50,28 @@ function getSchemaList(
folderName: string; folderName: string;
root: string; root: string;
}, },
type: 'generators' | 'executors' collectionFileName: string,
collectionEntries: string[]
): SchemaMetadata[] { ): SchemaMetadata[] {
const targetPath = join(paths.absoluteRoot, paths.root, type + '.json'); const targetPath = join(paths.absoluteRoot, paths.root, collectionFileName);
try { try {
return Object.entries(readJsonSync(targetPath, 'utf8')[type]).map( const metadata: SchemaMetadata[] = [];
([name, schema]: [string, JsonSchema1]) => const collectionFile = readJsonSync(targetPath, 'utf8');
createSchemaMetadata(name, schema, paths) for (const entry of collectionEntries) {
); if (!collectionFile[entry]) {
continue;
}
metadata.push(
...Object.entries<JsonSchema1>(collectionFile[entry])
.filter(([name]) => !metadata.find((x) => x.name === name))
.map(([name, schema]: [string, JsonSchema1]) =>
createSchemaMetadata(name, schema, paths)
)
);
}
return metadata;
} catch (e) { } catch (e) {
console.log( console.log(
`SchemaMetadata "${paths.root `SchemaMetadata "${paths.root
@ -87,7 +101,7 @@ export function getPackageMetadataList(
*/ */
const additionalApiReferences: any = DocumentationMap.content.find( const additionalApiReferences: any = DocumentationMap.content.find(
(data) => data.id === 'additional-api-references' (data) => data.id === 'additional-api-references'
).itemList; )!.itemList;
// Do not use map.json, but add a documentation property on the package.json directly that can be easily resolved // Do not use map.json, but add a documentation property on the package.json directly that can be easily resolved
return sync(`${packagesDir}/*`, { ignore: [`${packagesDir}/cli`] }).map( return sync(`${packagesDir}/*`, { ignore: [`${packagesDir}/cli`] }).map(
@ -123,7 +137,8 @@ export function getPackageMetadataList(
folderName, folderName,
root: relativeFolderPath, root: relativeFolderPath,
}, },
'generators' 'generators.json',
['generators']
), ),
executors: getSchemaList( executors: getSchemaList(
{ {
@ -131,7 +146,8 @@ export function getPackageMetadataList(
folderName, folderName,
root: relativeFolderPath, root: relativeFolderPath,
}, },
'executors' 'executors.json',
['executors', 'builders']
), ),
}; };
} }