Handle deleting temportary mkdocs.yml

Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
Andre Wanlin
2023-01-25 14:37:01 -06:00
committed by Renan Mendes Carvalho
parent c2bba4affe
commit 37c17ab92c
7 changed files with 45 additions and 14 deletions
@@ -25,7 +25,7 @@ import { ParsedLocationAnnotation } from '../../helpers';
import {
createOrUpdateMetadata,
getGeneratorKey,
getMkdocsYml,
getMkDocsYml,
getRepoUrlFromLocationAnnotation,
patchIndexPreBuild,
storeEtagMetadata,
@@ -517,7 +517,7 @@ describe('helpers', () => {
});
});
describe('getMkdocsYml', () => {
describe('getMkDocsYml', () => {
const inputDir = resolvePath(__filename, '../__fixtures__/');
const siteOptions = {
name: mockEntity.metadata.title,
@@ -530,7 +530,7 @@ describe('helpers', () => {
path: mkdocsPath,
content,
configIsTemporary,
} = await getMkdocsYml(inputDir, siteOptions);
} = await getMkDocsYml(inputDir, siteOptions);
expect(mkdocsPath).toBe(key);
expect(content).toBe(mkdocsYml.toString());
@@ -544,7 +544,7 @@ describe('helpers', () => {
path: mkdocsPath,
content,
configIsTemporary,
} = await getMkdocsYml(inputDir, siteOptions);
} = await getMkDocsYml(inputDir, siteOptions);
expect(mkdocsPath).toBe(key);
expect(content).toBe(mkdocsYml.toString());
expect(configIsTemporary).toBe(false);
@@ -562,7 +562,7 @@ describe('helpers', () => {
path: mkdocsPath,
content,
configIsTemporary,
} = await getMkdocsYml(inputDir, defaultSiteOptions);
} = await getMkDocsYml(inputDir, defaultSiteOptions);
expect(mkdocsPath).toBe(key);
expect(content).toBe(mkdocsDefaultYml.toString());
@@ -571,7 +571,7 @@ describe('helpers', () => {
it('throws when neither .yml nor .yaml nor default file is present', async () => {
const invalidInputDir = resolvePath(__filename);
await expect(getMkdocsYml(invalidInputDir, siteOptions)).rejects.toThrow(
await expect(getMkDocsYml(invalidInputDir, siteOptions)).rejects.toThrow(
/Could not read MkDocs YAML config file mkdocs.yml or mkdocs.yaml or default for validation/,
);
});
@@ -193,7 +193,7 @@ export const generateMkdocsYml = async (
* @param siteOptions - options for the site: `name` property will be used in mkdocs.yml for the
* required `site_name` property, default value is "Documentation Site"
*/
export const getMkdocsYml = async (
export const getMkDocsYml = async (
inputDir: string,
siteOptions?: { name?: string },
): Promise<{ path: string; content: string; configIsTemporary: boolean }> => {
@@ -15,7 +15,7 @@
*/
export { TechdocsGenerator } from './techdocs';
export { Generators } from './generators';
export { getMkdocsYml } from './helpers';
export { getMkDocsYml } from './helpers';
export type {
GeneratorBase,
GeneratorOptions,
@@ -24,7 +24,7 @@ import {
} from '@backstage/integration';
import {
createOrUpdateMetadata,
getMkdocsYml,
getMkDocsYml,
patchIndexPreBuild,
runCommand,
storeEtagMetadata,
@@ -100,7 +100,7 @@ export class TechdocsGenerator implements GeneratorBase {
} = options;
// Do some updates to mkdocs.yml before generating docs e.g. adding repo_url
const { path: mkdocsYmlPath, content } = await getMkdocsYml(
const { path: mkdocsYmlPath, content } = await getMkDocsYml(
inputDir,
siteOptions,
);