[ADF-2643] Added compatibility info to version index (#3218)

* [ADF-1643] Updated version index and script to support compatibility info

* [ADF-2643] Added links and compatibility info
This commit is contained in:
Andy Stark 2018-04-19 16:20:00 +01:00 committed by Eugenio Romano
parent fbe675aedb
commit e0cc0fc7c5
3 changed files with 81 additions and 34 deletions

View File

@ -1,10 +1,8 @@
# Version Index
This file contains a list of components grouped according to the
ADF version in which they were introduced. See the
[main index page](README.md) for a list organized by ADF libraries.
<!--history start-->
Below are the details of all released versions of ADF since general
availability (v2.0.0). See the [main index page](README.md) for a list
of components organized by ADF libraries.
## Versions
@ -15,6 +13,14 @@ ADF version in which they were introduced. See the
## v2.3.0
**Released:** 2018-04-17 ([Release notes](https://community.alfresco.com/docs/DOC-7347-adf-230-release-note))<br/>
**APS compatible version:** v1.6.4+<br/>
**ACS compatible version:** v5.2.3<br/>
### Components added
<!--v230 start-->
- [Comment content service](core/comment-content.service.md)
- [Custom resources service](content-services/custom-resources.service.md)
- [Inherited button directive](content-services/inherited-button.directive.md)
@ -26,21 +32,57 @@ ADF version in which they were introduced. See the
- [Sidenav layout component](core/sidenav-layout.component.md)
- [Upload version button component](content-services/upload-version-button.component.md)
<!--v230 end-->
([Back to top](#versions))
## v2.2.0
**Released:** 2018-03-05 ([Release notes](https://community.alfresco.com/docs/DOC-7318-adf-220-release-note))<br/>
**APS compatible version:** v1.6.4+<br/>
**ACS compatible version:** v5.2.2<br/>
### Components added
<!--v220 start-->
- [Node download directive](content-services/node-download.directive.md)
- [Node lock directive](content-services/node-lock.directive.md)
<!--v220 end-->
([Back to top](#versions))
## v2.1.0
**Released:** 2018-01-29 ([Release notes](https://community.alfresco.com/docs/DOC-7292-adf-210-release-note))<br/>
**APS compatible version:** v1.6.4+<br/>
**ACS compatible version:** v5.2.2<br/>
### Components added
<!--v210 start-->
- [Content metadata component](content-services/content-metadata.component.md)
- [Content node dialog service](content-services/content-node-dialog.service.md)
- [Content node selector panel component](content-services/content-node-selector-panel.component.md)
- [Search configuration service](core/search-configuration.service.md)
- [Sidebar action menu component](core/sidebar-action-menu.component.md)
<!--v210 end-->
([Back to top](#versions))
## v2.0.0
**Released:** 2017-12-04 ([Release notes](https://community.alfresco.com/docs/DOC-7244-adf-200-release-note))<br/>
**APS compatible version:** v1.6.4+<br/>
**ACS compatible version:** v5.2.2<br/>
### Components added
<!--v200 start-->
- [Accordion group component](core/accordion-group.component.md)
- [Accordion component](core/accordion.component.md)
- [Activiti alfresco service](core/activiti-alfresco.service.md)
@ -192,4 +234,6 @@ ADF version in which they were introduced. See the
- [Webscript component](content-services/webscript.component.md)
- [Widget component](insights/widget.component.md)
<!--history end-->
<!--v200 end-->
([Back to top](#versions))

View File

@ -0,0 +1,3 @@
{% each items as item %}
- [{{item.title}}]({{item.link}})
{% endeach %}

View File

@ -5,6 +5,9 @@ var yaml = require("js-yaml");
var remark = require("remark");
var stringify = require("remark-stringify");
var zone = require("mdast-zone");
var frontMatter = require("remark-frontmatter");
var combyne = require("combyne");
var unist = require("../unistHelpers");
var ngHelpers = require("../ngHelpers");
@ -25,13 +28,15 @@ var histFilePath = path.resolve(docsFolderPath, "versionIndex.md");
var histSectionName = "history";
var initialVersion = "v2.0.0";
var templateFolder = path.resolve(".", "config", "DocProcessor", "templates");
function initPhase(aggData) {
aggData.versions = { "v2.0.0":[] };
}
function readPhase(tree, pathname, aggData) {
var compName = pathname; //path.basename(pathname, ".md");
var compName = pathname;
var angNameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))/;
if (!compName.match(angNameRegex))
@ -60,7 +65,7 @@ function readPhase(tree, pathname, aggData) {
function aggPhase(aggData) {
var histFileText = fs.readFileSync(histFilePath, "utf8");
var histFileTree = remark().parse(histFileText);
var histFileTree = remark().data("settings", {paddedTable: false, gfm: false}).parse(histFileText);
var keys = Object.keys(aggData.versions);
keys.sort((a, b) => {
@ -72,16 +77,9 @@ function aggPhase(aggData) {
return 0;
});
var sections = [unist.makeHeading(unist.makeText("Versions"), 2)];
var vListItems = [];
for (var i = 0; i < keys.length; i++) {
var keyAnchor = keys[i].replace(/\./g, "");
vListItems.push(unist.makeListItem(unist.makeLink(unist.makeText(keys[i]), `#${keyAnchor}`)));
}
sections.push(unist.makeListUnordered(vListItems));
var templateName = path.resolve(templateFolder, "versIndex.combyne");
var templateSource = fs.readFileSync(templateName, "utf8");
var template = combyne(templateSource);
for (var i = 0; i < keys.length; i++) {
var version = keys[i];
@ -93,7 +91,7 @@ function aggPhase(aggData) {
return aa.localeCompare(bb);
});
var versListItems = [];
var versionTemplateData = {items: []};
for (var v = 0; v < versionItems.length; v++) {
var displayName = ngHelpers.ngNameToDisplayName(path.basename(versionItems[v], ".md"));
@ -101,25 +99,27 @@ function aggPhase(aggData) {
pageLink = pageLink.replace(/\\/g, '/');
pageLink = pageLink.substr(pageLink.indexOf("docs") + 5);
versListItems.push(
unist.makeListItem(
unist.makeLink(unist.makeText(displayName), pageLink)
)
);
versionTemplateData.items.push({
title: displayName,
link: pageLink
});
}
sections.push(unist.makeHeading(unist.makeText(version), 2));
sections.push(unist.makeListUnordered(versListItems));
var mdText = template.render(versionTemplateData);
mdText = mdText.replace(/^ +-/mg, "-");
var newSection = remark().data("settings", {paddedTable: false, gfm: false}).parse(mdText.trim()).children;
var versSectionName = version.replace(/\./g, "");;
zone(histFileTree, versSectionName, (startComment, oldSection, endComment) => {
newSection.unshift(startComment);
newSection.push(endComment);
return newSection;
});
}
zone(histFileTree, histSectionName, (startComment, oldSection, endComment) => {
sections.unshift(startComment);
sections.push(endComment);
return sections;
});
//console.log(JSON.stringify(histFileTree));
fs.writeFileSync(histFilePath, remark().stringify(histFileTree));
fs.writeFileSync(histFilePath, remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false, gfm: false}).stringify(histFileTree));
}