Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.

Commit 5687071

Browse files
committed
[BA-794] Feature: Bundle app
1 parent dd469d9 commit 5687071

5 files changed

Lines changed: 46 additions & 3 deletions

File tree

ui/contracts/MasterContract.sol

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
contract MasterContract {
2+
uint public storedData;
3+
4+
function MasterContract() {
5+
storedData = 2;
6+
}
7+
8+
function setToFour(){
9+
storedData = 4;
10+
}
11+
}

ui/initfile.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"masterContract": {
3+
"contractName": "MasterContract",
4+
"contractFilename": "contracts/MasterContract.sol",
5+
"args": {}
6+
}
7+
}

ui/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "ui",
3+
"author": "BlockApps Inc",
34
"version": "0.1.0",
45
"private": true,
56
"dependencies": {
@@ -22,7 +23,8 @@
2223
"devDependencies": {
2324
"node-sass": "^4.5.2",
2425
"npm-run-all": "^4.0.2",
25-
"react-scripts": "0.9.5"
26+
"react-scripts": "0.9.5",
27+
"read-package-json": "^2.0.13"
2628
},
2729
"scripts": {
2830
"build-css": "node-sass src/ -o src/",
@@ -32,8 +34,8 @@
3234
"start:back": "npm-run-all -p watch-css start-js > stdout.text 2> stderr.txt &",
3335
"start-js-windows": "react-scripts start",
3436
"start-windows": "npm-run-all -p watch-css start-js-windows",
35-
"build": "npm run build-css && react-scripts build",
37+
"build": "npm run build-css && react-scripts build && cp initfile.json ./build && node scripts/create-metadata.js && cp -a contracts ./build && cd build && zip -r app.zip *",
3638
"test": "react-scripts test --env=jsdom",
3739
"eject": "react-scripts eject"
3840
}
39-
}
41+
}

ui/public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
77
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
88
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
9+
<script src="addresses.js"></script>
910
<!--
1011
Notice the use of %PUBLIC_URL% in the tag above.
1112
It will be replaced with the URL of the `public` folder during the build.

ui/scripts/create-metadata.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const readJson = require('read-package-json');
2+
const fs = require('fs');
3+
4+
readJson('package.json', (err, data) => {
5+
if (err) {
6+
console.log('Could not read package.json', err);
7+
return;
8+
}
9+
10+
const metadata = {
11+
name: data.name,
12+
description: data.description,
13+
maintainer: data.author.name,
14+
version: data.version,
15+
};
16+
17+
fs.writeFile('build/metadata.json',JSON.stringify(metadata,null,2), 'utf8', (err) => {
18+
if(err) {
19+
console.log('Failed to write metadata.json', err);
20+
}
21+
});
22+
});

0 commit comments

Comments
 (0)