mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3203] Fixed doc tools bugs from Linux run and added verbose option (#3496)
This commit is contained in:
committed by
Eugenio Romano
parent
257e422a1c
commit
5b3fb4856d
@@ -53,6 +53,10 @@ function updatePhase(filenames, aggData) {
|
||||
errorMessages = [];
|
||||
var pathname = filenames[i]; // path.resolve(srcFolder, filenames[i]);
|
||||
|
||||
if (program.verbose) {
|
||||
console.log(pathname);
|
||||
}
|
||||
|
||||
var src = fs.readFileSync(pathname);
|
||||
var tree = remark().use(frontMatter, ["yaml"]).parse(src)
|
||||
|
||||
@@ -132,6 +136,7 @@ program
|
||||
.usage("[options] <source>")
|
||||
.option("-p, --profile [profileName]", "Select named config profile", "default")
|
||||
.option("-j, --json", "Output JSON data for Markdown syntax tree")
|
||||
.option("-v, --verbose", "Log doc files as they are processed")
|
||||
.parse(process.argv);
|
||||
|
||||
var sourcePath;
|
||||
|
@@ -165,7 +165,7 @@ var MDNav = /** @class */ (function () {
|
||||
return this.item.value;
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
return "";
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
|
@@ -157,7 +157,7 @@ export class MDNav {
|
||||
if (this.item && this.item["value"]) {
|
||||
return this.item.value;
|
||||
} else {
|
||||
return undefined;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,6 +4,8 @@ var fs = require("fs");
|
||||
var path = require("path");
|
||||
var replaceSection = require("mdast-util-heading-range");
|
||||
var remark = require("remark");
|
||||
// import * as stringify from "remark-stringify";
|
||||
// import * as frontMatter from "remark-frontmatter";
|
||||
var ejs = require("ejs");
|
||||
var typedoc_1 = require("typedoc");
|
||||
var mdNav_1 = require("../mdNav");
|
||||
@@ -202,8 +204,9 @@ function updatePhase(tree, pathname, aggData, errorMessages) {
|
||||
return false;
|
||||
}
|
||||
var compData = new ComponentInfo(classRef);
|
||||
var classType = compName.match(/component|directive|service/i);
|
||||
if (classType) {
|
||||
var classTypeMatch = compName.match(/component|directive|service/i);
|
||||
if (classTypeMatch) {
|
||||
var classType = classTypeMatch[0].toLowerCase();
|
||||
// Copy docs back from the .md file when the JSDocs are empty.
|
||||
var inputMD = getPropDocsFromMD(tree, "Properties", 3);
|
||||
var outputMD = getPropDocsFromMD(tree, "Events", 2);
|
||||
@@ -305,7 +308,7 @@ function getMethodDocsFromMD(tree) {
|
||||
var methDoc = methItem.childNav
|
||||
.paragraph().childNav
|
||||
.html()
|
||||
.text().item.value;
|
||||
.text().value;
|
||||
var params = getMDMethodParams(methItem);
|
||||
result[methName] = {
|
||||
"docText": methDoc.replace(/^\n/, ""),
|
||||
@@ -368,12 +371,12 @@ function updateMethodDocsFromMD(comp, methodDocs, errorMessages) {
|
||||
comp.methods.forEach(function (meth) {
|
||||
var currMethMD = methodDocs[meth.name];
|
||||
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
|
||||
if (!meth.docText && currMethMD.docText) {
|
||||
if (!meth.docText && currMethMD && currMethMD.docText) {
|
||||
meth.docText = currMethMD.docText;
|
||||
errorMessages.push("Warning: empty JSDocs for method sig \"" + meth.name + "\" may need sync with the .md file.");
|
||||
}
|
||||
meth.params.forEach(function (param) {
|
||||
if (!param.docText && currMethMD.params[param.name]) {
|
||||
if (!param.docText && currMethMD && currMethMD.params[param.name]) {
|
||||
param.docText = currMethMD.params[param.name];
|
||||
errorMessages.push("Warning: empty JSDocs for parameter \"" + param.name + " (" + meth.name + ")\" may need sync with the .md file.");
|
||||
}
|
||||
|
@@ -3,10 +3,9 @@ import * as path from "path";
|
||||
|
||||
import * as replaceSection from "mdast-util-heading-range";
|
||||
import * as remark from "remark";
|
||||
import * as stringify from "remark-stringify";
|
||||
import * as frontMatter from "remark-frontmatter";
|
||||
// import * as stringify from "remark-stringify";
|
||||
// import * as frontMatter from "remark-frontmatter";
|
||||
|
||||
import * as combyne from "combyne";
|
||||
import * as ejs from "ejs";
|
||||
|
||||
import {
|
||||
@@ -295,9 +294,11 @@ export function updatePhase(tree, pathname, aggData, errorMessages) {
|
||||
}
|
||||
|
||||
let compData = new ComponentInfo(classRef);
|
||||
let classType = compName.match(/component|directive|service/i);
|
||||
let classTypeMatch = compName.match(/component|directive|service/i);
|
||||
|
||||
if (classTypeMatch) {
|
||||
let classType = classTypeMatch[0].toLowerCase();
|
||||
|
||||
if (classType) {
|
||||
// Copy docs back from the .md file when the JSDocs are empty.
|
||||
let inputMD = getPropDocsFromMD(tree, "Properties", 3);
|
||||
let outputMD = getPropDocsFromMD(tree, "Events", 2);
|
||||
@@ -440,7 +441,7 @@ function getMethodDocsFromMD(tree) {
|
||||
let methDoc = methItem.childNav
|
||||
.paragraph().childNav
|
||||
.html()
|
||||
.text().item.value;
|
||||
.text().value;
|
||||
|
||||
let params = getMDMethodParams(methItem);
|
||||
|
||||
@@ -523,13 +524,13 @@ function updateMethodDocsFromMD(comp: ComponentInfo, methodDocs, errorMessages)
|
||||
let currMethMD = methodDocs[meth.name]
|
||||
|
||||
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
|
||||
if (!meth.docText && currMethMD.docText) {
|
||||
if (!meth.docText && currMethMD && currMethMD.docText) {
|
||||
meth.docText = currMethMD.docText;
|
||||
errorMessages.push(`Warning: empty JSDocs for method sig "${meth.name}" may need sync with the .md file.`);
|
||||
}
|
||||
|
||||
meth.params.forEach(param => {
|
||||
if (!param.docText && currMethMD.params[param.name])
|
||||
if (!param.docText && currMethMD && currMethMD.params[param.name])
|
||||
{
|
||||
param.docText = currMethMD.params[param.name];
|
||||
errorMessages.push(`Warning: empty JSDocs for parameter "${param.name} (${meth.name})" may need sync with the .md file.`);
|
||||
|
Reference in New Issue
Block a user