From 7d991e2fa5d96b168ce2d7e2673c1f7982068f3c Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Thu, 30 Apr 2015 11:00:11 -0300 Subject: [PATCH] Remove exportUndum() hack --- CHANGES.md | 3 +++ Gulpfile.js | 30 ++++++++++++++++++++++++++---- game/main.coffee | 2 +- html/index.html | 1 + package.json | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 CHANGES.md diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..53e9480 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,3 @@ +# 2015-04-30 + +- Removed exportUndum() from scaffold. That functionality has been deprecated in Raconteur itself, and making sure there is only one Undum object is now the responsibility of the build system. The Gulpfile in this scaffold now corrects for this, so problem solved. \ No newline at end of file diff --git a/Gulpfile.js b/Gulpfile.js index da3693f..1e0973d 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -49,6 +49,15 @@ gulp.task('less', function () { .pipe(gulp.dest('./build/css')); }); +/* Bundle libraries */ + +var undumBundler = browserify({debug: true}); +undumBundler.require('undum-commonjs'); + +gulp.task('buildUndum', function () { + return undumBundler.bundle().pipe(source('undum.js')).pipe(gulp.dest('./build/game')); +}); + /* Generate JavaScript with browser sync. */ var customOpts = { @@ -59,8 +68,9 @@ var customOpts = { var opts = _.assign({}, watchify.args, customOpts); var bundler = watchify(browserify(opts)); +bundler.external('undum-commonjs'); -gulp.task('coffee', bundle); // `gulp coffee` will generate bundle +gulp.task('coffee', ['buildUndum'], bundle); // `gulp coffee` will generate bundle bundler.on('update', bundle); // Re-bundle on dep updates bundler.on('log', gutil.log); // Output build logs to terminal @@ -102,6 +112,16 @@ gulp.task('serve', ['build'], function () { /* Distribution tasks */ +var undumDistBundler = browserify(); +undumDistBundler.require('undum-commonjs'); + +gulp.task('undum-dist', function () { + return undumDistBundler.bundle().pipe(source('undum.js')) + .pipe(buffer()) + .pipe(uglify()) + .pipe(gulp.dest('./dist/game')); +}); + gulp.task('html-dist', html('./dist')); gulp.task('img-dist', img('./dist/img')); @@ -118,11 +138,13 @@ var distBundler = browserify({ transform: ['coffeeify'] }); -gulp.task('coffee-dist', function () { +distBundler.external('undum-commonjs'); + +gulp.task('coffee-dist', ['undum-dist'], function () { return distBundler.bundle() .pipe(source('bundle.js')) - .pipe(buffer()) - .pipe(uglify()) + //.pipe(buffer()) + //.pipe(uglify()) .on('error', gutil.log) .pipe(gulp.dest('./dist/game')); }); diff --git a/game/main.coffee b/game/main.coffee index b1b0111..151800f 100644 --- a/game/main.coffee +++ b/game/main.coffee @@ -11,7 +11,7 @@ so this copyright notice may be removed and replaced with your own. # Require the libraries we rely on situation = require('raconteur') -situation.exportUndum() # Ensures our Undum object is the same as Raconteur's +undum = require('undum-commonjs') $ = require('jquery') oneOf = require('raconteur/lib/oneOf.js') elements = require('raconteur/lib/elements.js') diff --git a/html/index.html b/html/index.html index 5679fda..71dc9b4 100644 --- a/html/index.html +++ b/html/index.html @@ -9,6 +9,7 @@ + diff --git a/package.json b/package.json index b023fa8..8de13b6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "dependencies": { "undum": "git://github.com/sequitur/undum.git#commonjs", - "raconteur": "git://github.com/sequitur/raconteur.git#879543b4a9e773f61f439bbe1700cbf1e994ab4a", + "raconteur": "git://github.com/sequitur/raconteur.git#61f60d3097b996c5ad9422bfbe3098c060ae92a1", "jquery": "^2.1.3", "markdown-it": "^4.1.0" },