Use Gulp build tool

This commit is contained in:
Geoffrey Frogeye 2015-06-09 22:17:39 +02:00
parent 64215b4dc1
commit 58b7b25b48
5 changed files with 44 additions and 13 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
out.js out.js*
node_modules node_modules

View file

@ -1,9 +0,0 @@
FLAGS=''
main: out.js
debug: FLAGS += --debug
debug: out.js
out.js: script.js
browserify $< -o $@ $(FLAGS)

View file

@ -8,7 +8,7 @@ A small browser-based graphical client for agar.io, written using [pixijs](http:
##Usage ##Usage
* Clone the repo. * Clone the repo.
* Install [browserify](http://browserify.org/) globally `npm install -g browserify` * Install [gulp](http://gulpjs.com/) globally `npm install -g gulp`
* Install [agario-client](https://github.com/pulviscriptor/agario-client) locally `npm install agario-client` * Install required dependencies `npm install`
* Run `make` * Run `gulp`
* Open `app.html` from the browser * Open `app.html` from the browser

30
gulpfile.js Normal file
View file

@ -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']);

View file

@ -5,6 +5,16 @@
"dependencies": { "dependencies": {
"agario-client": "^0.0.8" "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": [ "files": [
"agario-client.js", "agario-client.js",
"example.js", "example.js",