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) {
|
||||
var config = JSON.parse(fs.readFileSync(configFilePath));
|
||||
|
||||
return config.enabledTools;
|
||||
function loadConfig() {
|
||||
var configFilePath = path.resolve(__dirname, configFileName)
|
||||
return JSON.parse(fs.readFileSync(configFilePath));
|
||||
}
|
||||
|
||||
|
||||
@ -110,38 +109,33 @@ function getAllDocFilePaths(docFolder, files) {
|
||||
|
||||
program
|
||||
.usage("[options] <source>")
|
||||
.option("-p, --profile [profileName]", "Select named config profile", "index")
|
||||
.parse(process.argv);
|
||||
|
||||
var sourcePath;
|
||||
|
||||
if (program.args.length === 0) {
|
||||
console.log("Error: source argument required");
|
||||
return 0;
|
||||
sourcePath = path.resolve("..", "docs");
|
||||
} else {
|
||||
sourcePath = path.resolve(program.args[0]);
|
||||
}
|
||||
|
||||
|
||||
var sourcePath = path.resolve(program.args[0]);
|
||||
var sourceInfo = fs.statSync(sourcePath);
|
||||
|
||||
/*
|
||||
var destPath;
|
||||
var destInfo;
|
||||
var toolModules = loadToolModules();
|
||||
|
||||
if (program.args.length >= 2) {
|
||||
destPath = path.resolve(program.args[1]);
|
||||
destInfo = fs.statSync(sourcePath);
|
||||
var config = loadConfig();
|
||||
|
||||
var toolList;
|
||||
|
||||
if (config.profiles[program.profile]){
|
||||
toolList = config.profiles[program.profile];
|
||||
var toolListText = toolList.join(", ");
|
||||
console.log(`Using '${program.profile}' profile: ${toolListText}`);
|
||||
} else {
|
||||
destPath = sourcePath;
|
||||
destInfo = sourceInfo;
|
||||
}
|
||||
|
||||
if (sourceInfo.isDirectory() && !destInfo.isDirectory()) {
|
||||
console.log("Error: The <dest> argument must be a directory");
|
||||
console.log(`Aborting: unknown profile '${program.profile}`);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
var toolModules = loadToolModules();
|
||||
var toolList = loadToolConfig(path.resolve(__dirname, configFileName));
|
||||
|
||||
|
||||
var files = [];
|
||||
|
||||
@ -149,9 +143,6 @@ if (sourceInfo.isDirectory()) {
|
||||
getAllDocFilePaths(sourcePath, files);
|
||||
} else if (sourceInfo.isFile()) {
|
||||
files = [ sourcePath ];
|
||||
//files = [ path.basename(sourcePath) ];
|
||||
//sourcePath = path.dirname(sourcePath);
|
||||
//destPath = path.dirname(destPath);
|
||||
}
|
||||
|
||||
files = files.filter(filename =>
|
||||
|
@ -1,7 +1,13 @@
|
||||
{
|
||||
"enabledTools": [
|
||||
"index",
|
||||
"versionIndex",
|
||||
"tutorialIndex"
|
||||
]
|
||||
"profiles": {
|
||||
"index": [
|
||||
"index",
|
||||
"versionIndex",
|
||||
"tutorialIndex"
|
||||
],
|
||||
"enhance": [
|
||||
"tsInfo",
|
||||
"toc"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user