Skip to content

Commit d9aa1e8

Browse files
Merge branch 'main' of https://github.com/codeboltai/codeboltjs into main
2 parents 9265081 + 0dfec4e commit d9aa1e8

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"jest-serial-runner": "^1.2.1",
3030
"ts-loader": "^9.5.1",
3131
"typedoc": "^0.25.13",
32+
"typedoc-plugin-markdown": "^4.0.1",
3233
"typescript": "^5.4.5",
3334
"webpack": "^5.91.0",
3435
"webpack-cli": "^5.1.4"

script/gen.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const { execSync } = require('child_process');
4+
5+
// Define the directory containing your TypeScript files
6+
const dir = './src';
7+
8+
// Define the output directory for the documentation
9+
const outDir = './document';
10+
11+
// Use a recursive function to find all TypeScript files in the directory and its subdirectories
12+
function getFiles(dir) {
13+
return fs.readdirSync(dir).reduce((files, file) => {
14+
const filePath = path.join(dir, file);
15+
const isDirectory = fs.statSync(filePath).isDirectory();
16+
return isDirectory ? [...files, ...getFiles(filePath)] : [...files, filePath];
17+
}, []);
18+
}
19+
20+
// Get all TypeScript files
21+
const tsFiles = getFiles(dir).filter(file => file.endsWith('.ts'));
22+
23+
// Generate documentation for each TypeScript file
24+
tsFiles.forEach(file => {
25+
const outPath = path.join(outDir, path.basename(file, '.ts'));
26+
execSync(`npx typedoc --plugin typedoc-plugin-markdown --out ${outPath} ${file}`);
27+
});

0 commit comments

Comments
 (0)