Skip to content

Commit

Permalink
Use webpack -p for distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Aug 7, 2015
1 parent 37057c0 commit 3c3ee1a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 30 deletions.
32 changes: 4 additions & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ var gulp = require("gulp"),
gp_less = require("gulp-less"),
gp_util = require("gulp-util"),
gp_watch = require("gulp-watch"),
path = require("path"),
webpack = require("webpack");
path = require("path");

var staticPrefix = "src/sentry/static/sentry",
distPath = staticPrefix + "/dist",
webpackStatsOptions = {
chunkModules: false,
colors: true
};
distPath = staticPrefix + "/dist";

// Workaround for https://github.com/gulpjs/gulp/issues/71
var origSrc = gulp.src;
Expand Down Expand Up @@ -74,15 +69,7 @@ gulp.task("dist:css:wall", buildCssCompileTask("wall.css", [file("less/wall.less

gulp.task("dist:css", ["dist:css:sentry", "dist:css:wall"]);

gulp.task("dist:webpack", function(callback){
webpack(require('./webpack.config.js'), function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gp_util.log("[webpack]", stats.toString(webpackStatsOptions));
callback();
});
});

gulp.task("dist", ["dist:css", "dist:webpack"]);
gulp.task("dist", ["dist:css"]);

gulp.task("watch:css:sentry", ["dist:css:sentry"], function(){
return gp_watch(file("less/**/*.less"), function(){
Expand All @@ -98,19 +85,8 @@ gulp.task("watch:css:wall", ["dist:css:wall"], function(){

gulp.task("watch:css", ["watch:css:sentry", "watch:css:wall"]);

// TODO(dcramer): this is causing issues, use webpack --watch for now
gulp.task("watch:webpack", function(callback){
var config = require('./webpack.config.js');
config.debug = true;
webpack(config).watch(200, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gp_util.log("[webpack]", stats.toString(webpackStatsOptions));
});
callback();
});

gulp.task("watch", function(){
return gulp.start(["watch:css", "watch:webpack"]);
return gulp.start(["watch:css"]);
});

gulp.task("default", ["dist"]);
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ def run(self):
check_output(['npm', 'install', '--quiet'], cwd=work_path)

log.info("running [gulp dist]")
check_output([os.path.join('node_modules', '.bin', 'gulp'), 'dist'],
check_output([os.path.join('node_modules', '.bin', 'gulp'), 'dist:css'],
cwd=work_path)

log.info("running [webpack]")
check_output([os.path.join('node_modules', '.bin', 'webpack'), '-p'],
cwd=work_path)


Expand Down
4 changes: 3 additions & 1 deletion src/sentry/conf/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,5 +776,7 @@ def create_partitioned_queues(name):

# Watchers for various application purposes (such as compiling static media)
SENTRY_WATCHERS = (
[os.path.join(NODE_MODULES_ROOT, '.bin', 'gulp'), 'watch'],
[os.path.join(NODE_MODULES_ROOT, '.bin', 'gulp'), 'watch:css'],
[os.path.join(NODE_MODULES_ROOT, '.bin', 'webpack'), '-d', '--watch',
"--config={}".format(os.path.join(PROJECT_ROOT, os.pardir, os.pardir, "webpack.config.js"))],
)

0 comments on commit 3c3ee1a

Please sign in to comment.