mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2670] Updated doc indexes for 2.3 (#3183)
* [ADF-2670] Updated doc indexes for 2.3 * [ADF-2670] Clarified explanation of sharedLinkId property in Viewer * [ADF-2670] Updated review checker for new doc folder structure
This commit is contained in:
committed by
Eugenio Romano
parent
014f2ab26c
commit
0d2f0b7b84
@@ -20,6 +20,7 @@ var angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/
|
||||
var srcData = {};
|
||||
var stoplist = new stoplist_1.Stoplist(stoplistFilePath);
|
||||
var docsFolderPath = path.resolve("..", "docs");
|
||||
var libFolders = ["core", "content-services", "process-services", "insights"];
|
||||
libsearch(srcData, path.resolve(rootFolder));
|
||||
/*
|
||||
let keys = Object.keys(srcData);
|
||||
@@ -35,7 +36,7 @@ var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql
|
||||
}
|
||||
});
|
||||
var query = "query commitHistory($path: String) {\n repository(name: \"alfresco-ng2-components\", owner: \"alfresco\") {\n ref(qualifiedName: \"development\") {\n target {\n ... on Commit {\n history(first: 15, path: $path) {\n nodes {\n pushedDate\n message\n }\n }\n }\n }\n }\n }\n}";
|
||||
var docFiles = getDocFileNames(docsFolderPath);
|
||||
var docFiles = getDocFilePaths(docsFolderPath);
|
||||
var docNames = Rx_1.Observable.from(docFiles);
|
||||
console.log("'Name','Review date','Commits since review','Score'");
|
||||
docNames.subscribe(function (x) {
|
||||
@@ -47,7 +48,7 @@ docNames.subscribe(function (x) {
|
||||
};
|
||||
client.request(query, vars).then(function (data) {
|
||||
var nodes = data["repository"].ref.target.history.nodes;
|
||||
var lastReviewDate = getDocReviewDate(key + ".md");
|
||||
var lastReviewDate = getDocReviewDate(x); //(key + ".md");
|
||||
var numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist);
|
||||
var dateString = lastReviewDate.format("YYYY-MM-DD");
|
||||
var score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
|
||||
@@ -84,12 +85,19 @@ function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
|
||||
});
|
||||
return numUsefulCommits;
|
||||
}
|
||||
function getDocFileNames(folderPath) {
|
||||
var files = fs.readdirSync(folderPath);
|
||||
files = files.filter(function (filename) {
|
||||
return (path.extname(filename) === ".md") &&
|
||||
(filename !== "README.md") &&
|
||||
(filename.match(angFilePattern));
|
||||
function getDocFilePaths(folderPath) {
|
||||
var result = [];
|
||||
libFolders.forEach(function (element) {
|
||||
var libPath = path.resolve(folderPath, element);
|
||||
var files = fs.readdirSync(libPath);
|
||||
files = files.filter(function (filename) {
|
||||
return (path.extname(filename) === ".md") &&
|
||||
(filename !== "README.md") &&
|
||||
(filename.match(angFilePattern));
|
||||
});
|
||||
files.forEach(function (element) {
|
||||
result.push(path.join(libPath, element));
|
||||
});
|
||||
});
|
||||
return files;
|
||||
return result;
|
||||
}
|
||||
|
@@ -29,6 +29,8 @@ let stoplist = new Stoplist(stoplistFilePath);
|
||||
|
||||
let docsFolderPath = path.resolve("..", "docs");
|
||||
|
||||
let libFolders = ["core", "content-services", "process-services", "insights"];
|
||||
|
||||
libsearch(srcData, path.resolve(rootFolder));
|
||||
|
||||
/*
|
||||
@@ -64,7 +66,7 @@ const query = `query commitHistory($path: String) {
|
||||
}
|
||||
}`;
|
||||
|
||||
let docFiles = getDocFileNames(docsFolderPath);
|
||||
let docFiles = getDocFilePaths(docsFolderPath);
|
||||
|
||||
let docNames = Observable.from(docFiles);
|
||||
|
||||
@@ -83,7 +85,7 @@ docNames.subscribe(x => {
|
||||
client.request(query, vars).then(data => {
|
||||
let nodes = data["repository"].ref.target.history.nodes;
|
||||
|
||||
let lastReviewDate = getDocReviewDate(key + ".md");
|
||||
let lastReviewDate = getDocReviewDate(x);//(key + ".md");
|
||||
|
||||
let numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist);
|
||||
let dateString = lastReviewDate.format("YYYY-MM-DD");
|
||||
@@ -139,14 +141,24 @@ function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
|
||||
}
|
||||
|
||||
|
||||
function getDocFileNames(folderPath) {
|
||||
let files = fs.readdirSync(folderPath);
|
||||
function getDocFilePaths(folderPath) {
|
||||
let result = [];
|
||||
|
||||
files = files.filter(filename =>
|
||||
(path.extname(filename) === ".md") &&
|
||||
(filename !== "README.md") &&
|
||||
(filename.match(angFilePattern))
|
||||
);
|
||||
libFolders.forEach(element => {
|
||||
let libPath = path.resolve(folderPath, element);
|
||||
let files = fs.readdirSync(libPath);
|
||||
|
||||
return files;
|
||||
files = files.filter(filename =>
|
||||
(path.extname(filename) === ".md") &&
|
||||
(filename !== "README.md") &&
|
||||
(filename.match(angFilePattern))
|
||||
);
|
||||
|
||||
files.forEach(element => {
|
||||
result.push(path.join(libPath, element));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user