Skip to content

docs: mark deprecated modules #2000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/apidoc/apiDocsWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function writeApiDocsModulePage(
moduleName: string,
lowerModuleName: string,
comment: string,
deprecated: string | undefined,
methods: Method[]
): void {
// Write api docs page
Expand All @@ -57,6 +58,16 @@ export function writeApiDocsModulePage(

::: v-pre

${
deprecated == null
? ''
: `<div class="warning custom-block">
<p class="custom-block-title">Deprecated</p>
<p>This module is deprecated and will be removed in a future version.</p>
<span>${deprecated}</span>
</div>`
}

${comment}

:::
Expand Down
11 changes: 9 additions & 2 deletions scripts/apidoc/moduleMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Method } from '../../docs/.vitepress/components/api-docs/method';
import { writeApiDocsData, writeApiDocsModulePage } from './apiDocsWriter';
import { analyzeSignature, stripAbsoluteFakerUrls, toBlock } from './signature';
import {
extractDeprecated,
extractModuleFieldName,
extractModuleName,
selectApiMethodSignatures,
Expand Down Expand Up @@ -41,7 +42,7 @@ function processModuleMethod(module: DeclarationReflection): PageAndDiffIndex {
const moduleFieldName = extractModuleFieldName(module);
console.log(`Processing Module ${moduleName}`);
const comment = stripAbsoluteFakerUrls(toBlock(module.comment));

const deprecated = extractDeprecated(module);
const methods: Method[] = [];

// Generate method section
Expand All @@ -52,7 +53,13 @@ function processModuleMethod(module: DeclarationReflection): PageAndDiffIndex {
methods.push(analyzeSignature(signature, moduleFieldName, methodName));
}

writeApiDocsModulePage(moduleName, moduleFieldName, comment, methods);
writeApiDocsModulePage(
moduleName,
moduleFieldName,
comment,
deprecated,
methods
);
writeApiDocsData(moduleFieldName, methods);

return [
Expand Down
4 changes: 0 additions & 4 deletions src/modules/random/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import type {
/**
* Generates random values of different kinds.
*
* ### Overview
*
* All the methods in this module are deprecated.
*
* @deprecated Use the modules specific to the type of data you want to generate instead.
*/
export class RandomModule {
Expand Down