diff --git a/.gitignore b/.gitignore index 1e2fc1d..0cf37d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -out.js +out.js* node_modules diff --git a/Makefile b/Makefile deleted file mode 100644 index fe62960..0000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -FLAGS='' - -main: out.js - -debug: FLAGS += --debug -debug: out.js - -out.js: script.js - browserify $< -o $@ $(FLAGS) diff --git a/README.md b/README.md index bcb760d..b156131 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A small browser-based graphical client for agar.io, written using [pixijs](http: ##Usage * Clone the repo. -* Install [browserify](http://browserify.org/) globally `npm install -g browserify` -* Install [agario-client](https://github.com/pulviscriptor/agario-client) locally `npm install agario-client` -* Run `make` +* Install [gulp](http://gulpjs.com/) globally `npm install -g gulp` +* Install required dependencies `npm install` +* Run `gulp` * Open `app.html` from the browser diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..807148b --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,30 @@ +var browserify = require('browserify'); +var gulp = require('gulp'); +var source = require('vinyl-source-stream'); +var buffer = require('vinyl-buffer'); +var gutil = require('gulp-util'); +var uglify = require('gulp-uglify'); +var sourcemaps = require('gulp-sourcemaps'); +var reactify = require('reactify'); + +gulp.task('javascript', function () { + // set up the browserify instance on a task basis + var b = browserify({ + entries: './script.js', + debug: true, + // defining transforms here will avoid crashing your stream + // transform: [reactify] + }); + + return b.bundle() + .pipe(source('out.js')) + .pipe(buffer()) + .pipe(sourcemaps.init({loadMaps: true})) + // Add transformation tasks to the pipeline here. + .pipe(uglify()) + .on('error', gutil.log) + .pipe(sourcemaps.write('./')) + .pipe(gulp.dest('./')); +}); + +gulp.task('default', ['javascript']); diff --git a/package.json b/package.json index 98c273d..408c552 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,16 @@ "dependencies": { "agario-client": "^0.0.8" }, + "devDependencies": { + "browserify": "^10.2.4", + "gulp": "^3.9.0", + "gulp-sourcemaps": "^1.5.2", + "gulp-uglify": "^1.2.0", + "gulp-util": "^3.0.5", + "reactify": "^1.1.1", + "vinyl-buffer": "^1.0.0", + "vinyl-source-stream": "^1.1.0" + }, "files": [ "agario-client.js", "example.js",