Skip to content

Commit b74b7e0

Browse files
committedJun 3, 2015
Merge pull request #59 from ipfs/hot-reload
hot-reload without webpack
2 parents ba05a29 + 71dc2ac commit b74b7e0

11 files changed

+97
-286
lines changed
 

‎Makefile

+3-13
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@ clean:
77
rm -rf build
88
rm -rf publish
99

10-
serve: $(webpack)
11-
node dev
12-
13-
build: build/bundle.min.js
14-
15-
build/bundle.min.js: $(webpack)
16-
$(webpack)
17-
cp -r static build/static
18-
cp html/index.html build
19-
20-
$(webpack):
21-
npm install
10+
serve:
11+
node_modules/.bin/bygg serve
2212

2313
publish: clean
2414
npm install
2515
mkdir publish
2616
cp -r static publish
2717
cp -r html/index.html publish
28-
node_modules/.bin/browserify --ignore='less/bundle.less' -t reactify . > publish/bundle.js
18+
node_modules/.bin/browserify -t reactify . > publish/bundle.js
2919
node_modules/.bin/lessc less/bundle.less > publish/style.css
3020
ipfs add -r -q publish | tail -n1 >versions/current
3121

‎byggfile.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* global require, process */
2+
'use strict'
3+
4+
var bygg = require('bygg')
5+
6+
var browserify = require('bygg-plugins-light/browserify')
7+
var less = require('bygg-plugins-light/less')
8+
var serve = require('bygg-plugins-light/serve')
9+
var stats = require('bygg-plugins-light/stats')
10+
var rename = require('bygg-plugins-light/rename')
11+
var proxy = require('proxy-middleware')
12+
var url = require('url')
13+
14+
bygg.task('serve', function () {
15+
return build()
16+
.pipe(bygg.write('build/'))
17+
.pipe(serve(3000, function (app) {
18+
var opts = url.parse('http://localhost:5001/api')
19+
return app
20+
.use('/api', proxy(opts))
21+
}))
22+
})
23+
24+
bygg.task('build', function () {
25+
return build()
26+
.pipe(bygg.write('build/'))
27+
.pipe(stats())
28+
})
29+
30+
var build = function (optimize) {
31+
var html = bygg
32+
.files('html/index.html')
33+
.pipe(rename('html/index.html', 'index.html'))
34+
35+
var assets = bygg
36+
.files('static/*/*')
37+
38+
var styles = bygg
39+
.files('less/bundle.less')
40+
.pipe(less())
41+
.pipe(rename('less/bundle.css', 'style.css'))
42+
43+
var scripts = bygg
44+
.files('js/main.jsx')
45+
.pipe(browserify({
46+
dest: 'bundle.js',
47+
extensions: ['.js', '.jsx'],
48+
configure: function (b) {
49+
b.transform('6to5ify')
50+
}
51+
}))
52+
.pipe(rename('js/main.js', 'bundle.js'))
53+
54+
return bygg.combine(
55+
html,
56+
assets,
57+
styles,
58+
scripts
59+
)
60+
}

‎dev.js

-45
This file was deleted.

‎index.js

-27
This file was deleted.

‎js/include/Detector.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author mr.doob / http://mrdoob.com/
44
*/
55

