mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
Use webpack to build JS/JSX resources. Closes #25.
This commit is contained in:
parent
6c7734be4f
commit
21eb8e7f85
4
.gitignore
vendored
4
.gitignore
vendored
@ -34,7 +34,7 @@ node_modules
|
||||
# Java
|
||||
target
|
||||
|
||||
# Local config
|
||||
/unleash-server/config/database.json
|
||||
# webpack output
|
||||
/unleash-server/public/js/bundle.js
|
||||
|
||||
.DS_Store
|
@ -11,9 +11,7 @@
|
||||
"after" : false,
|
||||
"beforeEach": false,
|
||||
"afterEach" : false,
|
||||
"contain" : false,
|
||||
"React" : false,
|
||||
"reqwest" : false
|
||||
"contain" : false
|
||||
},
|
||||
|
||||
"bitwise" : true,
|
||||
|
@ -9,8 +9,7 @@
|
||||
},
|
||||
"tasks": {
|
||||
"deploy": [
|
||||
{"command": "cd unleash-server && npm install"},
|
||||
{"command": "cd unleash-server && npm test"},
|
||||
{"command": "cd unleash-server && npm install && npm test && npm run build"},
|
||||
{"command": "cd unleash-server && tar -cvzf unleash-server.tar.gz --exclude=unleash-server.tar.gz --exclude=.git *"},
|
||||
{
|
||||
"command": "cd unleash-server && mvn deploy:deploy-file -Durl=http://mavenproxy.finntech.no/finntech-internal-snapshot/ -DrepositoryId=finntech-internal-snapshot -Dfile=unleash-server.tar.gz -DgroupId=no.finntech.unleash -DartifactId=unleash-server -Dversion=0.1337-SNAPSHOT -Dpackaging=tar.gz",
|
||||
@ -33,11 +32,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
],
|
||||
"default": [
|
||||
{"command": "cd unleash-server && npm install"},
|
||||
{"command": "cd unleash-server && npm test"}
|
||||
{"command": "cd unleash-server && npm install && npm test"},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,9 @@
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node server.js",
|
||||
"dev": "NODE_ENV=local supervisor --ignore ./node_modules/,./public/js server.js",
|
||||
"start": "NODE_ENV=production node server.js",
|
||||
"build": "./node_modules/.bin/webpack",
|
||||
"dev": "NODE_ENV=development supervisor --ignore ./node_modules/,./public/js server.js",
|
||||
"test": "jshint server.js lib test && jsxhint public/js/*.jsx && mocha test test/* && npm run coverage",
|
||||
"tdd": "mocha --watch test test/*",
|
||||
"test-bamboo-ci": "mocha test test/*",
|
||||
@ -44,12 +45,17 @@
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "0.3.2",
|
||||
"jshint": "2.5.2",
|
||||
"jsx-loader": "^0.12.0",
|
||||
"jsxhint": "0.4.15",
|
||||
"mocha": "1.20.1",
|
||||
"mocha-lcov-reporter": "0.0.1",
|
||||
"mockery": "1.4.0",
|
||||
"react": "^0.12.0",
|
||||
"reqwest": "^1.1.4",
|
||||
"supertest": "0.13.0",
|
||||
"supervisor": "0.6.0",
|
||||
"webpack": "^1.4.9",
|
||||
"webpack-dev-middleware": "^1.0.11",
|
||||
"xmlbuilder": "2.4.4"
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,9 @@
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/unleash.css">
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.12.0/react.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.12.0/JSXTransformer.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/reqwest/1.1.4/reqwest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">Loading...</div>
|
||||
<script type="text/jsx" src="js/unleash.jsx"></script>
|
||||
<script src="js/bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,5 +1,8 @@
|
||||
/* jshint quotmark:false */
|
||||
|
||||
var React = require('react');
|
||||
var reqwest = require('reqwest');
|
||||
|
||||
// Unleash
|
||||
// - Menu
|
||||
// - FeatureList
|
||||
@ -36,7 +39,7 @@ var Menu = React.createClass({
|
||||
render: function() { return (
|
||||
<nav className='navbar navbar-default' role='navigation'>
|
||||
<div className='container'>
|
||||
<a className='navbar-brand' href='#'>Unleash</a>
|
||||
<a className='navbar-brand' href='#'>unleash admin</a>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
|
@ -12,6 +12,14 @@ var express = require('express'),
|
||||
|
||||
if(app.get('env') === 'development') {
|
||||
app.use(require('errorhandler')());
|
||||
|
||||
var webpack = require('webpack'),
|
||||
webpackDevMiddleware = require('webpack-dev-middleware'),
|
||||
webpackConfig = require('./webpack.config'),
|
||||
compiler = webpack(webpackConfig),
|
||||
config = { publicPath: '/js' };
|
||||
|
||||
app.use(baseUriPath, webpackDevMiddleware(compiler, config));
|
||||
}
|
||||
|
||||
app.use(validator([]));
|
||||
|
28
unleash-server/webpack.config.js
Normal file
28
unleash-server/webpack.config.js
Normal file
@ -0,0 +1,28 @@
|
||||
// docs: http://webpack.github.io/docs/configuration.html
|
||||
|
||||
module.exports = {
|
||||
|
||||
context: __dirname + '/public',
|
||||
entry: './js/unleash',
|
||||
|
||||
output: {
|
||||
path: __dirname + '/public/js',
|
||||
filename: 'bundle.js',
|
||||
publicPath: '/js/'
|
||||
},
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx']
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.jsx$/, loader: 'jsx' }
|
||||
]
|
||||
},
|
||||
|
||||
externals: {
|
||||
// stuff not in node_modules can be resolved here.
|
||||
}
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user