Add source maps, chunks, and remove previous build tool

This commit is contained in:
Jonathan Frederic 2016-02-09 15:59:58 -08:00
parent 638c9d2a4b
commit b0fb5df3ad
3 changed files with 12 additions and 70 deletions

View File

@ -118,7 +118,14 @@ def find_package_data():
# for verification purposes, explicitly add main.min.js
# so that installation will fail if they are missing
for app in ['auth', 'edit', 'notebook', 'terminal', 'tree']:
static_data.append(pjoin('static', app, 'js', 'built', 'main.min.js'))
static_data.extend([
pjoin('static', app, 'js', 'built', '*main.min.js'),
pjoin('static', app, 'js', 'built', '*main.min.js.map'),
])
static_data.extend([
pjoin('static', 'built', '*index.js'),
pjoin('static', 'built', '*index.js.map'),
])
components = pjoin("static", "components")
# select the components we actually need to install
@ -461,7 +468,7 @@ class CompileJS(Command):
def build_main(self, name):
"""Build main.min.js"""
target = pjoin(static, name, 'js', 'build', 'main.min.js')
target = pjoin(static, name, 'js', 'built', 'main.min.js')
if not self.should_run(name, target):
log.info("%s up to date" % target)

View File

@ -1,67 +0,0 @@
// build main.min.js
// spawned by gulp to allow parallelism
var rjs = require('requirejs').optimize;
var name = process.argv[2];
var rjs_config = {
name: name + '/js/main',
out: './notebook/static/' + name + '/js/main.min.js',
baseUrl: 'notebook/static',
preserveLicenseComments: false, // license comments conflict with sourcemap generation
generateSourceMaps: true,
optimize: "none",
paths: {
underscore : 'components/underscore/underscore-min',
backbone : 'components/backbone/backbone-min',
jquery: 'components/jquery/jquery.min',
bootstrap: 'components/bootstrap/js/bootstrap.min',
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
"jquery-ui": 'components/jquery-ui/ui/minified/jquery-ui.min',
moment: 'components/moment/moment',
codemirror: 'components/codemirror',
termjs: 'components/term.js/src/term',
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead',
contents: 'empty:'
},
map: { // for backward compatibility
"*": {
"jqueryui": "jquery-ui",
}
},
shim: {
typeahead: {
deps: ["jquery"],
exports: "typeahead"
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"],
exports: "bootstrap"
},
bootstraptour: {
deps: ["bootstrap"],
exports: "Tour"
},
"jquery-ui": {
deps: ["jquery"],
exports: "$"
}
},
exclude: [
"custom/custom",
]
};
rjs(rjs_config, console.log, function (err) {
console.log("Failed to build", name, err);
process.exit(1);
});

View File

@ -44,7 +44,7 @@ function buildConfig(appName) {
path: './notebook/static/' + appName + '/js/built',
publicPath: "/static/" + appName + "/js/built/"
},
devtool: 'source-map'
devtool: 'source-map',
});
}
@ -61,6 +61,7 @@ module.exports = [
path: './notebook/static/services/built',
libraryTarget: 'amd'
},
devtool: 'source-map',
}),
_.extend({}, commonConfig, {
entry: './notebook/static/index.js',
@ -70,5 +71,6 @@ module.exports = [
libraryTarget: 'amd',
publicPath: "/static/built/"
},
devtool: 'source-map',
}),
].map(x => buildConfig(x));