-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from PortalNetwork/dev
Release 0.0.7
- Loading branch information
Showing
22 changed files
with
1,616 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules | |
vue-mike | ||
react-mike | ||
docs/_build | ||
.DS_Store | ||
.DS_Store | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"issued": "PortalNetwork", | ||
"provider": { | ||
"host": "ipfs.infura.io", | ||
"port": 5001, | ||
"protocol": "https" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Welcome to KAIZEN's documentation! | |
|
||
introduction | ||
quickstart | ||
tutorial | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,79 @@ | ||
********** | ||
KAIZEN | ||
********** | ||
====== | ||
KAIZEN CLI | ||
====== | ||
|
||
**$ kaizen new** | ||
---------------- | ||
``kaizen new`` | ||
---------------- | ||
|
||
**To create the epic web3 integration project which is made by Portal Network** | ||
To create the epic web3 integration project which is made by Portal Network** | ||
|
||
**Parameters:** | ||
|
||
-n [project-name]: this parameter is required. | ||
__ | ||
|
||
-b [vue|react]: choose the front-end library you want, default is vue. | ||
|
||
-b [vue|react]: choose the front-end boilerplate you want, default is vue. | ||
|
||
**Output:** | ||
|
||
.. image:: https://user-images.githubusercontent.com/11625554/45541442-b42c7e80-b841-11e8-9c8a-218aff41ed45.png | ||
|
||
-------------------------- | ||
``kaizen plugin add noia`` | ||
-------------------------- | ||
|
||
**$ kaizen plugin** | ||
|
||
**To install plugin via kaizen** | ||
To install NOIA SDK plugin via kaizen in project, this project should be used `kaizen new` to created | ||
|
||
**Parameters:** | ||
|
||
add noia: kaizen will install NOIA SDK for you in your project. the project should be used `kaizen new` to created | ||
|
||
no parameter required | ||
**Output:** | ||
|
||
.. image:: https://user-images.githubusercontent.com/11625554/45541315-5dbf4000-b841-11e8-9f0c-35b1674aed99.png | ||
|
||
|
||
|
||
------------------------------ | ||
``kaizen plugin add bluzelle`` | ||
------------------------------ | ||
|
||
To install Bluzelle SDK via kaizen in project, this project should be used `kaizen new` to created | ||
|
||
**Parameters** | ||
|
||
-b [vue|react]: choose the front-end boilerplate you want, default is vue. | ||
|
||
**Usage** | ||
- react | ||
|
||
In react, bluzelle's sdk will wrapped and pass down through component property. | ||
|
||
.. image:: https://user-images.githubusercontent.com/11625554/45680786-6fb91f80-bb6e-11e8-82f9-6dd4de9352fc.png | ||
|
||
- vue | ||
|
||
In vue, bluzelle's sdk were wrapped into an object. Once you initialize bluzelle, it will be returned. | ||
Yout can use object spread syntax to replace them into your components, or just use them like a normal object. | ||
|
||
.. image:: https://user-images.githubusercontent.com/11625554/45738864-17445980-bc24-11e8-912b-eedf4a97b3c6.png | ||
|
||
---------------- | ||
``kaizen build`` | ||
---------------- | ||
|
||
To build the kaizen's dapp, and the built code will be output into the build folder | ||
|
||
--------------- | ||
``kaizen init`` | ||
--------------- | ||
|
||
To setup the configuration you need, like IPFS provider. | ||
|
||
---------------- | ||
``kaizen publish`` | ||
---------------- | ||
|
||
To upload your dapp to the IPFS. You shall execute `kaizen build` before publish | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exports.init = require('./init.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const Log = require('../Log'); | ||
const KAIZEN_CONFIG_FILE = "kaizen.json"; | ||
|
||
exports.description = 'initialize kaizen environment'; | ||
|
||
exports.yargs = function(yargs) { | ||
yargs.example('kaizen init'); | ||
} | ||
|
||
exports.argv = function (argv) { | ||
const targetPath = path.resolve('./', KAIZEN_CONFIG_FILE); | ||
|
||
if(fs.existsSync(targetPath) === false) { | ||
console.error('[ERROR]: please use kaizen new to create new project first.'); | ||
return; | ||
} | ||
|
||
const sourcePath = path.resolve(__dirname, '../../config/', KAIZEN_CONFIG_FILE); | ||
const sourceConfig = JSON.parse(fs.readFileSync(sourcePath)); | ||
const targetConfig = JSON.parse(fs.readFileSync(targetPath)); | ||
const newConfig = Object.assign({}, targetConfig, sourceConfig); | ||
fs.writeFileSync(targetPath, JSON.stringify(newConfig)); | ||
Log.SuccessLog("complete initialization"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exports.publish = require('./publish.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const Log = require('../Log'); | ||
const ipfsAPI = require('ipfs-api'); | ||
const JSONFile = require('jsonfile'); | ||
const openBrowser = require('opn'); | ||
const BuildPath = 'build'; | ||
const kaizenfile = "kaizen.json"; | ||
|
||
function fsExistsSync() { | ||
try { | ||
fs.accessSync(BuildPath, fs.constants.R_OK | fs.constants.W_OK); | ||
return true; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
function loopFilesInFolder(path, files) { | ||
const readdirSyncs = fs.readdirSync(path); | ||
readdirSyncs.forEach(item => { | ||
if (item.includes('.DS_Store')) return; | ||
switch (fs.statSync(`${path}/${item}`).isDirectory()) { | ||
case true: | ||
files = loopFilesInFolder(`${path}/${item}`, files); | ||
break; | ||
case false: | ||
files.push(`${path}/${item}`); | ||
break | ||
} | ||
}); | ||
|
||
return files; | ||
} | ||
|
||
function getIPFSContentObject(filePath, targetPath) { | ||
return ({ | ||
path: `public${filePath.replace(targetPath, '')}`, | ||
content: fs.readFileSync(filePath) | ||
}); | ||
} | ||
|
||
exports.description = 'publish you app to the IPFS'; | ||
|
||
exports.yargs = function (yargs) { | ||
if (!fsExistsSync()) { | ||
Log.ErrorLog("Build This folder does not exist"); | ||
} | ||
|
||
const targetPath = `${path.resolve('./', BuildPath)}`; | ||
|
||
try { | ||
(async function(yargs, targetPath) { | ||
const kaizenConfig = await JSONFile.readFile(kaizenfile) | ||
const ipfs = ipfsAPI(kaizenConfig.provider); | ||
console.log('=== uploading to the IPFS ===') | ||
const files = loopFilesInFolder(targetPath, []).map(item => getIPFSContentObject(item, targetPath)); | ||
const hashes = await ipfs.files.add(files, { recursive: false }); | ||
const { hash, } = hashes[hashes.length - 1]; | ||
const iphsUrl = `https://ipfs.infura.io/ipfs/${hash}`; | ||
openBrowser(iphsUrl); | ||
Log.SuccessLog(`ipfs url => ${iphsUrl}`) | ||
process.exit(); | ||
})(yargs, targetPath); | ||
} catch (err) { | ||
Log.ErrorLog(err) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exports.create = require('./create.js'); |
Oops, something went wrong.