Skip to content

Commit

Permalink
Merge pull request #193 from PhyrexTsai/master
Browse files Browse the repository at this point in the history
v0.0.52
  • Loading branch information
PhyrexTsai authored Oct 17, 2019
2 parents a8ec8ae + 004aac6 commit 73ec3f1
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ The KAIZEN Platform is currently in experimental alpha.
- [NKN](https://www.npmjs.com/package/nkn-client)
- [ICON](https://www.npmjs.com/package/icon-sdk-js)
- [Orbit](https://www.npmjs.com/package/orbit-db)
- [Arweave](https://www.npmjs.com/package/arweave)
- NOIA

## <a name="faucet"></a>🚰 Faucet
Expand Down
1 change: 1 addition & 0 deletions README_KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ The KAIZEN Platform is currently in experimental alpha.
- [NKN](https://www.npmjs.com/package/nkn-client)
- [ICON](https://www.npmjs.com/package/icon-sdk-js)
- [Orbit](https://www.npmjs.com/package/orbit-db)
- [Arweave](https://www.npmjs.com/package/arweave)
- NOIA

## <a name="faucet"></a>🚰 水龍頭
Expand Down
1 change: 1 addition & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ KAIZEN Platform 目前正在 Alpha 階段
- [NKN](https://www.npmjs.com/package/nkn-client)
- [ICON](https://www.npmjs.com/package/icon-sdk-js)
- [Orbit](https://www.npmjs.com/package/orbit-db)
- [Arweave](https://www.npmjs.com/package/arweave)
- NOIA

## <a name="faucet"></a>🚰 水龍頭
Expand Down
47 changes: 47 additions & 0 deletions build/components/Plugins/Install/arweave.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"use strict";

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var path = require('path');

var fsx = require('fs-extra');

var ExecuteCommand = require('../../../lib/ExecuteCommand');

module.exports =
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var configPath, userConfig;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return ExecuteCommand('npm install arweave');

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

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

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

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);

case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
3 changes: 2 additions & 1 deletion build/components/Plugins/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ function _handler() {
Log.NormalLog('noia'.underline.yellow + ' - NOIA information');
Log.NormalLog('icon'.underline.yellow + ' - ICON information');
Log.NormalLog('orbit'.underline.yellow + ' - Orbit information');
Log.NormalLog('arweave'.underline.yellow + ' - Arweave information');
Log.NormalLog("\nTo install a plugin run " + "'kaizen plugins install <plugin-name-here>'".yellow);
Log.NormalLog("\nIt will be automatically downloaded and added to your " + "'package.json'".yellow + " and " + "'kaizen.json'".yellow + " file\n");

case 8:
case 9:
case "end":
return _context.stop();
}
Expand Down
49 changes: 49 additions & 0 deletions build/components/Plugins/Uninstall/arweave.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"use strict";

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var path = require("path");

var fsx = require("fs-extra");

var ExecuteCommand = require('../../../lib/ExecuteCommand');

module.exports =
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var configPath, userConfig;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return ExecuteCommand('npm uninstall arweave');

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

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

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

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);

case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
2 changes: 1 addition & 1 deletion build/components/Plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function builder(yargs) {

require('./List')(yargs);

return yargs.example('kaizen plugins install').example('kaizen plugins uninstall').example('kaizen plugins list').demandCommand(1, '').epilogue('Available plugins:\n\n'.underline.yellow + 'bluzelle'.underline.yellow + ' - Decentralized database\n' + 'nkn'.underline.yellow + ' - Data transmisstion\n' + 'noia'.underline.yellow + ' - Decentralized CDN\n' + 'icon'.underline.yellow + ' - Blockchain\n' + 'orbit'.underline.yellow + ' - Decentralized database\n' + '\nRun ' + '\'kaizen plugins <command>\''.yellow + ' to interact with plugins.\n');
return yargs.example('kaizen plugins install').example('kaizen plugins uninstall').example('kaizen plugins list').demandCommand(1, '').epilogue('Available plugins:\n\n'.underline.yellow + 'bluzelle'.underline.yellow + ' - Decentralized database\n' + 'nkn'.underline.yellow + ' - Data transmisstion\n' + 'noia'.underline.yellow + ' - Decentralized CDN\n' + 'icon'.underline.yellow + ' - Blockchain\n' + 'orbit'.underline.yellow + ' - Decentralized database\n' + 'arweave'.underline.yellow + ' -Decentralized file storage\n' + '\nRun ' + '\'kaizen plugins <command>\''.yellow + ' to interact with plugins.\n');
}

function handler(_x) {
Expand Down
3 changes: 3 additions & 0 deletions commands/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ nkn - Data transmisstion
noia - Decentralized CDN
icon - Blockchain
orbit - Decentralized database
arweave - Decentralized file storage
Run 'kaizen plugins <command>' to interact with plugins.
```
Expand All @@ -50,6 +51,7 @@ nkn - NKN information
noia - NOIA information
icon - ICON information
orbit - Orbit information
arweave - Decentralized file storage
To install a plugin run 'kaizen plugins install <plugin-name-here>'
Expand Down Expand Up @@ -88,4 +90,5 @@ Options:
Examples:
kaizen plugins uninstall bluzelle
kaizen plugins uninstall nkn
kaizen plugins uninstall arweave
```
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kaizen-cli",
"version": "0.0.51",
"version": "0.0.52",
"bin": {
"kaizen": "kaizen"
},
Expand Down
21 changes: 21 additions & 0 deletions src/components/Plugins/Install/arweave.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require('path');
const fsx = require('fs-extra');
const ExecuteCommand = require('../../../lib/ExecuteCommand');

module.exports = async function() {
await ExecuteCommand('npm install arweave');

// 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('arweave') === false) {
userConfig.plugins.push('arweave');
}

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);
}
1 change: 1 addition & 0 deletions src/components/Plugins/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ async function handler(argv) {
Log.NormalLog('noia'.underline.yellow + ' - NOIA information');
Log.NormalLog('icon'.underline.yellow + ' - ICON information');
Log.NormalLog('orbit'.underline.yellow + ' - Orbit information');
Log.NormalLog('arweave'.underline.yellow + ' - Arweave information');

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

Expand Down
23 changes: 23 additions & 0 deletions src/components/Plugins/Uninstall/arweave.js
Original file line number Diff line number Diff line change
@@ -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 uninstall arweave');

// 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('arweave') === false) {
userConfig.plugins = userConfig.plugins.filter(function(element) {
return element != 'arweave';
});
}

fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);
}
1 change: 1 addition & 0 deletions src/components/Plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function builder(yargs) {
'noia'.underline.yellow + ' - Decentralized CDN\n' +
'icon'.underline.yellow + ' - Blockchain\n' +
'orbit'.underline.yellow + ' - Decentralized database\n' +
'arweave'.underline.yellow + ' -Decentralized file storage\n' +
'\nRun ' + '\'kaizen plugins <command>\''.yellow +
' to interact with plugins.\n'
);
Expand Down

0 comments on commit 73ec3f1

Please sign in to comment.