fix(techdocs): do not copy docs/README.md as docs/index.md

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2022-04-04 12:54:46 -04:00
parent 6880fbfb32
commit 9ab9ce617e
9 changed files with 66 additions and 1 deletions
@@ -137,4 +137,24 @@ describe('readGeneratorConfig', () => {
);
});
});
it('should read legacyCopyReadmeMdToIndexMd config', () => {
const config = new ConfigReader({
techdocs: {
generator: {
runIn: 'docker',
dockerImage: 'my-org/techdocs',
pullImage: false,
legacyCopyReadmeMdToIndexMd: true,
},
},
});
expect(readGeneratorConfig(config, logger)).toEqual({
runIn: 'docker',
dockerImage: 'my-org/techdocs',
pullImage: false,
legacyCopyReadmeMdToIndexMd: true,
});
});
});
@@ -111,7 +111,10 @@ export class TechdocsGenerator implements GeneratorBase {
parsedLocationAnnotation,
this.scmIntegrations,
);
await patchIndexPreBuild({ inputDir, logger: childLogger, docsDir });
if (this.options.legacyCopyReadmeMdToIndexMd) {
await patchIndexPreBuild({ inputDir, logger: childLogger, docsDir });
}
}
if (!this.options.omitTechdocsCoreMkdocsPlugin) {
@@ -218,5 +221,8 @@ export function readGeneratorConfig(
omitTechdocsCoreMkdocsPlugin: config.getOptionalBoolean(
'techdocs.generator.mkdocs.omitTechdocsCorePlugin',
),
legacyCopyReadmeMdToIndexMd: config.getOptionalBoolean(
'techdocs.generator.legacyCopyReadmeMdToIndexMd',
),
};
}
@@ -40,6 +40,7 @@ export type GeneratorConfig = {
dockerImage?: string;
pullImage?: boolean;
omitTechdocsCoreMkdocsPlugin?: boolean;
legacyCopyReadmeMdToIndexMd?: boolean;
};
/**