Skip to content

Commit

Permalink
add gulp build task
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Sep 21, 2015
1 parent 051ab02 commit d8208e8
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 6 deletions.
37 changes: 37 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var gulp = require('gulp');
var browserify = require('browserify');
var uglify = require('gulp-uglify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var header = require('gulp-header');
var insert = require('gulp-insert');
var pkg = require('./package.json');

gulp.task('build', function() {
return browserify(pkg.main).bundle()
.pipe(source(pkg.name + '.min.js'))
.pipe(buffer())
.pipe(insert.wrap(
';!function() {' +
' var name = \'RandExp\';' +
' var obj = (function() { return ',
'})()(1);' +
' if (typeof define === \'function\' && ' +
' typeof define.amd === \'object\') {' +
' define(name, function() { return obj; });' +
' } else if (typeof window !== \'undefined\') {' +
' window[name] = obj;' +
' }' +
'}();'))
.pipe(uglify())
.pipe(header(
'//\n' +
'// ${pkg.name} v${pkg.version}\n' +
'// ${pkg.description}\n' +
'//\n' +
'// Copyright (C) ${year} by ${pkg.author}\n' +
'// ${pkg.licenses[0].type} License\n' +
'// ${pkg.licenses[0].url} \n' +
'//\n', { pkg: pkg, year: new Date().getFullYear() }))
.pipe(gulp.dest('build'));
});
27 changes: 21 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"name": "randexp",
"description": "Create random strings that match a given regular expression.",
"keywords": ["regex", "regexp", "regular expression", "random", "test"],
"keywords": [
"regex",
"regexp",
"regular expression",
"random",
"test"
],
"version": "0.4.0",
"homepage": "http://fent.github.io/randexp.js/",
"repository": {
Expand All @@ -21,10 +27,19 @@
"ret": "0.1.10"
},
"devDependencies": {
"mocha": "x"
"browserify": "^11.1.0",
"gulp": "^3.9.0",
"gulp-header": "^1.7.1",
"gulp-insert": "^0.5.0",
"gulp-uglify": "^1.4.1",
"mocha": "x",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"licenses": [ {
"type": "MIT",
"url" : "http://github.com/fent/randexp.js/raw/master/LICENSE"
}]
"licenses": [
{
"type": "MIT",
"url": "http://github.com/fent/randexp.js/raw/master/LICENSE"
}
]
}

0 comments on commit d8208e8

Please sign in to comment.