Add header to distributed .js and .ts files which includes name, version, copyright, company, and license.
This commit is contained in:
Родитель
5756c80957
Коммит
5d7379f90f
11
gulpfile.js
11
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())
|
||||
|
|
|
@ -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",
|
||||
|
|
Загрузка…
Ссылка в новой задаче