Skip to content

Commit

Permalink
chore(docs): reduce console spam and trim examples from code
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Jan 29, 2022
1 parent a717637 commit ac92c42
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/apidoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,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 += `
Expand Down Expand Up @@ -222,10 +222,12 @@ async function build(): Promise<void> {

content += `faker.${lowerModuleName}.${methodName}()`;
content += (example ? ` // => ${example}` : '') + '\n';
} catch {
console.log(
`Failed to call: faker.${lowerModuleName}${methodName}()`
);
} catch (error) {
// If there is an error, we simply don't show the example call.
// console.debug(
// `Failed to call: faker.${lowerModuleName}${methodName}()`,
// error
// );
}
}
let examples =
Expand All @@ -234,8 +236,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';
Expand All @@ -251,10 +252,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.
Expand All @@ -268,7 +269,6 @@ async function build(): Promise<void> {
});

writeFileSync(pathDocsApiPages, apiPagesContent);
console.log('Updated api-pages.mjs');
}

build().catch(console.error);

0 comments on commit ac92c42

Please sign in to comment.