Documentation build (#6762)

* move doc dependency in doctools

* add ignore link

* rebuild doc

* version index

* put it back some deps
This commit is contained in:
Eugenio Romano
2021-03-03 14:08:15 +00:00
committed by GitHub
parent e05c80f04f
commit c3452a4f62
227 changed files with 6994 additions and 4146 deletions

View File

@@ -227,5 +227,11 @@
"tutorials",
"user-guide",
"versionIndex"
],
"ignoreLinkWords" : [
"Type",
"model",
"Node",
"User"
]
}

View File

@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MDNav = void 0;
var MDNav = /** @class */ (function () {
function MDNav(root, pos) {
if (pos === void 0) { pos = 0; }
@@ -161,7 +162,7 @@ var MDNav = /** @class */ (function () {
return this.root.children[this.pos];
}
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, "empty", {
@@ -170,14 +171,14 @@ var MDNav = /** @class */ (function () {
!this.root.children ||
(this.pos >= this.root.children.length);
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, "childNav", {
get: function () {
return new MDNav(this.item);
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, "value", {
@@ -189,7 +190,7 @@ var MDNav = /** @class */ (function () {
return '';
}
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(MDNav.prototype, "textValue", {
@@ -211,7 +212,7 @@ var MDNav = /** @class */ (function () {
return '';
}
},
enumerable: true,
enumerable: false,
configurable: true
});
return MDNav;

View File

@@ -5,7 +5,7 @@ var __extends = (this && this.__extends) || (function () {
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@@ -13,6 +13,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Docset = exports.Text = exports.Link = exports.Paragraph = exports.Heading = exports.Root = exports.Parent = exports.Node = exports.schema = void 0;
var mdToString = require("mdast-util-to-string");
var jsyaml = require("js-yaml");
exports.schema = "\n type Query {\n documents(idFilter: String = \"\"): [Root]\n }\n\n type Root {\n id: ID\n type: String\n folder(depth: Int = 1): String\n metadata(key: String): String\n heading(depth: Int = 0): Heading\n headings(depth: Int = 0): [Heading]\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n text: Text\n texts: [Text]\n children: [Node]\n }\n\n type Heading {\n depth: Int\n plaintext: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n children: [Node]\n }\n\n type Paragraph {\n plaintext: String\n }\n\n type Link {\n plaintext: String\n title: String\n url: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n text: Text\n texts: [Text]\n }\n\n type Text {\n value: String\n }\n\n type Node {\n type: String\n children: [Node]\n }\n";

3105
tools/doc/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

36
tools/doc/package.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "adf-doc-tools",
"description": "ADF doc tools",
"version": "4.2.0",
"author": "Alfresco Software, Ltd.",
"scripts": {},
"dependencies": {
"@alfresco/js-api": "^4.3.0-3244",
"ejs": "^3.1.6",
"fast-levenshtein": "^3.0.0",
"graphql": "^15.4.0",
"graphql-request": "^3.1.0",
"js-yaml": "3.14.1",
"markdownlint-cli": "^0.16.0",
"mdast": "2.1.0",
"mdast-util-compact": "1.0.3",
"mdast-util-heading-range": "2.1.3",
"mdast-util-toc": "2.1.0",
"mdast-zone": "3.0.4",
"moment": "2.29.1",
"remark": "^9.0.0",
"remark-frontmatter": "^1.2.0",
"rxjs": "^6.6.3",
"typedoc": "^0.15.0",
"typescript": "3.9.8",
"unist-util-select": "2.0.0"
},
"devDependencies": {
"@paperist/types-remark": "0.1.3",
"@types/node": "^14.14.26"
},
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
}
}

View File

@@ -24,7 +24,6 @@ var docsFolderPath = path.resolve('docs');
var libFolders = ['core', 'content-services', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
libsearch(srcData, path.resolve(libFolder));
var authToken = process.env.graphAuthToken;
var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql', {
headers: {
Authorization: 'Bearer ' + authToken

View File

@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComponentInfo = exports.MethodSigInfo = exports.ParamInfo = exports.PropInfo = void 0;
var skipMethodNames = [
'ngOnChanges',
'ngOnDestroy',
@@ -53,7 +54,7 @@ var PropInfo = /** @class */ (function () {
get: function () {
return this.errorMessages;
},
enumerable: true,
enumerable: false,
configurable: true
});
return PropInfo;
@@ -130,7 +131,7 @@ var MethodSigInfo = /** @class */ (function () {
get: function () {
return this.errorMessages;
},
enumerable: true,
enumerable: false,
configurable: true
});
return MethodSigInfo;
@@ -193,7 +194,7 @@ var ComponentInfo = /** @class */ (function () {
});
return combinedErrors;
},
enumerable: true,
enumerable: false,
configurable: true
});
return ComponentInfo;

View File

@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stoplist = void 0;
var fs = require("fs");
/* "Stoplist" of regular expressions to match against strings. */
var Stoplist = /** @class */ (function () {

View File

@@ -1,6 +1,7 @@
"use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var path = require("path");
var fs = require("fs");
var unist_util_select_1 = require("unist-util-select");

View File

@@ -1,6 +1,7 @@
"use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var fs = require("fs");
var path = require("path");
var ejs = require("ejs");

View File

@@ -1,6 +1,7 @@
"use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var path = require("path");
var fs = require("fs");
var unist_util_select_1 = require("unist-util-select");

View File

@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var path = require("path");
var unist_util_select_1 = require("unist-util-select");
var ngHelpers = require("../ngHelpers");

View File

@@ -1,6 +1,7 @@
"use strict";
// tslint:disable: no-console
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var fs = require("fs");
var path = require("path");
var replaceSection = require("mdast-util-heading-range");

View File

@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var fs = require("fs");
var path = require("path");
var replaceSection = require("mdast-util-heading-range");

View File

@@ -1,5 +1,13 @@
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.processDocs = void 0;
var path = require("path");
var unist = require("../unistHelpers");
var ngHelpers = require("../ngHelpers");
@@ -10,6 +18,7 @@ var includedNodeTypes = [
];
var externalNameLinks;
var linkOverrides;
var ignoreLinkWords;
function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache);
var pathnames = Object.keys(mdCache);
@@ -20,6 +29,7 @@ function processDocs(mdCache, aggData) {
exports.processDocs = processDocs;
function initPhase(aggData, mdCache) {
externalNameLinks = aggData.config.externalNameLinks;
ignoreLinkWords = aggData.config.ignoreLinkWords;
linkOverrides = {};
aggData.config.linkOverrides.forEach(function (override) {
linkOverrides[override.toLowerCase()] = 1;
@@ -49,9 +59,11 @@ function updateFile(tree, pathname, aggData) {
if (node.type === 'link') {
if (node.children[0] && ((node.children[0].type === 'inlineCode') ||
(node.children[0].type === 'text'))) {
var link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) {
convertNodeToTypeLink(node, node.children[0].value, link);
if (!ignoreLinkWords.includes(node.children[0].value)) {
var link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) {
convertNodeToTypeLink(node, node.children[0].value, link);
}
}
}
}
@@ -60,7 +72,7 @@ function updateFile(tree, pathname, aggData) {
var _a;
if ((child.type === 'text') || (child.type === 'inlineCode')) {
var newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
(_a = node.children).splice.apply(_a, [index, 1].concat(newNodes));
(_a = node.children).splice.apply(_a, __spreadArrays([index, 1], newNodes));
}
else {
traverseMDTree(child);
@@ -211,40 +223,42 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
.replace(/'s$/, '')
.replace(/^[;:,\."']+/g, '')
.replace(/[;:,\."']+$/g, '');
var link = resolveTypeLink(aggData, docFilePath, word);
var matchStart = void 0;
if (!link) {
var match = matcher.nextWord(word.toLowerCase(), scanner.index);
if (match && match[0]) {
link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos;
}
}
else {
matchStart = scanner.index;
}
if (link) {
var linkText = text.substring(matchStart, scanner.nextSeparator);
var linkTitle = void 0;
if (wrapInlineCode) {
linkTitle = unist.makeInlineCode(linkText);
if (!ignoreLinkWords.includes(word)) {
var link = resolveTypeLink(aggData, docFilePath, word);
var matchStart = void 0;
if (!link) {
var match = matcher.nextWord(word.toLowerCase(), scanner.index);
if (match && match[0]) {
link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos;
}
}
else {
linkTitle = unist.makeText(linkText);
matchStart = scanner.index;
}
var linkNode = unist.makeLink(linkTitle, link);
var prevText = text.substring(currTextStart, matchStart);
if (prevText) {
if (link) {
var linkText = text.substring(matchStart, scanner.nextSeparator);
var linkTitle = void 0;
if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText));
linkTitle = unist.makeInlineCode(linkText);
}
else {
result.push(unist.makeText(prevText));
linkTitle = unist.makeText(linkText);
}
var linkNode = unist.makeLink(linkTitle, link);
var prevText = text.substring(currTextStart, matchStart);
if (prevText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText));
}
else {
result.push(unist.makeText(prevText));
}
}
result.push(linkNode);
currTextStart = scanner.nextSeparator;
matcher.reset();
}
result.push(linkNode);
currTextStart = scanner.nextSeparator;
matcher.reset();
}
}
var remainingText = text.substring(currTextStart, text.length);

View File

@@ -10,6 +10,7 @@ const includedNodeTypes = [
let externalNameLinks;
let linkOverrides;
let ignoreLinkWords: any[];
export function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache);
@@ -23,6 +24,7 @@ export function processDocs(mdCache, aggData) {
function initPhase(aggData, mdCache) {
externalNameLinks = aggData.config.externalNameLinks;
ignoreLinkWords = aggData.config.ignoreLinkWords;
linkOverrides = {};
aggData.config.linkOverrides.forEach(override => {
@@ -63,17 +65,22 @@ function updateFile(tree, pathname, aggData) {
(node.children[0].type === 'inlineCode') ||
(node.children[0].type === 'text')
)) {
const link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) {
convertNodeToTypeLink(node, node.children[0].value, link);
if (!ignoreLinkWords.includes(node.children[0].value)) {
const link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) {
convertNodeToTypeLink(node, node.children[0].value, link);
}
}
}
} else if ((node.children) && (node.type !== 'heading')) {
node.children.forEach((child, index) => {
if ((child.type === 'text') || (child.type === 'inlineCode')) {
const newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
node.children.splice(index, 1, ...newNodes);
} else {
traverseMDTree(child);
}
@@ -95,11 +102,13 @@ class SplitNameNode {
}
class SplitNameMatchElement {
constructor(public node: SplitNameNode, public textPos: number) {}
constructor(public node: SplitNameNode, public textPos: number) {
}
}
class SplitNameMatchResult {
constructor(public value: string, public startPos: number) {}
constructor(public value: string, public startPos: number) {
}
}
class SplitNameMatcher {
@@ -235,49 +244,54 @@ function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapI
const matcher = new SplitNameMatcher(aggData.nameLookup.root);
for (const scanner = new WordScanner(text); !scanner.finished(); scanner.next()) {
const word = scanner.current
.replace(/'s$/, '')
.replace(/^[;:,\."']+/g, '')
.replace(/[;:,\."']+$/g, '');
.replace(/'s$/, '')
.replace(/^[;:,\."']+/g, '')
.replace(/[;:,\."']+$/g, '');
let link = resolveTypeLink(aggData, docFilePath, word);
let matchStart;
if (!ignoreLinkWords.includes(word)) {
if (!link) {
const match = matcher.nextWord(word.toLowerCase(), scanner.index);
let link = resolveTypeLink(aggData, docFilePath, word);
let matchStart;
if (match && match[0]) {
link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos;
}
} else {
matchStart = scanner.index;
}
if (!link) {
const match = matcher.nextWord(word.toLowerCase(), scanner.index);
if (link) {
const linkText = text.substring(matchStart, scanner.nextSeparator);
let linkTitle;
if (wrapInlineCode) {
linkTitle = unist.makeInlineCode(linkText);
} else {
linkTitle = unist.makeText(linkText);
}
const linkNode = unist.makeLink(linkTitle, link);
const prevText = text.substring(currTextStart, matchStart);
if (prevText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText));
} else {
result.push(unist.makeText(prevText));
if (match && match[0]) {
link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos;
}
} else {
matchStart = scanner.index;
}
result.push(linkNode);
currTextStart = scanner.nextSeparator;
matcher.reset();
if (link) {
const linkText = text.substring(matchStart, scanner.nextSeparator);
let linkTitle;
if (wrapInlineCode) {
linkTitle = unist.makeInlineCode(linkText);
} else {
linkTitle = unist.makeText(linkText);
}
const linkNode = unist.makeLink(linkTitle, link);
const prevText = text.substring(currTextStart, matchStart);
if (prevText) {
if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText));
} else {
result.push(unist.makeText(prevText));
}
}
result.push(linkNode);
currTextStart = scanner.nextSeparator;
matcher.reset();
}
}
}

View File

@@ -2,11 +2,12 @@
"compilerOptions": {
"outDir": ".",
"baseUrl": ".",
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"target": "es5",
"types": ["node", "@paperist/types-remark"],
"typeRoots": ["node_modules/@types"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2018", "dom"]
},
"files": [