From 5d7379f90f8b8d3914c61dcedd0abfa5e560a254 Mon Sep 17 00:00:00 2001 From: Matt Mazzola Date: Fri, 24 Jun 2016 12:57:24 -0700 Subject: [PATCH] Add header to distributed .js and .ts files which includes name, version, copyright, company, and license. --- gulpfile.js | 11 +++++++++++ package.json | 1 + 2 files changed, 12 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index ba93a6a..739322a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,6 @@ var gulp = require('gulp-help')(require('gulp')); var del = require('del'), + header = require('gulp-header'), rename = require('gulp-rename'), replace = require('gulp-replace'), uglify = require('gulp-uglify'), @@ -11,12 +12,16 @@ var del = require('del'), argv = require('yargs').argv; ; +var package = require('./package.json'); +var banner = "/*! <%= package.name %> v<%= package.version %> | (c) 2016 Microsoft Corporation <%= package.license %> */\n"; + gulp.task('build', 'Build for release', function (done) { return runSequence( 'clean:dist', 'compile:ts', 'min', 'generatecustomdts', + 'header', done ); }); @@ -36,6 +41,12 @@ gulp.task('compile:ts', 'Compile source files', function() { .pipe(gulp.dest('./dist')); }); +gulp.task('header', 'Add header to distributed files', function () { + return gulp.src(['!./dist/*.map', './dist/*']) + .pipe(header(banner, { package : package })) + .pipe(gulp.dest('./dist')); +}); + gulp.task('min', 'Minify build files', function () { return gulp.src(['!./dist/*.min.js', './dist/models.js']) .pipe(uglify()) diff --git a/package.json b/package.json index bd706b9..573333d 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "devDependencies": { "del": "^2.2.1", "gulp": "^3.9.1", + "gulp-header": "^1.8.7", "gulp-help": "^1.6.1", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4",