Skip to content

Commit

Permalink
add package task
Browse files Browse the repository at this point in the history
  • Loading branch information
kyohei8 committed May 17, 2017
1 parent a757b1f commit 903be84
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
npm-debug.log
app/dist
dist
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ $ npm i
```bash
$ npm run dev
```

## Build

```bash
$ npm run dist
```
Binary file added build/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/icon.icns
Binary file not shown.
Binary file added build/icons/icon.ico
Binary file not shown.
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"name": "ethereum-controller",
"description": "ethereum controller",
"version": "0.1.0",
"author": {
"name": "Kyohei Tsukuda",
"email": "tsukuda.kyouhei@gmail.com",
"url": "https://github.com/kyohei8"
},
"main": "main.js",
"scripts": {
"start": "electron .",
"start-electron-dev": "cross-env HOT=1 NODE_ENV=development electron .",
"dev": "concurrently --kill-others \"webpack-dev-server\" \"npm run start-electron-dev\""
"dev": "concurrently --kill-others \"webpack-dev-server\" \"npm run start-electron-dev\"",
"predist": "rm -rf dist/* && rm -rf app/dist/* && NODE_ENV=prod webpack -p",
"dist": "build"
},
"build": {
"appId": "com.lol.ethereum.controller"
},
"devDependencies": {
"babel-core": "^6.24.1",
Expand All @@ -19,6 +30,7 @@
"css-loader": "^0.28.1",
"doiuse": "^2.6.0",
"electron": "^1.6.6",
"electron-builder": "^17.8.0",
"electron-reload": "^1.1.0",
"ethereumjs-account": "^2.0.4",
"ethereumjs-block": "^1.4.1",
Expand Down
26 changes: 22 additions & 4 deletions renderer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
<title>Ethrcon</title>
<link rel="stylesheet" href="../node_modules/sanitize.css/sanitize.css" type="text/css" media="all" />
<link rel="stylesheet" href="../node_modules/milligram/dist/milligram.min.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://127.0.0.1:8080/assets/app.css" type="text/css" media="all"/>
<script>
(function() {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = process.env.HOT ? 'http://127.0.0.1:8080/assets/app.css' : '../app/dist/app.css';
// HACK: Writing the script path should be done with webpack
document.getElementsByTagName('head')[0].appendChild(link);
}());
</script>
<script src="https://www.gstatic.com/firebasejs/3.7.2/firebase.js"></script>
</head>
<body>
Expand All @@ -16,10 +24,20 @@
-->
<div id="app"></div>
</body>


<script>
window.ipcRenderer = require('electron').ipcRenderer;
{
const scripts = [];
scripts.push(
(process.env.HOT)
? 'http://127.0.0.1:8080/assets/app.bundle.js'
: '../app/dist/app.bundle.js'
);
document.write(
scripts
.map(script => '<script defer src="' + script + '"><\/script>')
.join('')
);
}
</script>
<script src="http://127.0.0.1:8080/assets/app.bundle.js"></script>
</html>
8 changes: 4 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ module.exports = {
}],
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: [
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'postcss-loader'
]
Expand All @@ -95,7 +95,7 @@ module.exports = {
]
},
output: {
path: path.resolve(__dirname, './dist'),
path: path.resolve(__dirname, './app/dist'),
filename: '[name].bundle.js',
publicPath: '/assets'
},
Expand Down

0 comments on commit 903be84

Please sign in to comment.