Fix bug where we only rendered one TypeDoc JSON key per export, instead of all of them
This commit is contained in:
parent
4e6322beb5
commit
fdcb42d8e1
@ -18,12 +18,12 @@ interface ExportInfo {
|
|||||||
exportPathOrder: string[];
|
exportPathOrder: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ExportNameToTypedocName {
|
interface ExportNameToTypedocNames {
|
||||||
[exportName: string]: string;
|
[exportName: string]: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Metadata {
|
interface Metadata {
|
||||||
exportPathToTypedocName: ExportNameToTypedocName;
|
exportPathToTypedocNames: ExportNameToTypedocNames;
|
||||||
exportPathOrder: string[];
|
exportPathOrder: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,10 +224,12 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging:
|
|||||||
});
|
});
|
||||||
|
|
||||||
// For each entry, see if it was exported in index.ts. If not, remove it.
|
// For each entry, see if it was exported in index.ts. If not, remove it.
|
||||||
const exportPathToTypedocName: ExportNameToTypedocName = {};
|
const exportPathToTypedocNames: ExportNameToTypedocNames = {};
|
||||||
_.each(typedocOutput.children, (file, i) => {
|
_.each(typedocOutput.children, (file, i) => {
|
||||||
const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name);
|
const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name);
|
||||||
exportPathToTypedocName[exportPath] = file.name;
|
exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath])
|
||||||
|
? [file.name]
|
||||||
|
: [...exportPathToTypedocNames[exportPath], file.name];
|
||||||
|
|
||||||
const exportItems = exportPathToExportedItems[exportPath];
|
const exportItems = exportPathToExportedItems[exportPath];
|
||||||
_.each(file.children, (child, j) => {
|
_.each(file.children, (child, j) => {
|
||||||
@ -245,7 +247,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging:
|
|||||||
// Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON
|
// Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON
|
||||||
const docJson = {
|
const docJson = {
|
||||||
metadata: {
|
metadata: {
|
||||||
exportPathToTypedocName,
|
exportPathToTypedocNames,
|
||||||
exportPathOrder,
|
exportPathOrder,
|
||||||
},
|
},
|
||||||
typedocJson: finalTypeDocOutput,
|
typedocJson: finalTypeDocOutput,
|
||||||
|
@ -60,14 +60,16 @@ export const typeDocUtils = {
|
|||||||
},
|
},
|
||||||
convertToDocAgnosticFormat(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo): DocAgnosticFormat {
|
convertToDocAgnosticFormat(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo): DocAgnosticFormat {
|
||||||
const exportPathOrder = generatedDocJson.metadata.exportPathOrder;
|
const exportPathOrder = generatedDocJson.metadata.exportPathOrder;
|
||||||
const exportPathToTypedocName = generatedDocJson.metadata.exportPathToTypedocName;
|
const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames;
|
||||||
const typeDocJson = generatedDocJson.typedocJson;
|
const typeDocJson = generatedDocJson.typedocJson;
|
||||||
|
|
||||||
// TODO: Extract the non typeDoc exports, and render them somehow
|
// TODO: Extract the non typeDoc exports, and render them somehow
|
||||||
const typeDocNameOrder = _.compact(
|
const typeDocNameOrder = _.compact(
|
||||||
_.map(exportPathOrder, exportPath => {
|
_.flatten(
|
||||||
return exportPathToTypedocName[exportPath];
|
_.map(exportPathOrder, exportPath => {
|
||||||
}),
|
return exportPathToTypedocNames[exportPath];
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const docAgnosticFormat: DocAgnosticFormat = {};
|
const docAgnosticFormat: DocAgnosticFormat = {};
|
||||||
@ -121,6 +123,7 @@ export const typeDocUtils = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (!_.isEmpty(typeEntities)) {
|
if (!_.isEmpty(typeEntities)) {
|
||||||
|
console.log('typeEntities', typeEntities);
|
||||||
docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME;
|
docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME;
|
||||||
docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME];
|
docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME];
|
||||||
const docSection = typeDocUtils._convertEntitiesToDocSection(
|
const docSection = typeDocUtils._convertEntitiesToDocSection(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user