Skip to content

Commit

Permalink
chore(gulp) upgrade to babel 6
Browse files Browse the repository at this point in the history
 - update babelify build syntax and process.

gulp-refactor
  • Loading branch information
PhilVargas committed Nov 17, 2015
1 parent e8c7534 commit 5d52487
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('babel/register');
require('babel-core/register');
var gulp, gulpTasks;

gulp = require('gulp');
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,26 @@
},
"homepage": "https://github.com/PhilVargas/js_game_of_afterlife#readme",
"dependencies": {
"browserify": "^11.0.1",
"browserify": "^12.0.1",
"gulp": "^3.9.0",
"gulp-sass": "^2.0.4",
"gulp-uglify": "^1.2.0",
"gulp-uglify": "^1.4.2",
"path": "^0.11.14",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.3.1"
},
"devDependencies": {
"babel": "^5.8.21",
"babel-core": "^6.1.21",
"babel-eslint": "^4.1.1",
"babelify": "^6.1.3",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babelify": "^7.2.0",
"chai": "^3.2.0",
"chai-changes": "^1.3.4",
"chai-spies": "^0.7.0",
"eslint": "^1.3.1",
"gulp-babel": "^5.2.0",
"gulp-babel": "^6.1.0",
"mocha": "^2.2.5",
"mocha-traceur": "^2.1.0",
"mochify": "^2.13.0",
Expand Down
19 changes: 8 additions & 11 deletions public/js/gulp/game_of_afterlife.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,19 @@ browserifyOptions = {
fullPaths: true
};

function buildJs(){
let browserBundle, watcher;
function buildJs(destination){
let browserBundle;

browserBundle = browserify(browserifyOptions);
browserBundle.transform(babelify);
watcher = watchify(browserBundle);
watcher.bundle()
browserBundle.transform(babelify, {
presets: ['es2015']
})
.bundle()
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(paths.build))
.on('end', function(){
watcher.close();
});
.pipe(gulp.dest(destination));
}

function initializeWatcher(bundleToWatch){
let watcher, updateStart;

Expand Down Expand Up @@ -98,6 +95,6 @@ module.exports.watch = {
sass: watchSass
};
module.exports.build = {
js: buildJs,
js: buildJs.bind(null, paths.build),
sass: buildSass
};

0 comments on commit 5d52487

Please sign in to comment.