mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +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
|
# Java
|
||||||
target
|
target
|
||||||
|
|
||||||
# Local config
|
# webpack output
|
||||||
/unleash-server/config/database.json
|
/unleash-server/public/js/bundle.js
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
@ -11,9 +11,7 @@
|
|||||||
"after" : false,
|
"after" : false,
|
||||||
"beforeEach": false,
|
"beforeEach": false,
|
||||||
"afterEach" : false,
|
"afterEach" : false,
|
||||||
"contain" : false,
|
"contain" : false
|
||||||
"React" : false,
|
|
||||||
"reqwest" : false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"bitwise" : true,
|
"bitwise" : true,
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
},
|
},
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"deploy": [
|
"deploy": [
|
||||||
{"command": "cd unleash-server && npm install"},
|
{"command": "cd unleash-server && npm install && npm test && npm run build"},
|
||||||
{"command": "cd unleash-server && npm test"},
|
|
||||||
{"command": "cd unleash-server && tar -cvzf unleash-server.tar.gz --exclude=unleash-server.tar.gz --exclude=.git *"},
|
{"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",
|
"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",
|
||||||
@ -36,8 +35,8 @@
|
|||||||
|
|
||||||
],
|
],
|
||||||
"default": [
|
"default": [
|
||||||
{"command": "cd unleash-server && npm install"},
|
{"command": "cd unleash-server && npm install && npm test"},
|
||||||
{"command": "cd unleash-server && npm test"}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server.js",
|
"start": "NODE_ENV=production node server.js",
|
||||||
"dev": "NODE_ENV=local supervisor --ignore ./node_modules/,./public/js 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",
|
"test": "jshint server.js lib test && jsxhint public/js/*.jsx && mocha test test/* && npm run coverage",
|
||||||
"tdd": "mocha --watch test test/*",
|
"tdd": "mocha --watch test test/*",
|
||||||
"test-bamboo-ci": "mocha test test/*",
|
"test-bamboo-ci": "mocha test test/*",
|
||||||
@ -44,12 +45,17 @@
|
|||||||
"coveralls": "^2.11.2",
|
"coveralls": "^2.11.2",
|
||||||
"istanbul": "0.3.2",
|
"istanbul": "0.3.2",
|
||||||
"jshint": "2.5.2",
|
"jshint": "2.5.2",
|
||||||
|
"jsx-loader": "^0.12.0",
|
||||||
"jsxhint": "0.4.15",
|
"jsxhint": "0.4.15",
|
||||||
"mocha": "1.20.1",
|
"mocha": "1.20.1",
|
||||||
"mocha-lcov-reporter": "0.0.1",
|
"mocha-lcov-reporter": "0.0.1",
|
||||||
"mockery": "1.4.0",
|
"mockery": "1.4.0",
|
||||||
|
"react": "^0.12.0",
|
||||||
|
"reqwest": "^1.1.4",
|
||||||
"supertest": "0.13.0",
|
"supertest": "0.13.0",
|
||||||
"supervisor": "0.6.0",
|
"supervisor": "0.6.0",
|
||||||
|
"webpack": "^1.4.9",
|
||||||
|
"webpack-dev-middleware": "^1.0.11",
|
||||||
"xmlbuilder": "2.4.4"
|
"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="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="css/unleash.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content">Loading...</div>
|
<div id="content">Loading...</div>
|
||||||
<script type="text/jsx" src="js/unleash.jsx"></script>
|
<script src="js/bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
/* jshint quotmark:false */
|
/* jshint quotmark:false */
|
||||||
|
|
||||||
|
var React = require('react');
|
||||||
|
var reqwest = require('reqwest');
|
||||||
|
|
||||||
// Unleash
|
// Unleash
|
||||||
// - Menu
|
// - Menu
|
||||||
// - FeatureList
|
// - FeatureList
|
||||||
@ -36,7 +39,7 @@ var Menu = React.createClass({
|
|||||||
render: function() { return (
|
render: function() { return (
|
||||||
<nav className='navbar navbar-default' role='navigation'>
|
<nav className='navbar navbar-default' role='navigation'>
|
||||||
<div className='container'>
|
<div className='container'>
|
||||||
<a className='navbar-brand' href='#'>Unleash</a>
|
<a className='navbar-brand' href='#'>unleash admin</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
|
@ -12,6 +12,14 @@ var express = require('express'),
|
|||||||
|
|
||||||
if(app.get('env') === 'development') {
|
if(app.get('env') === 'development') {
|
||||||
app.use(require('errorhandler')());
|
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([]));
|
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