diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..c13c5f6 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/gulpfile.js b/gulpfile.js index 019d6e9..17bed6c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,4 @@ -require('babel/register'); +require('babel-core/register'); var gulp, gulpTasks; gulp = require('gulp'); diff --git a/package.json b/package.json index 570c1d2..c5473a6 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/js/gulp/game_of_afterlife.js b/public/js/gulp/game_of_afterlife.js index 21a7c24..bb36b42 100644 --- a/public/js/gulp/game_of_afterlife.js +++ b/public/js/gulp/game_of_afterlife.js @@ -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; @@ -98,6 +95,6 @@ module.exports.watch = { sass: watchSass }; module.exports.build = { - js: buildJs, + js: buildJs.bind(null, paths.build), sass: buildSass };