Skip to content

Commit

Permalink
Merge pull request #214 from PhyrexTsai/master
Browse files Browse the repository at this point in the history
v0.1.20
  • Loading branch information
PhyrexTsai committed Jan 7, 2020
2 parents 1f10fd8 + cdd83ec commit 4f7dda7
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "kaizen-cli",
"version": "0.1.19",
"version": "0.1.20",
"bin": {
"kaizen": "kaizen"
},
Expand Down
8 changes: 8 additions & 0 deletions src/components/Plugins/Install/index.js
Expand Up @@ -15,6 +15,7 @@ const nearHandler = require('./near.js');
const tellorHandler = require('./tellor.js');
const skaleHandler = require('./skale.js');
const renHandler = require('./ren.js');
const nervosHandler = require('./nervos.js');

function builder(yargs) {
return yargs
Expand Down Expand Up @@ -136,6 +137,13 @@ async function handler(argv) {
Spinner.stop();
Log.SuccessLog(`Install plugin ${plugin} Successfully`);
break;
case 'nervos':
Log.NormalLog('Installing plugin, please wait a second...');
Spinner.start();
await nervosHandler();
Spinner.stop();
Log.SuccessLog(`Install plugin ${plugin} Successfully`);
break;
default:
Log.NormalLog('Plugin not support yet');
}
Expand Down
23 changes: 23 additions & 0 deletions src/components/Plugins/Install/nervos.js
@@ -0,0 +1,23 @@
const path = require('path');
const fsx = require('fs-extra');
const ExecuteCommand = require('../../../lib/ExecuteCommand');

module.exports = async function() {
await ExecuteCommand('npm install @nervosnetwork/ckb-sdk-core');
await ExecuteCommand('npm install @nervosnetwork/ckb-sdk-rpc');
await ExecuteCommand('npm install @nervosnetwork/ckb-sdk-utils');

// update user's kaizen config
const configPath = path.resolve('./', 'kaizen.json');
const userConfig = fsx.existsSync(configPath) ? fsx.readJsonSync(configPath) : {};

if(!userConfig.plugins) {
userConfig.plugins = [];
}

if(userConfig.plugins.includes('nervos') === false) {
userConfig.plugins.push('nervos');
}

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);
}
1 change: 1 addition & 0 deletions src/components/Plugins/List/index.js
Expand Up @@ -20,6 +20,7 @@ async function handler(argv) {
Log.NormalLog('tellor'.underline.yellow + ' - Tellor information');
Log.NormalLog('skale'.underline.yellow + ' - Skale information');
Log.NormalLog('ren'.underline.yellow + ' - Ren information');
Log.NormalLog('nervos'.underline.yellow + ' - Nervos information');

Log.NormalLog("\nTo install a plugin run " + "'kaizen plugins install <plugin-name-here>'".yellow)

Expand Down
9 changes: 9 additions & 0 deletions src/components/Plugins/Uninstall/index.js
Expand Up @@ -16,6 +16,7 @@ const nearHandler = require('./near.js');
const tellorHandler = require('./tellor.js');
const skaleHandler = require('./skale.js');
const renHandler = require('./ren.js');
const nervosHandler = require('./nervos.js');

function builder(yargs) {
return yargs
Expand Down Expand Up @@ -150,6 +151,14 @@ async function handler(argv) {
Spinner.stop();
Log.SuccessLog(`Remove plugin ${plugin} Successfully`);
break;
case 'nervos':
Log.NormalLog('Uninstalling plugin, please wait a second...');
Spinner.start();
await nervosHandler();
updateKaizenJson(kaizenJson, 'nervos');
Spinner.stop();
Log.SuccessLog(`Remove plugin ${plugin} Successfully`);
break;
default:
Log.NormalLog('Plugin not support yet');
}
Expand Down
25 changes: 25 additions & 0 deletions src/components/Plugins/Uninstall/nervos.js
@@ -0,0 +1,25 @@
const path = require("path");
const fsx = require("fs-extra");
const ExecuteCommand = require("../../../lib/ExecuteCommand");

module.exports = async function () {
await ExecuteCommand("npm uninstall @nervosnetwork/ckb-sdk-core");
await ExecuteCommand("npm uninstall @nervosnetwork/ckb-sdk-rpc");
await ExecuteCommand("npm uninstall @nervosnetwork/ckb-sdk-utils");

// update user's kaizen config
const configPath = path.resolve('./', 'kaizen.json');
const userConfig = fsx.existsSync(configPath) ? fsx.readJsonSync(configPath) : {};

if(!userConfig.plugins) {
userConfig.plugins = [];
}

if(userConfig.plugins.includes('nervos') === false) {
userConfig.plugins = userConfig.plugins.filter(function(element) {
return element != 'nervos';
});
}

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);
};
1 change: 1 addition & 0 deletions src/components/Plugins/index.js
Expand Up @@ -23,6 +23,7 @@ function builder(yargs) {
'tellor'.underline.yellow + ' - Decentralized oracle service\n' +
'skale'.underline.yellow + ' - Elastic blockchain network\n' +
'ren'.underline.yellow + ' - Inter-blockchain liquidity for all decentralized applications\n' +
'nervos'.underline.yellow + ' - Multi-asset, store of value blockchain\n' +
'\nRun ' + '\'kaizen plugins <command>\''.yellow +
' to interact with plugins.\n'
);
Expand Down

0 comments on commit 4f7dda7

Please sign in to comment.