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 6cd185b commit 8e60c0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions build/plugin-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const fse = require('fs-extra');
const config = require('./../config');
const pluginsObj = require('../plugins.config');
const path = require('path');
const unzipper = require('unzipper');

function dirParamToPath(dirParam) {
switch(dirParam) {
Expand Down Expand Up @@ -129,9 +130,9 @@ const commands = {
}
var lastFolder = sourcePath.split('/').filter(function(el) {
return el.trim().length > 0;
}).pop();
}).pop().split('.').slice(0, -1).join('.');

fse.copySync(sourcePath, path.join(pluginsRepoPath, lastFolder))
fse.createReadStream(sourcePath).pipe(unzipper.Extract({ path: pluginsRepoPath }));

pluginsObj.push(this.createPluginEntry(lastFolder));
fse.writeFileSync(path.join(dirParamToPath('rootDir'), 'plugins.config.json'),JSON.stringify(pluginsObj, null, 2))
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"text-mask-addons": "^3.8.0",
"unzipper": "^0.10.11",
"use-dark-mode": "^2.3.1",
"uuid": "^3.3.2",
"webpack-flush-chunks": "^2.0.3",
Expand Down

0 comments on commit 8e60c0e

Please sign in to comment.