Permalink
Browse files

Simplify build process to non-versioned filenames

  • Loading branch information...
1 parent 9bd3959 commit 336cf329c20e71c676d6f9bef29903a1f9b969c1 @brycekahle brycekahle committed Jan 22, 2017
Showing with 9 additions and 33 deletions.
  1. +8 −32 gulpfile.js
  2. +1 −1 package.json
View
@@ -10,13 +10,13 @@ var gulp = require('gulp')
, envify = require('envify/custom')
, rename = require('gulp-rename')
, header = require('gulp-header')
+ , replace = require('gulp-replace')
, pkg = require('./package.json')
, fs = require('fs')
, pump = require('pump')
;
-var libName = 'sockjs-' + pkg.version
- , browserifyOptions = {
+var browserifyOptions = {
entries: './lib/entry.js'
, standalone: 'SockJS'
, debug: true
@@ -35,11 +35,12 @@ gulp.task('write-version', function () {
});
gulp.task('testbundle', ['browserify:min'], function() {
- gulp.src('./build/' + libName + '.min.js')
+ gulp.src('./build/sockjs.min.js')
.pipe(rename('sockjs.js'))
+ .pipe(replace('sourceMappingURL=sockjs.min.js.map', 'sourceMappingURL=sockjs.js.map'))
.pipe(gulp.dest('./tests/html/lib/'));
- return gulp.src('./build/' + libName + '.min.js.map')
+ return gulp.src('./build/sockjs.min.js.map')
.pipe(rename('sockjs.js.map'))
.pipe(gulp.dest('./tests/html/lib/'));
});
@@ -69,7 +70,7 @@ gulp.task('browserify', ['write-version'], function (cb) {
gulp.task('browserify:min', ['write-version'], function (cb) {
pump([
browserify(browserifyOptions).exclude('debug').transform(envify({ NODE_ENV: 'production' })).bundle(),
- source(libName + '.min.js'),
+ source('sockjs.min.js'),
buffer(),
sourcemaps.init({ loadMaps: true }),
uglify({ compress: { pure_funcs: ['debug'] } }),
@@ -80,37 +81,12 @@ gulp.task('browserify:min', ['write-version'], function (cb) {
});
gulp.task('release', ['browserify', 'browserify:min'], function () {
- // sockjs-{version}.min.js
- gulp.src('./build/' + libName + '.min.js')
- .pipe(gulp.dest('./dist/'));
-
- gulp.src('./build/' + libName + '.min.js.map')
- .pipe(gulp.dest('./dist/'));
-
- // sockjs-{version}.js
gulp.src('./build/sockjs.js')
- .pipe(rename(libName + '.js'))
.pipe(gulp.dest('./dist/'));
-
gulp.src('./build/sockjs.js.map')
- .pipe(rename(libName + '.js.map'))
- .pipe(gulp.dest('./dist/'));
-});
-
-gulp.task('stable-release', ['release'], function () {
- // sockjs.min.js + sockjs.min.js.map
- gulp.src('./build/' + libName + '.min.js')
- .pipe(rename('sockjs.min.js'))
.pipe(gulp.dest('./dist/'));
- gulp.src('./build/' + libName + '.min.js.map')
- .pipe(rename('sockjs.min.js.map'))
+ gulp.src('./build/sockjs.min.js')
.pipe(gulp.dest('./dist/'));
-
- // sockjs.js + sockjs.js.map
- gulp.src('./build/sockjs.js')
- .pipe(rename('sockjs.js'))
- .pipe(gulp.dest('./dist/'));
- gulp.src('./build/sockjs.js.map')
- .pipe(rename('sockjs.js.map'))
+ gulp.src('./build/sockjs.min.js.map')
.pipe(gulp.dest('./dist/'));
});
View
@@ -39,6 +39,7 @@
"gulp": "^3.9.1",
"gulp-header": "^1.8.8",
"gulp-rename": "~1.2.0",
+ "gulp-replace": "^0.5.4",
"gulp-sourcemaps": "^2.4.0",
"gulp-uglify": "^2.0.0",
"mocha": "^3.2.0",
@@ -67,7 +68,6 @@
"zuul": "zuul -- tests/browser.js",
"gulp": "gulp",
"lint": "eslint .",
- "preversion": "rm dist/sockjs-1.*",
"version": "gulp stable-release && git add -A dist lib/version.js",
"postversion": "npm publish",
"postpublish": "git push origin --all && git push origin --tags"

0 comments on commit 336cf32

Please sign in to comment.