Skip to content

Commit

Permalink
feat: create cli tool for adding/removing plugins #351
Browse files Browse the repository at this point in the history
  • Loading branch information
duttarnab committed Jan 11, 2022
1 parent db6d3b5 commit 6cd185b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion build/plugin-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const commands = {
if(ele.enabled)
fse.copySync(path.join(pluginsRepoPath, ele.key), path.join(pluginsPath, ele.key))
});
console.info('Added/Removed enabled plugins successfully. The project is ready for built.');
console.info('Enabled/Disabled plugins successfully. The project is ready for built.');
},
showEnabledPlugins: function() {
if(pluginsObj.filter(ele => ele.enabled).length == 0) {
Expand All @@ -56,6 +56,16 @@ const commands = {
console.log('- '+ele.key)
});
},
showDisabledPlugins: function() {
if(pluginsObj.filter(ele => !ele.enabled).length == 0) {
console.log('- No disabled Plugin found.')
return;
}
pluginsObj.forEach(ele => {
if(!ele.enabled)
console.log('- '+ele.key)
});
},
showAllPlugins: function() {
if(pluginsObj.length == 0) {
console.log('- No Plugin in repo.')
Expand Down Expand Up @@ -139,6 +149,7 @@ const commands = {

program
.option('-sep, --showEnabledPlugins')
.option('-sep, --showDisabledPlugins')
.option('-sap, --showAllPlugins')
.option('-ep, --enablePlugins []')
.option('-dp, --disablePlugins []')
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"api-win": "del /f jans_config_api && openapi-generator-cli generate -i https://raw.githubusercontent.com/JanssenProject/jans-config-api/master/docs/jans-config-api-swagger.yaml -g javascript -o jans_config_api && cd jans_config_api && npm install && npm run build",
"plugin:showAll": "node ./build/plugin-cli.js --showAllPlugins",
"plugin:showEnabled": "node ./build/plugin-cli.js --showEnabledPlugins",
"plugin:showDisabled": "node ./build/plugin-cli.js --showDisabledPlugins",
"plugin:enable": "node ./build/plugin-cli.js --enablePlugins",
"plugin:disable": "node ./build/plugin-cli.js --disablePlugins",
"plugin:install": "node ./build/plugin-cli.js --installPlugin"
Expand Down

0 comments on commit 6cd185b

Please sign in to comment.