diff options
| author | ST-DDT <[email protected]> | 2022-01-30 22:32:32 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-30 22:32:32 +0100 |
| commit | ce1b39f7677a6b5c75b848182399078b9901eb24 (patch) | |
| tree | 3088df56fc9c5962d9362f8f9d20478ed00163d5 /scripts | |
| parent | a028bfb9128bb950e9f4a3aaa04054c5d6bec5a0 (diff) | |
| download | faker-ce1b39f7677a6b5c75b848182399078b9901eb24.tar.xz faker-ce1b39f7677a6b5c75b848182399078b9901eb24.zip | |
chore(docs): reduce console spam and trim examples from code (#346)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/apidoc.ts | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/scripts/apidoc.ts b/scripts/apidoc.ts index f07e5e06..c93020c8 100644 --- a/scripts/apidoc.ts +++ b/scripts/apidoc.ts @@ -118,7 +118,7 @@ async function build(): Promise<void> { const prettyMethodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1).replace(/([A-Z]+)/g, ' $1'); - console.log(`- method ${prettyMethodName}`); + console.debug(`- method ${prettyMethodName}`); const signature = method.signatures[0]; content += ` @@ -154,7 +154,7 @@ async function build(): Promise<void> { `; // typeParameters - typeParameters.forEach((parameter, index) => { + typeParameters.forEach((parameter) => { const parameterName = parameter.name; signatureTypeParameters.push(parameterName); @@ -220,10 +220,8 @@ async function build(): Promise<void> { content += `faker.${lowerModuleName}.${methodName}()`; content += (example ? ` // => ${example}` : '') + '\n'; - } catch { - console.log( - `Failed to call: faker.${lowerModuleName}${methodName}()` - ); + } catch (error) { + // Ignore the error => hide the example call + result. } } const examples = @@ -232,8 +230,7 @@ async function build(): Promise<void> { .map((tag) => tag.text.trimEnd()) || []; if (examples.length !== 0) { - console.log('Example-Length:', examples); - content += examples.join('\n') + '\n'; + content += examples.join('\n').trim() + '\n'; } content += '````\n\n'; @@ -249,10 +246,10 @@ async function build(): Promise<void> { // Write to disk writeFileSync(resolve(pathOutputDir, lowerModuleName + '.md'), content); - console.log(`Done Module ${moduleName}`); } // Write api-pages.mjs + console.log('Updating api-pages.mjs'); modulesPages.sort((a, b) => a.text.localeCompare(b.text)); let apiPagesContent = ` // This file is automatically generated. @@ -266,7 +263,6 @@ async function build(): Promise<void> { }); writeFileSync(pathDocsApiPages, apiPagesContent); - console.log('Updated api-pages.mjs'); } build().catch(console.error); |