6-
Detector = {
6+
var Detector = {
77

88
canvas : !! window.CanvasRenderingContext2D,
99
webgl : ( function () { try { return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); } catch( e ) { return false; } } )(),

‎js/views/page.jsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
var React = require('react')
22
var Nav = require('./nav.jsx')
33
var RouteHandler = require('react-router').RouteHandler
4-
var LocalStorage = require('../utils/localStorage')
54
var Link = require('react-router').Link
65
var $ = require('jquery')
76

87
var host = window.location.hostname
98
var port = window.location.port || 80
10-
var daemonConf = LocalStorage.get('daemon')
11-
if (daemonConf) {
12-
host = daemonConf.host
13-
port = daemonConf.port
14-
}
9+
1510
var ipfs = require('ipfs-api')(host, port)
1611
var ipfsHost = window.location.host
1712

‎less/bundle.less

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
@import "../node_modules/bootstrap/less/bootstrap.less";
2-
@import "base.less";
3-
@import "../node_modules/font-awesome/less/font-awesome.less";
1+
/* use paths from root folder */
2+
@import "node_modules/bootstrap/less/bootstrap.less";
3+
@import "less/base.less";
4+
@import "node_modules/font-awesome/less/font-awesome.less";
45
@fa-font-path: "static/fonts";
56

67
p {

‎nw-package.json

-22
This file was deleted.

‎package.json

+28-41
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,37 @@
11
{
22
"name": "ipfs-webui",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "A frontend for IPFS",
55
"main": "js/main.jsx",
66
"dependencies": {
7-
"bootstrap": "^3.3.4",
8-
"d3": "^3.5.5",
9-
"debug": "^2.1.3",
10-
"font-awesome": "^4.3.0",
11-
"font-awesome-webpack": "0.0.3",
12-
"ipfs-api": "^1.1.4",
13-
"ipfs-geoip": "^1.4.3",
14-
"jquery": "^2.1.3",
15-
"lodash": "^3.6.0",
16-
"react": "^0.13.1",
17-
"react-async": "^2.1.0",
18-
"react-bootstrap": "^0.20.1",
19-
"react-localstorage": "^0.2.2",
20-
"react-router": "^0.13.2",
21-
"three": "^0.66.0"
7+
"bootstrap": "3.3.4",
8+
"d3": "3.5.5",
9+
"debug": "2.1.3",
10+
"font-awesome": "4.3.0",
11+
"ipfs-api": "1.1.4",
12+
"ipfs-geoip": "1.4.3",
13+
"jquery": "2.1.3",
14+
"lodash": "3.6.0",
15+
"react": "0.13.1",
16+
"react-async": "2.1.0",
17+
"react-bootstrap": "0.20.1",
18+
"react-localstorage": "0.2.2",
19+
"react-router": "0.13.2",
20+
"three": "0.66.0"
2221
},
2322
"devDependencies": {
24-
"babel-core": "^5.0.8",
25-
"babel-loader": "^5.0.0",
26-
"brfs": "^1.4.0",
27-
"browserify": "^10.2.3",
28-
"css-loader": "^0.9.1",
29-
"exports-loader": "^0.6.2",
30-
"expose-loader": "^0.6.0",
31-
"express": "^4.12.3",
32-
"file-loader": "^0.8.1",
33-
"imports-loader": "^0.6.3",
34-
"ipfs-node-server-static": "^1.1.2",
35-
"less": "^2.5.0",
36-
"less-loader": "^2.2.0",
37-
"node-webkit-builder": "^1.0.11",
38-
"openurl": "^1.1.0",
39-
"pre-commit": "^1.0.6",
40-
"raw-loader": "^0.5.1",
41-
"react-hot-loader": "^1.2.4",
42-
"reactify": "^1.1.1",
43-
"standard": "^3.3.2",
44-
"style-loader": "^0.9.0",
45-
"transform-loader": "^0.2.1",
46-
"url-loader": "^0.5.5",
47-
"webpack": "^1.7.3",
48-
"webpack-dev-server": "^1.8.0"
23+
"6to5ify": "4.1.1",
24+
"babel": "5.4.7",
25+
"babel-core": "5.0.8",
26+
"brfs": "1.4.0",
27+
"browserify": "10.2.3",
28+
"bygg": "1.0.6",
29+
"bygg-plugins-light": "1.0.3",
30+
"less": "2.5.0",
31+
"pre-commit": "1.0.6",
32+
"proxy-middleware": "^0.12.0",
33+
"reactify": "1.1.1",
34+
"standard": "3.3.2"
4935
},
5036
"scripts": {
5137
"test": "echo \"Error: no test specified\" && exit 1",
@@ -54,6 +40,7 @@
5440
},
5541
"standard": {
5642
"ignore": [
43+
"versions",
5744
"js/include"
5845
]
5946
},

‎webpack-dev-server.config.js

-72
This file was deleted.

‎webpack.config.js

-56
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.