From 66b6b2a568131deb5e52500ce849774e13979214 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Mon, 14 Nov 2016 10:30:10 +0100 Subject: [PATCH] added banner to distribution files. Fixes #56 --- gulpfile.helper.js | 12 +++++++++++- package.json | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gulpfile.helper.js b/gulpfile.helper.js index 18c3ec48..d853a7f3 100644 --- a/gulpfile.helper.js +++ b/gulpfile.helper.js @@ -36,6 +36,15 @@ module.exports = function (gulp, helperOptions) { files.distEs5 = [files.dist] } + var header = require('gulp-header') + var banner = ['/**', + ' * <%= pkg.name %> - <%= pkg.description %>', + ' * @version v<%= pkg.version %>', + ' * @link <%= pkg.homepage %>', + ' * @license <%= pkg.license %>', + ' */', + ''].join('\n') + gulp.task('dist:es5', function () { var babelOptions = { presets: ['es2015'] @@ -51,6 +60,7 @@ module.exports = function (gulp, helperOptions) { .pipe($.if(!options.debug, $.uglify().on('error', function (e) { console.log('\x07', e.message, JSON.stringify(e)); return this.end() }))) + .pipe(header(banner, { pkg : require('./package.json') } )) .pipe($.sourcemaps.write('.')) .pipe(gulp.dest('./dist/'))) }) @@ -67,8 +77,8 @@ module.exports = function (gulp, helperOptions) { .pipe($.rename({ extname: '.es6' })) + .pipe(header(banner, { pkg : require('./package.json') } )) .pipe($.sourcemaps.write('.')) - .pipe(gulp.dest('./dist/'))) }) diff --git a/package.json b/package.json index f3bccb50..4d2d984f 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "gulp-concat": "^2.6.0", "gulp-filter": "^3.0.1", "gulp-git": "^1.6.0", + "gulp-header": "^1.8.8", "gulp-if": "^2.0.0", "gulp-jasmine": "^2.0.1", "gulp-jasmine-browser": "^0.2.3", @@ -63,6 +64,7 @@ "gulp-shell": "^0.5.1", "gulp-sourcemaps": "^1.5.2", "gulp-tag-version": "^1.3.0", + "gulp-uglify": "^2.0.0", "gulp-util": "^3.0.6", "gulp-watch": "^4.3.5", "minimist": "^1.2.0", @@ -72,7 +74,6 @@ "seedrandom": "^2.4.2", "standard": "^5.2.2", "vinyl-buffer": "^1.0.0", - "vinyl-source-stream": "^1.1.0", - "gulp-uglify": "^2.0.0" + "vinyl-source-stream": "^1.1.0" } }