mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Refactor UI Build System (#3203)
* initial build trial, clean up awx/ui * fix hardcoded refs to ng-toast, add jshint preloader * remove browserify test * update grunt-jshint -> jshint module loader, browser-sync, update dev targets to build-docker-machine & build-docker-cid, fix blocking tasks * less autoprefixer * sample build commands * fix release build * update README * karma config stub * webpack config for karma tests * karma preview for shane * fix build-docker-machine target * karma+webpack test pipeline configuration, stub tests * fix smart/job status icons classes * fix jquery + jsyaml shims, fix LESS cascade * fix angular-codemirror dependency, explicitly import style/mode dependencies * shim jsonlint * fix angular-scheduler AMD imports, remove jquuery-ui shim, fix release config * use closed $.fn.datepicker for system-tracking * remove packaging/node/ * remove old tests * shrinkwrap fragile dependency sandcastle, update README, lint * first pass at fixing rrule shim * update makefile targets * update gitignore w/ new flag file * add saucelabs karma config * add license controller test * add examples of service and directive tests * Makefile flubs * consolidate clean-ui target, compulsively update flag file location * dep on CJS/AMD/UMD compatible version of rrule lib, fix example tests/config for demo * boilerplate karma config for saucelabs (should be abstracted to common config after proven to work) * update docs * docs feedback * update Dockerfile with Node 6.x dep
This commit is contained in:
169
awx/ui/webpack.config.js
Normal file
169
awx/ui/webpack.config.js
Normal file
@@ -0,0 +1,169 @@
|
||||
var path = require('path'),
|
||||
webpack = require('webpack'),
|
||||
StatsPlugin = require('stats-webpack-plugin');
|
||||
|
||||
var vendorPkgs = [
|
||||
'angular',
|
||||
'angular-breadcrumb',
|
||||
'angular-codemirror',
|
||||
'angular-cookies',
|
||||
'angular-drag-and-drop-lists',
|
||||
'angular-md5',
|
||||
'angular-moment',
|
||||
'angular-sanitize',
|
||||
'angular-scheduler',
|
||||
'angular-tz-extensions',
|
||||
'angular-ui-router',
|
||||
'bootstrap',
|
||||
'bootstrap-datepicker',
|
||||
'codemirror',
|
||||
'd3',
|
||||
//'javascript-detect-element-resize', // jquery-flavored dist is alias'd below
|
||||
'jquery',
|
||||
'jquery-ui',
|
||||
'js-yaml',
|
||||
'lodash',
|
||||
'lr-infinite-scroll',
|
||||
'moment',
|
||||
'ng-toast',
|
||||
'nvd3',
|
||||
'select2',
|
||||
'socket.io-client',
|
||||
];
|
||||
|
||||
var dev = {
|
||||
entry: {
|
||||
app: './client/src/app.js',
|
||||
vendor: vendorPkgs
|
||||
},
|
||||
output: {
|
||||
path: './static/',
|
||||
filename: 'tower.js'
|
||||
},
|
||||
plugins: [
|
||||
// vendor shims:
|
||||
// [{expected_local_var : dependency}, ...]
|
||||
new webpack.ProvidePlugin({
|
||||
'$': 'jquery',
|
||||
'jQuery': 'jquery',
|
||||
'window.jQuery': 'jquery',
|
||||
'_': 'lodash',
|
||||
'CodeMirror': 'codemirror',
|
||||
'jsyaml': 'js-yaml',
|
||||
'jsonlint': 'codemirror.jsonlint',
|
||||
'RRule': 'rrule'
|
||||
}),
|
||||
// (chunkName, outfileName)
|
||||
new webpack.optimize.CommonsChunkPlugin('vendor', 'tower.vendor.js'),
|
||||
new StatsPlugin('stats.json', {
|
||||
chunkModules: true
|
||||
})
|
||||
],
|
||||
module: {
|
||||
preLoaders: [{
|
||||
test: /\.js?$/,
|
||||
loader: 'jshint-loader',
|
||||
exclude: ['/(node_modules)/'],
|
||||
include: [path.resolve() + '/client/src/'],
|
||||
jshint: {
|
||||
emitErrors: true
|
||||
}
|
||||
}],
|
||||
loaders: [
|
||||
{ // expose RRule global for nlp module, whose AMD/CJS loading methods are broken
|
||||
test: /\.rrule.js$/,
|
||||
loader: 'expose?RRule'
|
||||
},
|
||||
{
|
||||
test: /\.nlp.js$/,
|
||||
// disable CommonJS & AMD loading (broken in this lib)
|
||||
loader: 'imports?require=>false&define=>false'
|
||||
},
|
||||
{
|
||||
// disable AMD loading (broken in this lib) and default to CommonJS (not broken)
|
||||
test: /\.angular-tz-extensions.js$/,
|
||||
loader: 'imports?define=>false'
|
||||
}, {
|
||||
// es6 -> es5
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /(node_modules)/,
|
||||
query: {
|
||||
presets: ['es2015']
|
||||
}
|
||||
}, {
|
||||
test: /\.nlp.js$/,
|
||||
loader: 'imports?RRule=rrule'
|
||||
}]
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'codemirror.jsonlint': path.resolve() + '/node_modules/codemirror/addon/lint/json-lint.js',
|
||||
'jquery.resize': path.resolve() + '/node_modules/javascript-detect-element-resize/jquery.resize.js',
|
||||
'select2': path.resolve() + '/node_modules/select2/dist/js/select2.full.js'
|
||||
}
|
||||
},
|
||||
devtool: 'sourcemap',
|
||||
watch: true,
|
||||
};
|
||||
|
||||
var release = {
|
||||
entry: {
|
||||
app: './client/src/app.js',
|
||||
vendor: vendorPkgs
|
||||
},
|
||||
output: {
|
||||
path: './static/',
|
||||
filename: 'tower.js'
|
||||
},
|
||||
plugins: [
|
||||
// vendor shims:
|
||||
// [{expected_local_var : dependency}, ...]
|
||||
new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery',
|
||||
'window.jQuery': 'jquery',
|
||||
_: 'lodash',
|
||||
'CodeMirror': 'codemirror',
|
||||
'jsyaml': 'js-yaml',
|
||||
'jsonlint': 'codemirror.jsonlint'
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin('vendor', 'tower.vendor.js'),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
mangle: false
|
||||
})
|
||||
],
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.rrule.js$/,
|
||||
loader: 'expose?RRule'
|
||||
},
|
||||
{
|
||||
test: /\.nlp.js$/,
|
||||
// disable CommonJS (broken in this lib)
|
||||
loader: 'imports?require=>false'
|
||||
},
|
||||
{
|
||||
// disable AMD loading (broken in this lib) and default to CommonJS (not broken)
|
||||
test: /\.angular-tz-extensions.js$/,
|
||||
loader: 'imports?define=>false!'
|
||||
}, {
|
||||
// es6 -> es5
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /(node_modules)/,
|
||||
query: {
|
||||
presets: ['es2015']
|
||||
}
|
||||
}, ]
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'codemirror.jsonlint': path.resolve() + '/node_modules/codemirror/addon/lint/json-lint.js',
|
||||
'jquery.resize': path.resolve() + '/node_modules/javascript-detect-element-resize/jquery.resize.js',
|
||||
'select2': path.resolve() + '/node_modules/select2/dist/js/select2.full.js'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = { dev: dev, release: release };
|
||||
Reference in New Issue
Block a user