From d746d81bdd1fa37b5ac0c6e39410a228e0535676 Mon Sep 17 00:00:00 2001 From: Renan Mendes Carvalho Date: Wed, 8 Feb 2023 15:10:41 +0100 Subject: [PATCH] renaming(getMkDocsYml): Renamed to getMkdocsYml Suggested by kmatyukhin on https://github.com/backstage/backstage/pull/15417 Signed-off-by: Renan Mendes Carvalho Co-authored-by: Konstantin Matyukhin --- .../techdocs-cli/src/commands/generate/generate.ts | 4 ++-- packages/techdocs-cli/src/commands/serve/mkdocs.ts | 4 ++-- packages/techdocs-cli/src/commands/serve/serve.ts | 4 ++-- plugins/techdocs-node/api-report.md | 2 +- .../src/stages/generate/helpers.test.ts | 12 ++++++------ plugins/techdocs-node/src/stages/generate/helpers.ts | 2 +- plugins/techdocs-node/src/stages/generate/index.ts | 2 +- .../techdocs-node/src/stages/generate/techdocs.ts | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/techdocs-cli/src/commands/generate/generate.ts b/packages/techdocs-cli/src/commands/generate/generate.ts index 8445dd9ec6..db58ea4faf 100644 --- a/packages/techdocs-cli/src/commands/generate/generate.ts +++ b/packages/techdocs-cli/src/commands/generate/generate.ts @@ -21,7 +21,7 @@ import Docker from 'dockerode'; import { TechdocsGenerator, ParsedLocationAnnotation, - getMkDocsYml, + getMkdocsYml, } from '@backstage/plugin-techdocs-node'; import { ContainerRunner, @@ -55,7 +55,7 @@ export default async function generate(opts: OptionValues) { await fs.ensureDir(outputDir); - const { path: mkDocsYmlPath, configIsTemporary } = await getMkDocsYml( + const { path: mkDocsYmlPath, configIsTemporary } = await getMkdocsYml( sourceDir, ); diff --git a/packages/techdocs-cli/src/commands/serve/mkdocs.ts b/packages/techdocs-cli/src/commands/serve/mkdocs.ts index 1a471cf1a6..50aa94e346 100644 --- a/packages/techdocs-cli/src/commands/serve/mkdocs.ts +++ b/packages/techdocs-cli/src/commands/serve/mkdocs.ts @@ -19,7 +19,7 @@ import openBrowser from 'react-dev-utils/openBrowser'; import { createLogger } from '../../lib/utility'; import { runMkdocsServer } from '../../lib/mkdocsServer'; import { LogFunc, waitForSignal } from '../../lib/run'; -import { getMkDocsYml } from '@backstage/plugin-techdocs-node'; +import { getMkdocsYml } from '@backstage/plugin-techdocs-node'; import fs from 'fs-extra'; export default async function serveMkdocs(opts: OptionValues) { @@ -29,7 +29,7 @@ export default async function serveMkdocs(opts: OptionValues) { const localAddr = `http://127.0.0.1:${opts.port}`; const expectedDevAddr = opts.docker ? dockerAddr : localAddr; - const { path: mkDocsYmlPath, configIsTemporary } = await getMkDocsYml( + const { path: mkDocsYmlPath, configIsTemporary } = await getMkdocsYml( './', opts.siteName, ); diff --git a/packages/techdocs-cli/src/commands/serve/serve.ts b/packages/techdocs-cli/src/commands/serve/serve.ts index 48e48d4f66..bf67606481 100644 --- a/packages/techdocs-cli/src/commands/serve/serve.ts +++ b/packages/techdocs-cli/src/commands/serve/serve.ts @@ -22,7 +22,7 @@ import HTTPServer from '../../lib/httpServer'; import { runMkdocsServer } from '../../lib/mkdocsServer'; import { LogFunc, waitForSignal } from '../../lib/run'; import { createLogger } from '../../lib/utility'; -import { getMkDocsYml } from '@backstage/plugin-techdocs-node'; +import { getMkdocsYml } from '@backstage/plugin-techdocs-node'; import fs from 'fs-extra'; function findPreviewBundlePath(): string { @@ -66,7 +66,7 @@ export default async function serve(opts: OptionValues) { ? mkdocsDockerAddr : mkdocsLocalAddr; - const { path: mkDocsYmlPath, configIsTemporary } = await getMkDocsYml( + const { path: mkDocsYmlPath, configIsTemporary } = await getMkdocsYml( './', opts.siteName, ); diff --git a/plugins/techdocs-node/api-report.md b/plugins/techdocs-node/api-report.md index ce5bd1ae09..314a46a405 100644 --- a/plugins/techdocs-node/api-report.md +++ b/plugins/techdocs-node/api-report.md @@ -89,7 +89,7 @@ export const getLocationForEntity: ( ) => ParsedLocationAnnotation; // @public -export const getMkDocsYml: ( +export const getMkdocsYml: ( inputDir: string, siteOptions?: { name?: string; diff --git a/plugins/techdocs-node/src/stages/generate/helpers.test.ts b/plugins/techdocs-node/src/stages/generate/helpers.test.ts index e635542a7c..aad7706ab1 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.test.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.test.ts @@ -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/, ); }); diff --git a/plugins/techdocs-node/src/stages/generate/helpers.ts b/plugins/techdocs-node/src/stages/generate/helpers.ts index 27c24ea66e..e16293f906 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.ts @@ -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 }> => { diff --git a/plugins/techdocs-node/src/stages/generate/index.ts b/plugins/techdocs-node/src/stages/generate/index.ts index fa36486a0f..3bd42643c1 100644 --- a/plugins/techdocs-node/src/stages/generate/index.ts +++ b/plugins/techdocs-node/src/stages/generate/index.ts @@ -15,7 +15,7 @@ */ export { TechdocsGenerator } from './techdocs'; export { Generators } from './generators'; -export { getMkDocsYml } from './helpers'; +export { getMkdocsYml } from './helpers'; export type { GeneratorBase, GeneratorOptions, diff --git a/plugins/techdocs-node/src/stages/generate/techdocs.ts b/plugins/techdocs-node/src/stages/generate/techdocs.ts index 93285b7468..b71148060e 100644 --- a/plugins/techdocs-node/src/stages/generate/techdocs.ts +++ b/plugins/techdocs-node/src/stages/generate/techdocs.ts @@ -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, );