mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2969] Moved doc tools to new tools folder (#3314)
* [ADF-2969] Moved doc tools to new tools folder * [ADF-2969] Added files missing from schematic * [ADF-2969] Added missing files to schematic
This commit is contained in:
committed by
Eugenio Romano
parent
9d0ccff189
commit
60644d9917
31
tools/doc/libsearch.js
Normal file
31
tools/doc/libsearch.js
Normal file
@@ -0,0 +1,31 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
||||
module.exports = searchLibraryRecursive;
|
||||
|
||||
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))\.ts/;
|
||||
var searchFolderOmitRegex = /(config)|(mock)|(i18n)|(assets)|(styles)/;
|
||||
|
||||
// Search source folders for .ts files to discover all components, directives, etc.
|
||||
function searchLibraryRecursive(srcData, folderPath) {
|
||||
var items = fs.readdirSync(folderPath);
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var itemPath = path.resolve(folderPath, items[i]);
|
||||
var info = fs.statSync(itemPath);
|
||||
|
||||
if (info.isFile() && (items[i].match(angFilenameRegex))) {
|
||||
var nameNoSuffix = path.basename(items[i], '.ts');
|
||||
|
||||
var displayPath = itemPath.replace(/\\/g, '/');
|
||||
displayPath = displayPath.substr(displayPath.indexOf("lib") + 4);
|
||||
|
||||
// Type == "component", "directive", etc.
|
||||
var itemType = nameNoSuffix.split('.')[1];
|
||||
|
||||
srcData[nameNoSuffix] = { "path": displayPath, "type": itemType };
|
||||
} else if (info.isDirectory() && !items[i].match(searchFolderOmitRegex)) {
|
||||
searchLibraryRecursive(srcData, itemPath);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user