Increase timeout and modify login async (#4795)

* increase timeout and modify login async

* run e2e if testing is changed

* improve cdk fix

* fix travis update projects

* disable ghostMode lite server

* lint fix

* fix timeout

* multiple try

* Update content-services-e2e.sh

* Update search-e2e.sh

* Update process-services-e2e.sh

* Update core-e2e.sh

* Update protractor.conf.ts

* fix unit

* remove async

* increqase notification time

* 3 parallel

* dix path issue in save

* small refactor protractor ts

* fix save

* create license check first script adf cli

* modify regex check

* refactor notification history component

* decrease notification

* fix notification message problem

* fix test

* update packages wit high risk

* revert cahnge login sso e2e

* fix dep

* fix documentation duplication and issue

* fix after review

* fix after review

* try 6 parallel test

* back to 3 parallel test no real time improve with 6
This commit is contained in:
Eugenio Romano
2019-06-06 16:47:50 +01:00
committed by GitHub
parent 99f4b07878
commit 5e54cd4d43
118 changed files with 2335 additions and 2768 deletions

View File

@@ -2,7 +2,6 @@ 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");
@@ -30,9 +29,9 @@ var template = ejs.compile(
searchItemsRecursively(docData);
function searchItemsRecursively(item) {
if (interestedIn(item.kind)) {
processItem(item);
} else if (item.children) {
item.children.forEach(child => {
@@ -41,14 +40,17 @@ function searchItemsRecursively(item) {
}
}
function interestedIn(itemKind) {
return (itemKind === 128) || (itemKind === 256) || (itemKind === 4194304);
}
function processItem(item) {
//console.log(`Generating ${item.name}`);
var docText = template(item);
fs.writeFileSync(path.resolve(outputFolder, item.name + ".yml"), docText);
}
if( item.name === 'Widget'){
console.log('item ' + JSON.stringify(item.name ));
}
fs.writeFileSync(path.resolve(outputFolder, item.name + ".yml"), docText);
}

View File

@@ -6,14 +6,9 @@ var lodash = require("lodash");
var jsyaml = require("js-yaml");
var remark = require("remark");
var parse = require("remark-parse");
var stringify = require("remark-stringify");
var frontMatter = require("remark-frontmatter");
var mdCompact = require("mdast-util-compact");
//var tdoc = require("typedoc");
var ngHelpers = require("./ngHelpers");
var si = require("./SourceInfoClasses");
// "Aggregate" data collected over the whole file set.
@@ -24,15 +19,6 @@ var configFileName = "doctool.config.json";
var defaultFolder = path.resolve("docs");
var sourceInfoFolder = path.resolve("docs", "sourceinfo");
var libFolders = [
"core", "content-services", "process-services",
"insights", "process-services-cloud", "extensions"
];
var excludePatterns = [
"**/*.spec.ts"
];
function updatePhase(mdCache, aggData) {
var errorMessages;
@@ -142,63 +128,6 @@ function initMdCache(filenames) {
return mdCache;
}
/*
function getSourceInfo(infoFolder) {
var sourceInfo = {};
var yamlFiles = fs.readdirSync(infoFolder);
yamlFiles.forEach(file => {
var yamlText = fs.readFileSync(path.resolve(infoFolder, file), "utf8");
var yaml = jsyaml.safeLoad(yamlText);
sou
});
}
/*
function initSourceInfo(aggData, mdCache) {
var app = new tdoc.Application({
exclude: excludePatterns,
ignoreCompilerErrors: true,
experimentalDecorators: true,
tsconfig: "tsconfig.json"
});
let sources = app.expandInputFiles(libFolders.map(folder => {
return path.resolve("lib", folder);
}));
aggData.projData = app.convert(sources);
aggData.classInfo = {};
var mdFiles = Object.keys(mdCache);
mdFiles.forEach(mdFile => {
var className = ngHelpers.ngNameToClassName(path.basename(mdFile, ".md"), aggData.config.typeNameExceptions);
var classRef = aggData.projData.findReflectionByName(className);
var className = ngHelpers.ngNameToClassName(path.basename(mdFile, ".md"), aggData.config.typeNameExceptions);
var yamlText = fs.readFileSync(path.resolve(sourceInfoFolder, className + ".yml"), "utf8");
var yaml = jsyaml.safeLoad(yamlText);
if (yaml) {
aggData.classInfo[className] = new si.ComponentInfo(yaml);
}
if (classRef) {
aggData.classInfo[className] = new si.ComponentInfo(classRef);
}
});
}
*/
function initClassInfo(aggData) {
var yamlFilenames = fs.readdirSync(path.resolve(sourceInfoFolder));
@@ -278,21 +207,9 @@ files = files.filter(filename =>
var mdCache = initMdCache(files);
console.log("Loading source data...");
//initSourceInfo(aggData, mdCache);
initClassInfo(aggData);
/*
console.log("Initialising...");
initPhase(aggData);
console.log("Analysing Markdown files...");
readPhase(mdCache, aggData);
console.log("Computing aggregate data...");
aggPhase(aggData);
*/
console.log("Updating Markdown files...");
updatePhase(mdCache, aggData);

View File

@@ -1,103 +0,0 @@
var path = require('path');
var fs = require('fs');
var checker = require('license-checker');
var ejs = require('ejs');
var program = require('commander');
var spdxCodes = require('spdx-license-list');
var startPath = path.resolve('.');
var templatePath = path.resolve(__dirname, 'templates', 'licensePage.ejs');
const nonStandardLicenses = {
"public domain": "PDDL-1.0",
"apache": "Apache-2.0",
"bsd": "BSD-2-Clause"
}
const missingRepos = {
"@alfresco/adf-testing": "https://github.com/Alfresco/alfresco-ng2-components",
"@webassemblyjs/helper-api-error": "https://github.com/xtuc/webassemblyjs",
"@webassemblyjs/helper-fsm": "https://github.com/xtuc/webassemblyjs",
"@webassemblyjs/ieee754": "https://github.com/xtuc/webassemblyjs",
"@webassemblyjs/leb128": "https://github.com/xtuc/webassemblyjs",
"adf-tslint-rules": "https://github.com/Alfresco/alfresco-ng2-components",
"adf-monaco-extension": "https://github.com/eromano/aca-monaco-extension",
"indexof": "https://github.com/component/indexof",
"rxjs-compat": "https://github.com/ReactiveX/rxjs/tree/master/compat",
}
program
.usage('<versionNumber>')
.parse(process.argv);
console.log(`Checking ${startPath}`);
checker.init({
start: startPath,
production: true,
failOn: "GPL"
}, function(err, packages) {
if (err) {
console.log(err);
} else {
//console.log(JSON.stringify(packages));
for (var packageName in packages) {
var pack = packages[packageName];
pack['licenseExp'] = pack['licenses']
.replace(/\*/, '')
.replace(/[a-zA-Z0-9\-\.]+/g, match => {
var lowerMatch = match.toLowerCase();
if ((lowerMatch !== 'and') && (lowerMatch !== 'or') && (lowerMatch !== 'with')) {
return licenseWithMDLinks(match);
} else {
return match;
}
});
if (!pack['repository']) {
var lastAtSignPos = packageName.lastIndexOf('@');
var mainName = packageName.substring(0, lastAtSignPos);
if (missingRepos[mainName]) {
pack['repository'] = missingRepos[mainName];
}
}
}
ejs.renderFile(templatePath, {packages: packages, projVersion: program.args[0]}, {}, (err, mdText) => {
if (err) {
console.log(err);
} else {
//console.log(mdText);
var licenseFilePath = path.resolve('.', 'docs', 'license-info', `license-info-${program.args[0]}.md`)
fs.writeFileSync(licenseFilePath, mdText);
console.log(`Wrote license list at ${licenseFilePath}`);
}
});
}
});
function licenseWithMDLinks(licenseExp) {
var licenseUrl = '';
if (spdxCodes[licenseExp] && spdxCodes[licenseExp]['url']) {
licenseUrl = spdxCodes[licenseExp]['url'];
} else {
var substituteLicString = nonStandardLicenses[licenseExp.toLowerCase()];
if (spdxCodes[substituteLicString] && spdxCodes[substituteLicString]['url']) {
licenseUrl = spdxCodes[substituteLicString]['url'];
}
}
if (licenseUrl) {
return `[${licenseExp}](${licenseUrl})`;
} else {
return licenseExp;
}
}

View File

@@ -1,6 +1,6 @@
export class MDNav {
constructor(public root: any, public pos: number = 0) {}
find(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
@@ -25,7 +25,6 @@ export class MDNav {
return new MDNav(this.root, this.root.children.length);
}
findAll(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
if (!this.root || !this.root.children) {
return [];
@@ -89,7 +88,7 @@ export class MDNav {
return h.type === "link" && test(h);
}, index);
}
list(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "list" && test(h);
@@ -165,7 +164,7 @@ export class MDNav {
(this.pos >= this.root.children.length);
}
get childNav(): MDNav {
return new MDNav(this.item);
}
@@ -181,7 +180,7 @@ export class MDNav {
get textValue() : string {
if (this.item) {
if (this.item) {
if (this.item["value"]) {
return this.item.value;
} else if (
@@ -197,4 +196,4 @@ export class MDNav {
return "";
}
}
}
}

View File

@@ -1,8 +1,11 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __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]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __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; }

View File

@@ -33,14 +33,6 @@ let libFolders = ["core", "content-services", "extensions", "insights", "process
libsearch(srcData, path.resolve(libFolder));
/*
let keys = Object.keys(srcData);
for (let i = 0; i < keys.length; i++) {
console.log(keys[i]);
}
*/
const authToken = process.env.graphAuthToken;
const client = new GraphQLClient('https://api.github.com/graphql', {
@@ -147,20 +139,6 @@ function getDocFilePaths(folderPath) {
libFolders.forEach(element => {
let libPath = path.resolve(folderPath, element);
addItemsRecursively(libPath, result);
let items = fs.readdirSync(libPath);
/*
files = files.filter(filename =>
(path.extname(filename) === ".md") &&
(filename !== "README.md") &&
(filename.match(angFilePattern))
);
files.forEach(element => {
result.push(path.join(libPath, element));
});
*/
});

View File

@@ -2,7 +2,7 @@
### Properties
| Name | Type | Default value | Description |
| -- | -- | -- | -- |
| --- | --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isInput) { -%>
| <%= prop.name %> | <% if (prop.type) { %>`<%- prop.type %>`<% } %> | <%- prop.defaultValue %> | <%- prop.docText %> |
@@ -14,10 +14,10 @@
### Events
| Name | Type | Description |
| -- | -- | -- |
| --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isOutput) { -%>
| <%= prop.name %> | `<%- prop.type %>` | <%- prop.docText %> |
<% } -%>
<% }) -%>
<% } %>
<% } %>

View File

@@ -2,7 +2,7 @@
### Properties
| Name | Type | Default value | Description |
| -- | -- | -- | -- |
| --- | --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isInput) { -%>
| <%= prop.name %> | `<%- prop.type %>` | <%- prop.defaultValue %> | <%- prop.docText %> |
@@ -14,10 +14,10 @@
### Events
| Name | Type | Description |
| -- | -- | -- |
| --- | --- | --- |
<% properties.forEach(function(prop) { -%>
<% if (prop.isOutput) { -%>
| <%= prop.name %> | `<%- prop.type %>` | <%- prop.docText %> |
<% } -%>
<% }) -%>
<% } %>
<% } %>

View File

@@ -3,8 +3,10 @@
return fullPath.substring(fullPath.indexOf('docs') + 5).replace('\\', '/')
}
function relSrcPath(fullPath) {
return '../' + fullPath.substring(fullPath.indexOf('lib')).replace('\\', '/')
function relSrcPath(document) {
if(document && document.heading && document.heading.link && document.heading.link.url){
return '../' + document.heading.link.url.substring(document.heading.link.url.indexOf('lib')).replace('\\', '/')
}
}
function renderSection(sectionName) {
@@ -15,14 +17,14 @@
### <%= sectionName %>
| Name | Description | Source link |
| -- | -- | --|
| --- | --- | --|
<% }
sectionDocs.forEach(document => { -%>
| [<%= document['title'] %>](<%= relDocPath(document['id']) %>) -%>
<% if (document['status'] && document['status'] !== 'Active') { -%>
![<%= document['status'] %>](docassets/images/<%= document['status'] %>Icon.png) <% } -%>
| <%= document['paragraph']['plaintext'] %> | [Source](<%= relSrcPath(document['heading']['link']['url']) %>) |
| <%= document['paragraph']['plaintext'] %> | [Source](<%= relSrcPath(document) %>) |
<% });
}
-%>

View File

@@ -9,7 +9,7 @@ This page lists all third party libraries that ADF <%= projVersion %> depends on
## Libraries
| Name | Version | License |
| -- | -- | -- |
| --- | --- | --- |
<% for (var packageName in packages) {
var lastAtSignPos = packageName.lastIndexOf('@');
@@ -25,4 +25,4 @@ This page lists all third party libraries that ADF <%= projVersion %> depends on
}
-%>
| <%= linkedName %> | <%= version %> | <%= licenses %> |
<% } %>
<% } %>

View File

@@ -1,5 +1,5 @@
| Name | Level | Abstract |
| -- | -- | -- |
| --- | --- | --- |
<% tuts.forEach(function(tut) { -%>
| [**<%= tut.title %>**](<%= tut.link %>) | <%= tut.level %> | <%= tut.briefDesc %> |
<% }) %>
<% }) %>

View File

@@ -7,7 +7,6 @@ import * as lev from "fast-levenshtein";
import * as ngHelpers from "../ngHelpers";
const imageFolderPath = path.resolve('docs', 'docassets', 'images');
// Using this value for the edit distance between Markdown image URLs
@@ -15,8 +14,6 @@ const imageFolderPath = path.resolve('docs', 'docassets', 'images');
// folder in the path. Keeping it low avoids crazy suggestions.
const maxImagePathLevDistance = 7;
export function processDocs(mdCache, aggData, errorMessages) {
var pathnames = Object.keys(mdCache);
@@ -40,7 +37,7 @@ export function processDocs(mdCache, aggData, errorMessages) {
}
} else {
let linkElems = selectAll('link', tree);
linkElems.forEach(linkElem => {
let normUrl = normaliseLinkPath(pathname, linkElem.url);
multiSetAdd(linkRefs, normUrl, pathname);
@@ -138,4 +135,4 @@ function multiSetAdd(container: {}, key: string, value: string) {
} else {
container[key] = [ value ];
}
}
}

View File

@@ -13,7 +13,7 @@ var libNamesList = [
'insights', 'process-services', 'process-services-cloud'
];
var query = "\n query libIndex($libName: String) {\n documents(idFilter: $libName) {\n title: metadata(key: \"Title\")\n status: metadata(key: \"Status\")\n id\n classType: folder(depth: 2)\n heading {\n link {\n url\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n";
function processDocs(mdCache, aggData, _errorMessages) {
function processDocs(mdCache, aggData) {
var docset = new MQ.Docset(mdCache);
var templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
var templateSource = fs.readFileSync(templateFilePath, 'utf8');

View File

@@ -37,7 +37,7 @@ let query = `
`;
export function processDocs(mdCache, aggData, _errorMessages) {
export function processDocs(mdCache, aggData) {
let docset: MQ.Docset = new MQ.Docset(mdCache);
let templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
@@ -77,7 +77,7 @@ export function processDocs(mdCache, aggData, _errorMessages) {
});
});
}

View File

@@ -2,7 +2,6 @@ var fs = require("fs");
var path = require("path");
var remark = require("remark");
var stringify = require("remark-stringify");
var frontMatter = require("remark-frontmatter");
var zone = require("mdast-zone");
var yaml = require("js-yaml");
@@ -14,10 +13,7 @@ var mdNav = require("../mdNav");
module.exports = {
"processDocs": processDocs
}
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(model)|(pipe)|(service)|(widget))\.ts/;
var searchFolderOmitRegex = /(config)|(mock)|(i18n)|(assets)|(styles)/;
};
var docsFolderPath = path.resolve("docs");
var rootFolder = "lib";
@@ -26,8 +22,6 @@ var indexMdFilePath = path.resolve(docsFolderPath, "README.md");
var guideFolderName = "user-guide";
var guideSummaryFileName = path.resolve(docsFolderPath, guideFolderName, "summary.json");
var maxBriefDescLength = 180;
var adfLibNames = [
"core", "content-services", "insights",
"process-services", "process-services-cloud", "extensions"
@@ -35,14 +29,12 @@ var adfLibNames = [
var statusIcons;
function processDocs(mdCache, aggData, _errorMessages) {
function processDocs(mdCache, aggData) {
initPhase(aggData);
readPhase(mdCache, aggData);
aggPhase(aggData);
}
function initPhase(aggData) {
statusIcons = aggData.config["statusIcons"] || {};
aggData.stoplist = makeStoplist(aggData.config);
@@ -53,7 +45,6 @@ function initPhase(aggData) {
searchLibraryRecursive(aggData.srcData, path.resolve(rootFolder));
}
function readPhase(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
@@ -62,7 +53,6 @@ function readPhase(mdCache, aggData) {
});
}
function getFileData(tree, pathname, aggData) {
var itemName = path.basename(pathname, ".md");
@@ -162,8 +152,6 @@ function aggPhase(aggData) {
subIndexText = remark().use(frontMatter, ["yaml"]).data("settings", {paddedTable: false}).stringify(subIndexTree);
fs.writeFileSync(subIndexFilePath, subIndexText);
//fs.writeFileSync(indexMdFilePath, remark().stringify(indexFileTree));
}
@@ -190,7 +178,6 @@ function rejectItemViaStoplist(stoplist, itemName) {
return false;
}
function prepareIndexSections(aggData) {
var srcNames = Object.keys(aggData.srcData);
var sections = initEmptySections();

View File

@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
var fs = require("fs");
var unist_util_select_1 = require("unist-util-select");
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
var suffixesNotToCheck = /\.ts/;
function processDocs(mdCache, aggData, errorMessages) {
var pathnames = Object.keys(mdCache);
@@ -11,12 +10,6 @@ function processDocs(mdCache, aggData, errorMessages) {
var imageFolderPath = path.resolve(aggData['rootFolder'], 'docs', 'docassets', 'images');
var imageSet = new LinkSet(getImagePaths(imageFolderPath));
pathnames.forEach(function (pathname) {
var fileBaseName = path.basename(pathname, '.md');
/*
if (!fileBaseName.match(angFilenameRegex)) {
return;
}
*/
var tree = mdCache[pathname].mdOutTree;
fixUrls(tree, pathname, linkSet, 'link');
fixUrls(tree, pathname, imageSet, 'image');

View File

@@ -4,29 +4,20 @@ import * as fs from 'fs';
import { selectAll } from 'unist-util-select';
import { MDAST } from 'mdast';
const angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
const suffixesNotToCheck = /\.ts/;
export function processDocs(mdCache, aggData, errorMessages) {
var pathnames = Object.keys(mdCache);
let linkSet = new LinkSet(pathnames);
let imageFolderPath = path.resolve(aggData['rootFolder'], 'docs', 'docassets', 'images');
let imageSet = new LinkSet(getImagePaths(imageFolderPath));
pathnames.forEach(pathname => {
let fileBaseName = path.basename(pathname, '.md');
/*
if (!fileBaseName.match(angFilenameRegex)) {
return;
}
*/
let tree = mdCache[pathname].mdOutTree;
fixUrls(tree, pathname, linkSet, 'link');
fixUrls(tree, pathname, imageSet, 'image');
});
@@ -54,7 +45,7 @@ function fixUrls(tree: MDAST.Root, docFilePath: string, linkSet: LinkSet, select
(origFullUrlPath !== '') &&
!fs.existsSync(origFullUrlPath)
) {
let newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
let newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g,'/') + anchor;
errors.push(`Bad link: ${origFullUrlPath}\nReplacing with ${linkElem.url}`);
} /*else {
@@ -93,14 +84,14 @@ class LinkSet {
urls.forEach(url => {
let fileName = path.basename(url);
if (this.links.has(fileName)) {
let item = this.links.get(fileName);
item.push(url);
} else {
this.links.set(fileName, [url]);
}
});
});
}
update(oldUrl: string): string {

View File

@@ -1,8 +1,5 @@
import * as path from "path";
import * as fs from "fs";
import { select, selectAll } from "unist-util-select";
export function processDocs(mdCache, aggData, errorMessages) {
}
}

View File

@@ -1,5 +1,4 @@
var path = require("path");
var getSection = require("mdast-util-heading-range");
var unist = require("../unistHelpers");
@@ -21,7 +20,7 @@ function initPhase(aggData) {
function readPhase(tree, pathname, aggData) {
var saHeadingOffset = findSeeAlsoSection(tree);
var saNode = [];
if (saHeadingOffset !== -1) {
@@ -39,7 +38,7 @@ function readPhase(tree, pathname, aggData) {
for (var i = 0; i < list.children.length; i++) {
var itemLink = getItemLinkInfo(list.children[i]);
if (itemLink) {
saNode.push(itemLink);
}
@@ -112,7 +111,7 @@ function tidyName(name) {
function makeEmptySAList() {
var result = [];
}
@@ -130,7 +129,7 @@ function tidyGraph(graph) {
var currNodeName = nodeNames[n];
var currNodeArcs = graph[currNodeName];
for (var a = 0; a < currNodeArcs.length; a++) {
var linkedNode = graph[currNodeArcs[a]];
var resultNode = result[currNodeArcs[a]];
@@ -139,7 +138,7 @@ function tidyGraph(graph) {
console.log(`Warning: item '${currNodeArcs[a]}' (in See Also section of '${currNodeName}') has no corresponding file`);
} else if (linkedNode.indexOf(currNodeName) === -1) {
linkedNode.push(currNodeName);
resultNode.push(currNodeName);
resultNode.push(currNodeName);
}
}
}

View File

@@ -4,7 +4,7 @@ var path = require("path");
var unist_util_select_1 = require("unist-util-select");
var ngHelpers = require("../ngHelpers");
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
function processDocs(mdCache, aggData, errorMessages) {
function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
pathnames.forEach(function (pathname) {
var fileBaseName = path.basename(pathname, '.md');
@@ -18,7 +18,7 @@ function processDocs(mdCache, aggData, errorMessages) {
var titleHeading = unist_util_select_1.select('heading[depth=1]:first-of-type', tree);
var relDocPath = pathname.substring(pathname.indexOf('docs'));
var srcUrl = fixRelSrcUrl(relDocPath, sourcePath);
if (titleHeading.children[0].type === "text") {
if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === "text") {
var titleText = titleHeading.children[0];
titleHeading.children[0] = {
type: 'link',
@@ -27,9 +27,9 @@ function processDocs(mdCache, aggData, errorMessages) {
children: [titleText]
};
}
else if ((titleHeading.children[0].type === "link") && sourcePath) {
else if ((titleHeading && titleHeading.children[0].type === "link") && sourcePath) {
var linkElem = titleHeading.children[0];
linkElem.url = srcUrl, //`../../${sourcePath}`;
linkElem.url = srcUrl,
linkElem.title = "Defined in " + path.basename(sourcePath);
}
});

View File

@@ -4,11 +4,9 @@ import { select } from "unist-util-select";
import * as ngHelpers from "../ngHelpers";
const angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
export function processDocs(mdCache, aggData, errorMessages) {
export function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => {
@@ -26,7 +24,7 @@ export function processDocs(mdCache, aggData, errorMessages) {
let relDocPath = pathname.substring(pathname.indexOf('docs'));
let srcUrl = fixRelSrcUrl(relDocPath, sourcePath);
if (titleHeading.children[0].type === "text") {
if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === "text") {
let titleText = titleHeading.children[0];
titleHeading.children[0] = {
type: 'link',
@@ -34,7 +32,7 @@ export function processDocs(mdCache, aggData, errorMessages) {
title: `Defined in ${path.basename(sourcePath)}`,
children: [titleText]
}
} else if ((titleHeading.children[0].type === "link") && sourcePath) {
} else if ((titleHeading && titleHeading.children[0].type === "link") && sourcePath) {
let linkElem = titleHeading.children[0];
linkElem.url = srcUrl, //`../../${sourcePath}`;
linkElem.title = `Defined in ${path.basename(sourcePath)}`;
@@ -52,4 +50,4 @@ function fixRelSrcUrl(docPath: string, srcPath: string) {
}
return dotPathPart + srcPath;
}
}

View File

@@ -3,15 +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 ejs from "ejs";
import {
Application,
} from "typedoc";
import { MDNav } from "../mdNav";
import { ngNameToClassName } from "../ngHelpers";
@@ -19,21 +13,12 @@ import {
ComponentInfo
} from "../SourceInfoClasses"
let libFolders = ["core", "content-services", "process-services", "insights", "process-services-cloud"];
let templateFolder = path.resolve("tools", "doc", "templates");
let excludePatterns = [
"**/*.spec.ts"
];
let nameExceptions;
export function processDocs(mdCache, aggData, _errorMessages) {
//initPhase(aggData);
nameExceptions = aggData.config.typeNameExceptions;
let pathnames = Object.keys(mdCache);
@@ -61,39 +46,7 @@ function showErrors(filename, errorMessages) {
}
/*
function initPhase(aggData) {
nameExceptions = aggData.config.typeNameExceptions;
let app = new Application({
exclude: excludePatterns,
ignoreCompilerErrors: true,
experimentalDecorators: true,
tsconfig: "tsconfig.json"
});
let sources = app.expandInputFiles(libFolders.map(folder => {
return path.resolve("lib", folder);
}));
aggData.projData = app.convert(sources);
}
*/
function updateFile(tree, pathname, aggData, errorMessages) {
/*
let compName = angNameToClassName(path.basename(pathname, ".md"));
let classRef = aggData.projData.findReflectionByName(compName);
if (!classRef) {
// A doc file with no corresponding class (eg, Document Library Model).
return false;
}
let compData = new ComponentInfo(classRef);
*/
let className = ngNameToClassName(path.basename(pathname, ".md"), nameExceptions);
let classTypeMatch = className.match(/component|directive|service/i);
@@ -135,39 +88,6 @@ function updateFile(tree, pathname, aggData, errorMessages) {
return true;
}
/*
function initialCap(str: string) {
return str[0].toUpperCase() + str.substr(1);
}
function angNameToClassName(rawName: string) {
if (nameExceptions[rawName])
return nameExceptions[rawName];
var name = rawName.replace(/\]|\(|\)/g, '');
var fileNameSections = name.split('.');
var compNameSections = fileNameSections[0].split('-');
var outCompName = '';
for (var i = 0; i < compNameSections.length; i++) {
outCompName = outCompName + initialCap(compNameSections[i]);
}
var itemTypeIndicator = '';
if (fileNameSections.length > 1) {
itemTypeIndicator = initialCap(fileNameSections[1]);
}
var finalName = outCompName + itemTypeIndicator;
return finalName;
}
*/
function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
let result = {}
@@ -259,10 +179,6 @@ function getMethodDocsFromMD(tree) {
methItem = methListItems
.listItem(l=>true, i);
}
/*
let newRoot = unist.makeRoot([methList.item]);
console.log(remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false, gfm: false}).stringify(tree));
*/
return result;
}

View File

@@ -3,7 +3,6 @@ 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 yaml from "js-yaml";
import * as ejs from "ejs";
@@ -15,12 +14,12 @@ const templateFolder = path.resolve("tools", "doc", "templates");
const userGuideFolder = path.resolve("docs", "user-guide");
export function processDocs(tree, pathname, aggData, errorMessages) {
aggPhase(aggData);
export function processDocs() {
aggPhase();
}
function aggPhase(aggData) {
function aggPhase() {
let indexDocData = getIndexDocData();
let templateName = path.resolve(templateFolder, "tutIndex.ejs");
@@ -118,7 +117,7 @@ function getFirstParagraph(tree) {
if (s < tree.children.length) {
return tree.children[s];
} else {
return null;
}
@@ -131,8 +130,8 @@ function getFirstHeading(tree) {
if (s < tree.children.length) {
return tree.children[s];
} else {
return null;
}
}
}

View File

@@ -1,5 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__esModule = true;
var path = require("path");
var unist = require("../unistHelpers");
var ngHelpers = require("../ngHelpers");
@@ -8,15 +8,13 @@ var includedNodeTypes = [
"table", "tableRow", "tableCell", "emphasis", "strong",
"link", "text"
];
var docFolder = path.resolve("docs");
var adfLibNames = ["core", "content-services", "insights", "process-services", "process-services-cloud", "extensions"];
var externalNameLinks;
var linkOverrides;
function processDocs(mdCache, aggData, errorMessages) {
function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache);
var pathnames = Object.keys(mdCache);
pathnames.forEach(function (pathname) {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData, errorMessages);
updateFile(mdCache[pathname].mdOutTree, pathname, aggData);
});
}
exports.processDocs = processDocs;
@@ -28,21 +26,6 @@ function initPhase(aggData, mdCache) {
});
aggData.docFiles = {};
aggData.nameLookup = new SplitNameLookup();
/*
adfLibNames.forEach(libName => {
let libFolderPath = path.resolve(docFolder, libName);
let files = fs.readdirSync(libFolderPath);
files.forEach(file => {
if (path.extname(file) === ".md") {
let relPath = libFolderPath.substr(libFolderPath.indexOf("docs") + 5).replace(/\\/, "/") + "/" + file;
let compName = path.basename(file, ".md");
aggData.docFiles[compName] = relPath;
}
});
});
*/
var docFilePaths = Object.keys(mdCache);
docFilePaths.forEach(function (docFilePath) {
var relPath = docFilePath.substring(docFilePath.indexOf('docs') + 5).replace(/\\/g, "/");
@@ -55,9 +38,8 @@ function initPhase(aggData, mdCache) {
aggData.nameLookup.addName(currClassName);
}
});
//console.log(JSON.stringify(aggData.nameLookup));
}
function updateFile(tree, pathname, aggData, _errorMessages) {
function updateFile(tree, pathname, aggData) {
traverseMDTree(tree);
return true;
function traverseMDTree(node) {
@@ -65,7 +47,7 @@ function updateFile(tree, pathname, aggData, _errorMessages) {
return;
}
if (node.type === "link") {
if (node.children && ((node.children[0].type === "inlineCode") ||
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) {
@@ -84,15 +66,10 @@ function updateFile(tree, pathname, aggData, _errorMessages) {
}
var _a;
});
} /*else if (node.children) {
node.children.forEach(child => {
traverseMDTree(child);
});
}
*/
}
}
var SplitNameNode = /** @class */ (function () {
var SplitNameNode = (function () {
function SplitNameNode(key, value) {
if (key === void 0) { key = ""; }
if (value === void 0) { value = ""; }
@@ -105,21 +82,21 @@ var SplitNameNode = /** @class */ (function () {
};
return SplitNameNode;
}());
var SplitNameMatchElement = /** @class */ (function () {
var SplitNameMatchElement = (function () {
function SplitNameMatchElement(node, textPos) {
this.node = node;
this.textPos = textPos;
}
return SplitNameMatchElement;
}());
var SplitNameMatchResult = /** @class */ (function () {
var SplitNameMatchResult = (function () {
function SplitNameMatchResult(value, startPos) {
this.value = value;
this.startPos = startPos;
}
return SplitNameMatchResult;
}());
var SplitNameMatcher = /** @class */ (function () {
var SplitNameMatcher = (function () {
function SplitNameMatcher(root) {
this.root = root;
this.reset();
@@ -165,7 +142,7 @@ var SplitNameMatcher = /** @class */ (function () {
};
return SplitNameMatcher;
}());
var SplitNameLookup = /** @class */ (function () {
var SplitNameLookup = (function () {
function SplitNameLookup() {
this.root = new SplitNameNode();
}
@@ -188,7 +165,7 @@ var SplitNameLookup = /** @class */ (function () {
};
return SplitNameLookup;
}());
var WordScanner = /** @class */ (function () {
var WordScanner = (function () {
function WordScanner(text) {
this.text = text;
this.separators = " \n\r\t.;:<>[]&|";
@@ -237,10 +214,10 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
var link = resolveTypeLink(aggData, docFilePath, word);
var matchStart = void 0;
if (!link) {
var match_1 = matcher.nextWord(word.toLowerCase(), scanner.index);
if (match_1 && match_1[0]) {
link = resolveTypeLink(aggData, docFilePath, match_1[0].value);
matchStart = match_1[0].startPos;
var match = matcher.nextWord(word.toLowerCase(), scanner.index);
if (match && match[0]) {
link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos;
}
}
else {
@@ -339,14 +316,6 @@ function cleanTypeName(text) {
return text.replace(/\[\]$/, "");
}
}
/*
function isLinkable(kind: ReflectionKind) {
return (kind === ReflectionKind.Class) ||
(kind === ReflectionKind.Interface) ||
(kind === ReflectionKind.Enum) ||
(kind === ReflectionKind.TypeAlias);
}
*/
function convertNodeToTypeLink(node, text, url, title) {
if (title === void 0) { title = null; }
var linkDisplayText = unist.makeInlineCode(text);

View File

@@ -1,13 +1,7 @@
import * as path from "path";
import * as fs from "fs";
import * as remark from "remark";
import * as stringify from "remark-stringify";
import * as frontMatter from "remark-frontmatter";
import * as unist from "../unistHelpers";
import * as ngHelpers from "../ngHelpers";
import { match } from "minimatch";
const includedNodeTypes = [
@@ -16,23 +10,19 @@ const includedNodeTypes = [
"link", "text"
];
const docFolder = path.resolve("docs");
const adfLibNames = ["core", "content-services", "insights", "process-services", "process-services-cloud", "extensions"];
let externalNameLinks;
let linkOverrides;
export function processDocs(mdCache, aggData, errorMessages) {
export function processDocs(mdCache, aggData) {
initPhase(aggData, mdCache);
var pathnames = Object.keys(mdCache);
pathnames.forEach(pathname => {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData, errorMessages);
updateFile(mdCache[pathname].mdOutTree, pathname, aggData);
});
}
function initPhase(aggData, mdCache) {
externalNameLinks = aggData.config.externalNameLinks;
@@ -44,22 +34,6 @@ function initPhase(aggData, mdCache) {
aggData.docFiles = {};
aggData.nameLookup = new SplitNameLookup();
/*
adfLibNames.forEach(libName => {
let libFolderPath = path.resolve(docFolder, libName);
let files = fs.readdirSync(libFolderPath);
files.forEach(file => {
if (path.extname(file) === ".md") {
let relPath = libFolderPath.substr(libFolderPath.indexOf("docs") + 5).replace(/\\/, "/") + "/" + file;
let compName = path.basename(file, ".md");
aggData.docFiles[compName] = relPath;
}
});
});
*/
let docFilePaths = Object.keys(mdCache);
docFilePaths.forEach(docFilePath => {
@@ -75,13 +49,9 @@ function initPhase(aggData, mdCache) {
aggData.nameLookup.addName(currClassName);
}
});
//console.log(JSON.stringify(aggData.nameLookup));
}
function updateFile(tree, pathname, aggData, _errorMessages) {
function updateFile(tree, pathname, aggData) {
traverseMDTree(tree);
return true;
@@ -92,7 +62,7 @@ function updateFile(tree, pathname, aggData, _errorMessages) {
}
if (node.type === "link") {
if (node.children && (
if (node.children[0] && (
(node.children[0].type === "inlineCode") ||
(node.children[0].type === "text")
)) {
@@ -102,7 +72,7 @@ function updateFile(tree, pathname, aggData, _errorMessages) {
convertNodeToTypeLink(node, node.children[0].value, link);
}
}
} else if ((node.children) && (node.type !== "heading")) { //((node.type === "paragraph") || (node.type === "tableCell")) {
} else if ((node.children) && (node.type !== "heading")) {
node.children.forEach((child, index) => {
if ((child.type === "text") || (child.type === "inlineCode")) {
let newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
@@ -111,12 +81,7 @@ function updateFile(tree, pathname, aggData, _errorMessages) {
traverseMDTree(child);
}
});
} /*else if (node.children) {
node.children.forEach(child => {
traverseMDTree(child);
});
}
*/
}
}
@@ -226,7 +191,6 @@ class SplitNameLookup {
}
}
class WordScanner {
separators: string;
index: number;
@@ -273,7 +237,6 @@ class WordScanner {
}
}
function handleLinksInBodyText(aggData, docFilePath: string, text: string, wrapInlineCode: boolean = false): Node[] {
let result = [];
let currTextStart = 0;
@@ -347,12 +310,8 @@ function resolveTypeLink(aggData, docFilePath, text): string {
return "";
}
/*
let ref: Reflection = aggData.projData.findReflectionByName(possTypeName);
*/
let classInfo = aggData.classInfo[possTypeName];
//if (ref && isLinkable(ref.kind)) {
if (linkOverrides[possTypeName.toLowerCase()]) {
return '';
} else if (externalNameLinks[possTypeName]) {
@@ -361,12 +320,9 @@ function resolveTypeLink(aggData, docFilePath, text): string {
let kebabName = ngHelpers.kebabifyClassName(possTypeName);
let possDocFile = aggData.docFiles[kebabName];
//let url = "../../" + classInfo.sourcePath;
let url = fixRelSrcUrl(docFilePath, classInfo.sourcePath);
if (possDocFile) {
//url = "../" + possDocFile;
url = fixRelDocUrl(docFilePath, possDocFile);
}
@@ -410,15 +366,6 @@ function cleanTypeName(text) {
}
}
/*
function isLinkable(kind: ReflectionKind) {
return (kind === ReflectionKind.Class) ||
(kind === ReflectionKind.Interface) ||
(kind === ReflectionKind.Enum) ||
(kind === ReflectionKind.TypeAlias);
}
*/
function convertNodeToTypeLink(node, text, url, title = null) {
let linkDisplayText = unist.makeInlineCode(text);
node.type = "link";

View File

@@ -15,14 +15,12 @@ var ngHelpers = require("../ngHelpers");
module.exports = {
"processDocs": processDocs
}
};
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))\.ts/;
var docsFolderPath = path.resolve("docs");
var histFilePath = path.resolve(docsFolderPath, "versionIndex.md");
var histSectionName = "history";
var initialVersion = "v2.0.0";
var templateFolder = path.resolve("tools", "doc", "templates");
@@ -55,11 +53,11 @@ function getFileData(tree, pathname, aggData) {
if (!compName.match(angNameRegex))
return;
if (compName.match(/boilerplate/))
return;
if (tree.children[0].type == "yaml") {
if (tree && tree.children[0] && tree.children[0].type == "yaml") {
var metadata = yaml.load(tree.children[0].value);
var version = metadata["Added"];
@@ -83,7 +81,7 @@ function aggPhase(aggData) {
var keys = Object.keys(aggData.versions);
keys.sort((a, b) => {
if (a > b)
if (a > b)
return -1;
else if (b > a)
return 1;