Skip to content

Commit

Permalink
Add production + sourcemaps build targets. Not as granular as I want,…
Browse files Browse the repository at this point in the history
… but SourceMapDevTool has weird interactions with -p
  • Loading branch information
dannon committed Nov 29, 2017
1 parent 97b9eed commit a36542a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 6 additions & 2 deletions client/gulpfile.js
Expand Up @@ -44,16 +44,20 @@ var dev_mode = function(){
return process.env.NODE_ENV != "production";
};

var source_maps = function(){
return dev_mode() || process.env.GXY_BUILD_SOURCEMAPS !== undefined;
};

gulp.task('scripts', function() {
return gulp.src(paths.scripts)
.pipe(plumber())
.pipe(cached('scripts'))
.pipe(gulpif(dev_mode, sourcemaps.init()))
.pipe(gulpif(source_maps, sourcemaps.init()))
.pipe(babel({
plugins: ['transform-es2015-modules-amd']
}))
.pipe(gulpif(dev_mode, beautify(), uglify()))
.pipe(gulpif(dev_mode, sourcemaps.write('../maps/')))
.pipe(gulpif(source_maps, sourcemaps.write('../maps/')))
.pipe(gulp.dest('../static/scripts/'));
});

Expand Down
3 changes: 3 additions & 0 deletions client/package.json
Expand Up @@ -32,14 +32,17 @@
"watch": "gulp stage-libs && concurrently \"yarn run webpack-watch\" \"yarn run gulp watch\" \"yarn run style-watch\"",
"build": "NODE_ENV=development gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack\" \"yarn run gulp clean && yarn run gulp\"",
"build-production": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production\" \"yarn run gulp clean && yarn run gulp-production\"",
"build-production-maps": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production-maps\" \"yarn run gulp clean && yarn run gulp-production-maps\"",
"webpack": "webpack -d",
"webpack-watch": "webpack -d --watch",
"webpack-production": "webpack -p",
"webpack-production-maps": "GXY_BUILD_SOURCEMAPS=1 webpack -p",
"style": "grunt style",
"style-watch": "grunt watch-style",
"test": "karma start --verbose --single-run --no-auto-watch karma.config.js",
"gulp": "gulp",
"gulp-production": "NODE_ENV=production gulp",
"gulp-production-maps": "GXY_BUILD_SOURCEMAPS=1 NODE_ENV=production gulp",
"build-toolshed": "grunt --app=toolshed",
"jshint": "jshint --exclude='galaxy/scripts/libs/**' galaxy/scripts/**/*.js",
"build-charts": "webpack -p --config ../config/plugins/visualizations/charts/webpack.config.js",
Expand Down
8 changes: 7 additions & 1 deletion client/webpack.config.js
Expand Up @@ -37,7 +37,7 @@ var commonLibs = [
"onload"
];

module.exports = {
let buildconfig = {
entry: {
libs: commonLibs,
login: "./galaxy/scripts/apps/login.js",
Expand Down Expand Up @@ -118,3 +118,9 @@ module.exports = {
// new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 })
]
};

if (process.env.GXY_BUILD_SOURCEMAPS){
buildconfig.devtool = 'source-map';
}

module.exports = buildconfig;

0 comments on commit a36542a

Please sign in to comment.