From c5d51ad7d4106e4f44d5179c24be2f6464b77f81 Mon Sep 17 00:00:00 2001 From: Renan Mendes Carvalho Date: Wed, 8 Feb 2023 15:46:10 +0100 Subject: [PATCH] renaming(mkDocs): To mkdocs Suggested by kmatyukhin on https://github.com/backstage/backstage/pull/15417 Signed-off-by: Renan Mendes Carvalho Co-authored-by: Konstantin Matyukhin --- .../techdocs-cli/cypress/e2e/mkdocs_serve.cy.js | 4 ++-- .../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 | 14 ++++++++++++++ .../src/stages/generate/helpers.test.ts | 2 +- plugins/techdocs-node/src/stages/generate/index.ts | 7 +++++++ .../{mkDocsPatchers.ts => mkdocsPatchers.ts} | 0 .../techdocs-node/src/stages/generate/techdocs.ts | 2 +- 9 files changed, 31 insertions(+), 10 deletions(-) rename plugins/techdocs-node/src/stages/generate/{mkDocsPatchers.ts => mkdocsPatchers.ts} (100%) diff --git a/packages/techdocs-cli/cypress/e2e/mkdocs_serve.cy.js b/packages/techdocs-cli/cypress/e2e/mkdocs_serve.cy.js index d9da6caeca..d5417e615f 100644 --- a/packages/techdocs-cli/cypress/e2e/mkdocs_serve.cy.js +++ b/packages/techdocs-cli/cypress/e2e/mkdocs_serve.cy.js @@ -16,7 +16,7 @@ /// describe('TechDocs Live Preview - MkDocs Serve', () => { it('successfully serves documentation', () => { - cy.visit(Cypress.env('mkDocsBaseUrl')); + cy.visit(Cypress.env('mkdocsBaseUrl')); cy.contains('hello mock docs'); }); @@ -41,7 +41,7 @@ describe('TechDocs Live Preview - MkDocs Serve', () => { }); it('matchImage - MkDocs Page', () => { - cy.visit(Cypress.env('mkDocsBaseUrl')).then(() => { + cy.visit(Cypress.env('mkdocsBaseUrl')).then(() => { cy.document().matchImage(); }); }); diff --git a/packages/techdocs-cli/src/commands/generate/generate.ts b/packages/techdocs-cli/src/commands/generate/generate.ts index db58ea4faf..b8ad466bb3 100644 --- a/packages/techdocs-cli/src/commands/generate/generate.ts +++ b/packages/techdocs-cli/src/commands/generate/generate.ts @@ -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, ); @@ -116,7 +116,7 @@ export default async function generate(opts: OptionValues) { if (configIsTemporary) { process.on('exit', async () => { - fs.rmSync(mkDocsYmlPath, {}); + fs.rmSync(mkdocsYmlPath, {}); }); } diff --git a/packages/techdocs-cli/src/commands/serve/mkdocs.ts b/packages/techdocs-cli/src/commands/serve/mkdocs.ts index 50aa94e346..c061d4474f 100644 --- a/packages/techdocs-cli/src/commands/serve/mkdocs.ts +++ b/packages/techdocs-cli/src/commands/serve/mkdocs.ts @@ -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, ); @@ -81,7 +81,7 @@ export default async function serveMkdocs(opts: OptionValues) { if (configIsTemporary) { process.on('exit', async () => { - fs.rmSync(mkDocsYmlPath, {}); + fs.rmSync(mkdocsYmlPath, {}); }); } } diff --git a/packages/techdocs-cli/src/commands/serve/serve.ts b/packages/techdocs-cli/src/commands/serve/serve.ts index bf67606481..9cfc24b629 100644 --- a/packages/techdocs-cli/src/commands/serve/serve.ts +++ b/packages/techdocs-cli/src/commands/serve/serve.ts @@ -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, ); @@ -150,7 +150,7 @@ export default async function serve(opts: OptionValues) { if (configIsTemporary) { process.on('exit', async () => { - fs.rmSync(mkDocsYmlPath, {}); + fs.rmSync(mkdocsYmlPath, {}); }); } } diff --git a/plugins/techdocs-node/api-report.md b/plugins/techdocs-node/api-report.md index 314a46a405..11ff53514b 100644 --- a/plugins/techdocs-node/api-report.md +++ b/plugins/techdocs-node/api-report.md @@ -88,6 +88,20 @@ export const getLocationForEntity: ( scmIntegration: ScmIntegrationRegistry, ) => ParsedLocationAnnotation; +// @public @deprecated (undocumented) +export const getMkDocsYml: ( + inputDir: string, + siteOptions?: + | { + name?: string | undefined; + } + | undefined, +) => Promise<{ + path: string; + content: string; + configIsTemporary: boolean; +}>; + // @public export const getMkdocsYml: ( inputDir: string, diff --git a/plugins/techdocs-node/src/stages/generate/helpers.test.ts b/plugins/techdocs-node/src/stages/generate/helpers.test.ts index aad7706ab1..b24d85430b 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.test.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.test.ts @@ -34,7 +34,7 @@ import { import { patchMkdocsYmlPreBuild, pathMkdocsYmlWithTechdocsPlugin, -} from './mkDocsPatchers'; +} from './mkdocsPatchers'; import yaml from 'js-yaml'; const mockEntity = { diff --git a/plugins/techdocs-node/src/stages/generate/index.ts b/plugins/techdocs-node/src/stages/generate/index.ts index 3bd42643c1..aaf27026c2 100644 --- a/plugins/techdocs-node/src/stages/generate/index.ts +++ b/plugins/techdocs-node/src/stages/generate/index.ts @@ -23,3 +23,10 @@ export type { GeneratorRunOptions, SupportedGeneratorKey, } from './types'; +import { getMkdocsYml } from './helpers'; +/** + * @public + * @deprecated + * Deprecated in favor of getMkdocsYml (lowercase 'd') + */ +export const getMkDocsYml = getMkdocsYml; diff --git a/plugins/techdocs-node/src/stages/generate/mkDocsPatchers.ts b/plugins/techdocs-node/src/stages/generate/mkdocsPatchers.ts similarity index 100% rename from plugins/techdocs-node/src/stages/generate/mkDocsPatchers.ts rename to plugins/techdocs-node/src/stages/generate/mkdocsPatchers.ts diff --git a/plugins/techdocs-node/src/stages/generate/techdocs.ts b/plugins/techdocs-node/src/stages/generate/techdocs.ts index b71148060e..2f88e1a8ad 100644 --- a/plugins/techdocs-node/src/stages/generate/techdocs.ts +++ b/plugins/techdocs-node/src/stages/generate/techdocs.ts @@ -34,7 +34,7 @@ import { import { patchMkdocsYmlPreBuild, pathMkdocsYmlWithTechdocsPlugin, -} from './mkDocsPatchers'; +} from './mkdocsPatchers'; import { GeneratorBase, GeneratorConfig,