Skip to content

Commit c3326ec

Browse files
committed
fix: docs not being generated
1 parent b505e23 commit c3326ec

File tree

5 files changed

+234
-50
lines changed

5 files changed

+234
-50
lines changed

build/jsDocGenerate.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/* eslint-env node */
2222
import * as documentation from 'documentation';
23-
import glob from "glob";
23+
import {glob} from "glob";
2424
import * as path from "path";
2525
import * as fs from "fs";
2626
import clc from 'cli-color';
@@ -45,26 +45,15 @@ function getIndexMarkdown(docRoot, filePaths) {
4545

4646
async function generateDocIndex(docRoot) {
4747
const indexFileName = `${docRoot}GitHub-API-Index.md`;
48-
let allDocFiles = await _getAllFiles(docRoot, '/**/*.md');
48+
let allDocFiles = await _getAllFiles(docRoot, '**/*.md');
4949
let indexMarkdown = getIndexMarkdown(docRoot, allDocFiles);
5050
console.log("creating index file: ", clc.green(indexFileName));
5151
fs.mkdirSync(path.dirname(indexFileName), { recursive: true })
5252
fs.writeFileSync(indexFileName, indexMarkdown);
5353
}
5454

5555
async function _getAllFiles(docRoot, globPattern) {
56-
return new Promise((resolve, reject)=>{
57-
let getDirectories = function (src, callback) {
58-
glob(src + globPattern, callback);
59-
};
60-
getDirectories(docRoot, function (err, res) {
61-
if (err) {
62-
reject(err);
63-
} else {
64-
resolve(res);
65-
}
66-
});
67-
});
56+
return await glob(docRoot + globPattern, { ignore: 'node_modules/**' });
6857
}
6958

7059
async function _processFile(filePath, srcRelativePath, generatedDocRoot) {
@@ -103,7 +92,7 @@ async function generateDocs() {
10392
generatedDocRoot = generatedDocRoot + "/";
10493
}
10594
console.log(`Generating docs for "${clc.green(srcRoot)}" to folder "${clc.green(generatedDocRoot)}"`);
106-
let allSrcFiles = await _getAllFiles(srcRoot, '/**/*.js')
95+
let allSrcFiles = await _getAllFiles(srcRoot, '**/*.js');
10796
console.log(`Found ${clc.blue(allSrcFiles.length)} js files. Scanning for files with comment // ${clc.blue(TAG_INCLUDE_IN_API_DOCS)} `);
10897
console.log(`Cleaning Generating docs folder "${clc.green(generatedDocRoot)}"`);
10998
fs.rmSync(generatedDocRoot, { recursive: true, force: true });

docs/generatedApiDocs/index-API.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ See [https://github.com/aicore/template-nodejs/wiki/How-To-Write-Docs][1] for mo
1010

1111
and markdown code!
1212

13-
// usage within core:
14-
const Metrics = require("utils/Metrics");
15-
16-
// usage within default extensions:
17-
const Metrics = brackets.getModule("utils/Metrics");
13+
```js
14+
console.log("write sample code examples with code blocks");
15+
```
1816

1917
[1]: https://github.com/aicore/template-nodejs/wiki/How-To-Write-Docs

0 commit comments

Comments
 (0)