diff options
| author | Shinigami <[email protected]> | 2023-08-06 14:24:10 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-06 14:24:10 +0200 |
| commit | 6b0cecae887cb22729e005e4268401b7c625a42a (patch) | |
| tree | ef05b81a903b44059bd03a4b6f00b694ac99fcdc /scripts/apidoc/moduleMethods.ts | |
| parent | 8345e77b1a0633e55baaf7cf404819cd61629e63 (diff) | |
| download | faker-6b0cecae887cb22729e005e4268401b7c625a42a.tar.xz faker-6b0cecae887cb22729e005e4268401b7c625a42a.zip | |
chore(deps): update dependency prettier to v3 (#2260)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ST-DDT <[email protected]>
Diffstat (limited to 'scripts/apidoc/moduleMethods.ts')
| -rw-r--r-- | scripts/apidoc/moduleMethods.ts | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripts/apidoc/moduleMethods.ts b/scripts/apidoc/moduleMethods.ts index 65a62528..359282dc 100644 --- a/scripts/apidoc/moduleMethods.ts +++ b/scripts/apidoc/moduleMethods.ts @@ -23,8 +23,10 @@ import { adjustUrls } from './utils'; * @param project The project used to extract the modules. * @returns The generated pages. */ -export function processModules(project: ProjectReflection): ModuleSummary[] { - return selectApiModules(project).map(processModule); +export async function processModules( + project: ProjectReflection +): Promise<ModuleSummary[]> { + return Promise.all(selectApiModules(project).map(processModule)); } /** @@ -33,12 +35,17 @@ export function processModules(project: ProjectReflection): ModuleSummary[] { * @param module The module to process. * @returns The generated pages. */ -function processModule(module: DeclarationReflection): ModuleSummary { +async function processModule( + module: DeclarationReflection +): Promise<ModuleSummary> { const moduleName = extractModuleName(module); console.log(`Processing Module ${moduleName}`); const moduleFieldName = extractModuleFieldName(module); const { comment, deprecated } = analyzeModule(module); - const methods = processModuleMethods(module, `faker.${moduleFieldName}.`); + const methods = await processModuleMethods( + module, + `faker.${moduleFieldName}.` + ); return writeApiDocsModule( moduleName, @@ -72,10 +79,10 @@ export function analyzeModule(module: DeclarationReflection): { * @param accessor The code used to access the methods within the module. * @returns A list containing the documentation for the api methods in the given module. */ -export function processModuleMethods( +export async function processModuleMethods( module: DeclarationReflection, accessor: string -): Method[] { +): Promise<Method[]> { return processMethods(selectApiMethodSignatures(module), accessor); } @@ -86,15 +93,15 @@ export function processModuleMethods( * @param accessor The code used to access the methods. * @returns A list containing the documentation for the api methods. */ -export function processMethods( +export async function processMethods( signatures: Record<string, SignatureReflection>, accessor: string = '' -): Method[] { +): Promise<Method[]> { const methods: Method[] = []; for (const [methodName, signature] of Object.entries(signatures)) { console.debug(`- ${methodName}`); - methods.push(analyzeSignature(signature, accessor, methodName)); + methods.push(await analyzeSignature(signature, accessor, methodName)); } return methods; |
