Skip to content

Commit 173c6cf

Browse files
committed
POC setup for automatic doc generation
1 parent 4aca6bd commit 173c6cf

File tree

6 files changed

+594
-6
lines changed

6 files changed

+594
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ __coverage__
22
.build-info
33
.sass-cache
44
dist
5-
node_modules
5+
node_modules
6+
_auto_doc_

bin/docgen

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* POC doc generation script.
5+
*/
6+
7+
/* eslint-disable import/no-extraneous-dependencies, no-console */
8+
9+
const fs = require('fs');
10+
const jsdoc2md = require('jsdoc-to-markdown');
11+
const mkpath = require('mkpath');
12+
const path = require('path');
13+
14+
const outputDir = path.resolve(__dirname, '../_auto_doc_');
15+
16+
const data = jsdoc2md.getTemplateDataSync({ files: 'src/**/*.js' });
17+
18+
const moduleNames = data.reduce((res, obj) => {
19+
if (obj.kind === 'module') res.push(obj.name);
20+
return res;
21+
}, []);
22+
23+
moduleNames.forEach((name) => {
24+
const template = `{{#module name="${name}"}}{{>docs}}{{/module}}`;
25+
console.log(`rendering ${name}, template: ${template}`);
26+
const output = jsdoc2md.renderSync({ data, template });
27+
const destFile = `${outputDir}/${name}.md`;
28+
mkpath.sync(path.dirname(destFile));
29+
fs.writeFileSync(destFile, output);
30+
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy