mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3323] Updated doc tools to use DocFX intermediate files (#3601)
* [ADF-3323] Moved source file parsing to main doc tool * [ADF-3323] Moved source info classes * [ADF-3323] Added doc YAML generator tool * [ADF-3323] Added doc YAML/JSON source paths to gitignore * [ADF-3323] Completed templates and template context code * [ADF-3323] Added source paths and updated type linker * [ADF-3323] Final fixes to templates and type linking * [ADF-3323] Fixed filter for private and protected methods * [ADF-3323] Content services docs after check and rebuild * [ADF-3323] Updated docbuild script in package.json
This commit is contained in:
committed by
Eugenio Romano
parent
54380fd693
commit
69d8ff147e
54
tools/doc/buildYamlSourceInfo.js
Normal file
54
tools/doc/buildYamlSourceInfo.js
Normal file
@@ -0,0 +1,54 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var ejs = require("ejs");
|
||||
|
||||
|
||||
var templateFolder = path.resolve("tools", "doc", "yamlTemplates");
|
||||
var outputFolder = path.resolve("docs", "sourceinfo");
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
console.log("Error: Source filename required");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
console.log(`Processing ${process.argv[2]}`);
|
||||
|
||||
if (!fs.existsSync(outputFolder)) {
|
||||
fs.mkdirSync(outputFolder);
|
||||
}
|
||||
|
||||
var docData = JSON.parse(fs.readFileSync(path.resolve(process.argv[2]), "utf8"));
|
||||
var tempFilename = path.resolve(templateFolder, "template.ejs");
|
||||
var tempSource = fs.readFileSync(tempFilename, "utf8");
|
||||
var template = ejs.compile(
|
||||
tempSource,
|
||||
{
|
||||
filename: tempFilename,
|
||||
cache: true
|
||||
}
|
||||
);
|
||||
|
||||
searchItemsRecursively(docData);
|
||||
|
||||
|
||||
function searchItemsRecursively(item) {
|
||||
if (interestedIn(item.kind)) {
|
||||
processItem(item);
|
||||
} else if (item.children) {
|
||||
item.children.forEach(child => {
|
||||
searchItemsRecursively(child);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function interestedIn(itemKind) {
|
||||
return itemKind === 128;
|
||||
}
|
||||
|
||||
|
||||
function processItem(item) {
|
||||
//console.log(`Generating ${item.name}`);
|
||||
var docText = template(item);
|
||||
fs.writeFileSync(path.resolve(outputFolder, item.name + ".yml"), docText);
|
||||
}
|
Reference in New Issue
Block a user