Skip to content

Commit 9e0d96c

Browse files
authored
Merge pull request #18 from PortalNetwork/dev
Add features
2 parents 73e021c + 26a64bd commit 9e0d96c

File tree

8 files changed

+276
-180
lines changed

8 files changed

+276
-180
lines changed

Diff for: .circleci/config.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/node:7.10
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/mongo:3.4.4
16+
17+
working_directory: ~/repo
18+
19+
steps:
20+
- checkout
21+
22+
# Download and cache dependencies
23+
- restore_cache:
24+
keys:
25+
- v1-dependencies-{{ checksum "package.json" }}
26+
# fallback to using the latest cache if no exact match is found
27+
- v1-dependencies-
28+
29+
- run: yarn install
30+
31+
- save_cache:
32+
paths:
33+
- node_modules
34+
key: v1-dependencies-{{ checksum "package.json" }}
35+
36+
# run tests!
37+
- run: yarn test

Diff for: kaizen

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const figlet = require('figlet');
66
const newDapp = require("./lib/NewDapp");
77
const {
88
add: pluginAdd,
9+
build: build,
910
} = require('./lib/plugin');
1011

1112
// to clear terminal screen
@@ -45,7 +46,7 @@ const argv = require('yargs')
4546
newDapp({ name, boilerplate });
4647
})
4748
.command('config', 'environment variables of dapps')
48-
.command('build', 'scripts used to pack dapp')
49+
// .command('build', 'scripts used to pack dapp')
4950
.command('plugin', 'list all the plugin to dapp')
5051
.command('plugin add [plugin-name]', pluginAdd.description, (yargs) => pluginAdd.yargs(yargs), (argv) => pluginAdd.argv(argv))
5152
.command('plugin:remove', 'remove an plugin to dapp', (yargs) => {
@@ -62,6 +63,9 @@ const argv = require('yargs')
6263
'kaizen publish '
6364
)
6465
})
66+
.command('build', 'build dapp package', (yargs) => {
67+
build.build(yargs);
68+
})
6569
.demandCommand(1, 'You need at least one command before moving on')
6670
.options({
6771
'v': {

Diff for: lib/NewDapp.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const cmd = require('node-cmd');
22
const fs = require("fs");
33
const del = require('del');
4-
const Log = require('../lib/Log');
4+
const Log = require('./plugin/Log');
55

66
module.exports = (argv) => {
77
let f2eFramework = '';

Diff for: lib/Log.js renamed to lib/plugin/Log.js

-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ module.exports = {
77
ErrorLog: (log) => {
88
Log(chalk.white.bgRed.bold(log));
99
}
10-
1110
}

Diff for: lib/plugin/build.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const cmd = require('node-cmd');
2+
const fs = require('fs');
3+
const Log = require('./Log');
4+
const ProgressBar = require('progress');
5+
exports.build = function (yargs) {
6+
let kaizenfile = "kaizen.json"
7+
if(!fs.existsSync(kaizenfile)) return Log.ErrorLog("Kaizen.json this file does not exist");
8+
let fsFile = fs.readFileSync(kaizenfile, 'utf-8');
9+
let settingtype = JSON.parse(fsFile);
10+
if(settingtype.issued !== 'PortalNetwork') return Log.ErrorLog("Kaizen.json profile error");
11+
Log.SuccessLog('==== Please wait in the build ====');
12+
13+
14+
const green = '\u001b[42m \u001b[0m';
15+
const red = '\u001b[41m \u001b[0m';
16+
const total = 40;
17+
let isLoad = false;
18+
const bar = new ProgressBar(' [:bar]', {
19+
complete: green,
20+
incomplete: red,
21+
total: total,
22+
});
23+
24+
let barLoad = setInterval(()=>{
25+
bar.tick();
26+
bar.curr += 1;
27+
if(bar.curr >= total){
28+
bar.curr = 0
29+
}
30+
if(isLoad){
31+
clearInterval(barLoad);
32+
Log.SuccessLog(`==== build carry out ====`);
33+
}
34+
}, 100);
35+
36+
cmd.get(`npm run build`, err =>{
37+
bar.curr = total;
38+
isLoad = true;
39+
if (err) return Log.ErrorLog(`[ERROR] build: ${err}`);
40+
});
41+
42+
}
43+

Diff for: lib/plugin/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
exports.add = require('./add.js');
1+
exports.add = require('./add.js');
2+
exports.build = require('./build.js');

0 commit comments

Comments
 (0)