mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ADF-2759] Updated doc script to allow multiple config profiles (#3211)
This commit is contained in:
parent
1b2bd6220e
commit
026da57cb8
@ -85,10 +85,9 @@ function loadToolModules() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadToolConfig(configFilePath) {
|
function loadConfig() {
|
||||||
var config = JSON.parse(fs.readFileSync(configFilePath));
|
var configFilePath = path.resolve(__dirname, configFileName)
|
||||||
|
return JSON.parse(fs.readFileSync(configFilePath));
|
||||||
return config.enabledTools;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -110,38 +109,33 @@ function getAllDocFilePaths(docFolder, files) {
|
|||||||
|
|
||||||
program
|
program
|
||||||
.usage("[options] <source>")
|
.usage("[options] <source>")
|
||||||
|
.option("-p, --profile [profileName]", "Select named config profile", "index")
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
|
var sourcePath;
|
||||||
|
|
||||||
if (program.args.length === 0) {
|
if (program.args.length === 0) {
|
||||||
console.log("Error: source argument required");
|
sourcePath = path.resolve("..", "docs");
|
||||||
return 0;
|
} else {
|
||||||
|
sourcePath = path.resolve(program.args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var sourcePath = path.resolve(program.args[0]);
|
|
||||||
var sourceInfo = fs.statSync(sourcePath);
|
var sourceInfo = fs.statSync(sourcePath);
|
||||||
|
|
||||||
/*
|
var toolModules = loadToolModules();
|
||||||
var destPath;
|
|
||||||
var destInfo;
|
|
||||||
|
|
||||||
if (program.args.length >= 2) {
|
var config = loadConfig();
|
||||||
destPath = path.resolve(program.args[1]);
|
|
||||||
destInfo = fs.statSync(sourcePath);
|
var toolList;
|
||||||
|
|
||||||
|
if (config.profiles[program.profile]){
|
||||||
|
toolList = config.profiles[program.profile];
|
||||||
|
var toolListText = toolList.join(", ");
|
||||||
|
console.log(`Using '${program.profile}' profile: ${toolListText}`);
|
||||||
} else {
|
} else {
|
||||||
destPath = sourcePath;
|
console.log(`Aborting: unknown profile '${program.profile}`);
|
||||||
destInfo = sourceInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceInfo.isDirectory() && !destInfo.isDirectory()) {
|
|
||||||
console.log("Error: The <dest> argument must be a directory");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
var toolModules = loadToolModules();
|
|
||||||
var toolList = loadToolConfig(path.resolve(__dirname, configFileName));
|
|
||||||
|
|
||||||
|
|
||||||
var files = [];
|
var files = [];
|
||||||
|
|
||||||
@ -149,9 +143,6 @@ if (sourceInfo.isDirectory()) {
|
|||||||
getAllDocFilePaths(sourcePath, files);
|
getAllDocFilePaths(sourcePath, files);
|
||||||
} else if (sourceInfo.isFile()) {
|
} else if (sourceInfo.isFile()) {
|
||||||
files = [ sourcePath ];
|
files = [ sourcePath ];
|
||||||
//files = [ path.basename(sourcePath) ];
|
|
||||||
//sourcePath = path.dirname(sourcePath);
|
|
||||||
//destPath = path.dirname(destPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
files = files.filter(filename =>
|
files = files.filter(filename =>
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
{
|
{
|
||||||
"enabledTools": [
|
"profiles": {
|
||||||
"index",
|
"index": [
|
||||||
"versionIndex",
|
"index",
|
||||||
"tutorialIndex"
|
"versionIndex",
|
||||||
]
|
"tutorialIndex"
|
||||||
|
],
|
||||||
|
"enhance": [
|
||||||
|
"tsInfo",
|
||||||
|
"toc"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user