- updated composer.json with upgraded pathfinder_esi version
- removed "gulp-util" (deprecated NPM module) from package.json - replaced "gulp-util" functions with equivalent NPM packages - upgraded some other NPM modules to newer versions
This commit is contained in:
@@ -27,6 +27,6 @@
|
||||
"monolog/monolog": "1.*",
|
||||
"websoftwares/monolog-zmq-handler": "0.2.*",
|
||||
"swiftmailer/swiftmailer": "^6.0",
|
||||
"exodus4d/pathfinder_esi": "dev-master#v1.2.2"
|
||||
"exodus4d/pathfinder_esi": "dev-master#v1.2.3"
|
||||
}
|
||||
}
|
||||
|
||||
117
gulpfile.js
117
gulpfile.js
@@ -5,7 +5,6 @@ let fs = require('fs');
|
||||
let ini = require('ini');
|
||||
|
||||
let gulp = require('gulp');
|
||||
let gutil = require('gulp-util');
|
||||
let requirejsOptimize = require('gulp-requirejs-optimize');
|
||||
let filter = require('gulp-filter');
|
||||
let gulpif = require('gulp-if');
|
||||
@@ -28,13 +27,14 @@ let merge = require('lodash.merge');
|
||||
let minimist = require('minimist');
|
||||
let slash = require('slash');
|
||||
let fileExtension = require('file-extension');
|
||||
let log = require('fancy-log');
|
||||
let colors = require('ansi-colors');
|
||||
let stylish = require('jshint-stylish');
|
||||
let Table = require('terminal-table');
|
||||
let prettyBytes = require('pretty-bytes');
|
||||
let del = require('promised-del');
|
||||
|
||||
let minify = composer(uglifyjs, console);
|
||||
let chalk = gutil.colors;
|
||||
|
||||
// == Settings ========================================================================================================
|
||||
|
||||
@@ -109,14 +109,14 @@ let uglifyJsOptions = {
|
||||
let printError = (title, example) => {
|
||||
let cliLineLength = (cliBoxLength - 8);
|
||||
|
||||
gutil.log('').log(chalk.red( '= ERROR ' + '=' . repeat(cliLineLength)));
|
||||
gutil.log(chalk.red(title));
|
||||
log('').log(colors.red( '= ERROR ' + '=' . repeat(cliLineLength)));
|
||||
log(colors.red(title));
|
||||
if(example){
|
||||
gutil.log(`
|
||||
${chalk.gray(example)}
|
||||
log(`
|
||||
${colors.gray(example)}
|
||||
`);
|
||||
}
|
||||
gutil.log(chalk.red('='.repeat(cliBoxLength))).log('');
|
||||
log(colors.red('='.repeat(cliBoxLength))).log('');
|
||||
};
|
||||
|
||||
// == Settings ========================================================================================================
|
||||
@@ -270,33 +270,33 @@ let mergeConf = (confUser, confDefault) => {
|
||||
*/
|
||||
let printHelp = () => {
|
||||
let cliLineLength = (cliBoxLength - 7);
|
||||
gutil.log('')
|
||||
.log(chalk.cyan( '= HELP ' + '='.repeat(cliLineLength)))
|
||||
log('')
|
||||
.log(colors.cyan( '= HELP ' + '='.repeat(cliLineLength)))
|
||||
.log(`
|
||||
${chalk.cyan('documentation:')} ${chalk.gray('https://github.com/exodus4d/pathfinder/wiki/GulpJs')}
|
||||
${colors.cyan('documentation:')} ${colors.gray('https://github.com/exodus4d/pathfinder/wiki/GulpJs')}
|
||||
|
||||
${chalk.cyan('usage:')} ${chalk.gray('$ npm run gulp [task] -- [--options] ...')}
|
||||
${colors.cyan('usage:')} ${colors.gray('$ npm run gulp [task] -- [--options] ...')}
|
||||
|
||||
${chalk.cyan('tasks:')}
|
||||
${chalk.gray('help')} This view
|
||||
${chalk.gray('default')} Development environment. Working with row src files and file watcher, default:
|
||||
${chalk.gray('')} ${chalk.gray('--jsUglify=false --jsSourcemaps=false --cssSourcemaps=false --jsGzip=false --cssGzip=false --jsBrotli=false --cssBrotli=false')}
|
||||
${chalk.gray('production')} Production build. Concat and uglify static resources, default:
|
||||
${chalk.gray('')} ${chalk.gray('--jsUglify=true --jsSourcemaps=true --cssSourcemaps=true --jsGzip=true --cssGzip=true --jsBrotli=true --cssBrotli=true')}
|
||||
${colors.cyan('tasks:')}
|
||||
${colors.gray('help')} This view
|
||||
${colors.gray('default')} Development environment. Working with row src files and file watcher, default:
|
||||
${colors.gray('')} ${colors.gray('--jsUglify=false --jsSourcemaps=false --cssSourcemaps=false --jsGzip=false --cssGzip=false --jsBrotli=false --cssBrotli=false')}
|
||||
${colors.gray('production')} Production build. Concat and uglify static resources, default:
|
||||
${colors.gray('')} ${colors.gray('--jsUglify=true --jsSourcemaps=true --cssSourcemaps=true --jsGzip=true --cssGzip=true --jsBrotli=true --cssBrotli=true')}
|
||||
|
||||
${chalk.cyan('options:')}
|
||||
${chalk.gray('--tag')} Set build version. ${chalk.gray('default: --tag="v1.2.4" -> dest path: public/js/v1.2.4')}
|
||||
${chalk.gray('--jsUglify')} Set js uglification. ${chalk.gray('(true || false)')}
|
||||
${chalk.gray('--jsSourcemaps')} Set js sourcemaps generation. ${chalk.gray('(true || false)')}
|
||||
${chalk.gray('--jsGzip')} Set js "gzip" compression mode. ${chalk.gray('(true || false)')}
|
||||
${chalk.gray('--jsBrotli')} Set js "brotli" compression mode. ${chalk.gray('(true || false)')}
|
||||
${colors.cyan('options:')}
|
||||
${colors.gray('--tag')} Set build version. ${colors.gray('default: --tag="v1.2.4" -> dest path: public/js/v1.2.4')}
|
||||
${colors.gray('--jsUglify')} Set js uglification. ${colors.gray('(true || false)')}
|
||||
${colors.gray('--jsSourcemaps')} Set js sourcemaps generation. ${colors.gray('(true || false)')}
|
||||
${colors.gray('--jsGzip')} Set js "gzip" compression mode. ${colors.gray('(true || false)')}
|
||||
${colors.gray('--jsBrotli')} Set js "brotli" compression mode. ${colors.gray('(true || false)')}
|
||||
|
||||
${chalk.gray('--cssSourcemaps')} Set CSS sourcemaps generation. ${chalk.gray('(true || false)')}
|
||||
${chalk.gray('--cssGzip')} Set CSS "gzip" compression mode. ${chalk.gray('(true || false)')}
|
||||
${chalk.gray('--cssBrotli')} Set CSS "brotli" compression mode. ${chalk.gray('(true || false)')}
|
||||
${chalk.gray('--debug')} Set debug mode (more output). ${chalk.gray('(true || false)')}
|
||||
${colors.gray('--cssSourcemaps')} Set CSS sourcemaps generation. ${colors.gray('(true || false)')}
|
||||
${colors.gray('--cssGzip')} Set CSS "gzip" compression mode. ${colors.gray('(true || false)')}
|
||||
${colors.gray('--cssBrotli')} Set CSS "brotli" compression mode. ${colors.gray('(true || false)')}
|
||||
${colors.gray('--debug')} Set debug mode (more output). ${colors.gray('(true || false)')}
|
||||
`)
|
||||
.log(chalk.cyan('='.repeat(cliBoxLength)))
|
||||
.log(colors.cyan('='.repeat(cliBoxLength)))
|
||||
.log('');
|
||||
};
|
||||
|
||||
@@ -542,11 +542,11 @@ gulp.task('task:concatJS', () => {
|
||||
};
|
||||
}))
|
||||
.pipe(bytediff.start())
|
||||
.pipe(gulpif(CONF.JS.UGLIFY, minify(uglifyJsOptions).on('warnings', gutil.log)))
|
||||
.pipe(gulpif(CONF.JS.UGLIFY, minify(uglifyJsOptions).on('warnings', log)))
|
||||
.pipe(gulpif(CONF.JS.SOURCEMAPS, sourcemaps.write('.', {includeContent: false, sourceRoot: '/js'}))) // prod (minify)
|
||||
.pipe(bytediff.stop(data => {
|
||||
trackFile(data, {src: 'startSize', src_percent: 'percent', uglify: 'endSize'});
|
||||
return chalk.green('Build concat file "' + data.fileName + '"');
|
||||
return colors.green('Build concat file "' + data.fileName + '"');
|
||||
}))
|
||||
.pipe(gulp.dest(PATH.JS.DIST_BUILD));
|
||||
});
|
||||
@@ -566,7 +566,7 @@ gulp.task('task:diffJS', () => {
|
||||
.pipe(gulpif(CONF.JS.SOURCEMAPS, sourcemaps.write('.', {includeContent: false, sourceRoot: '/js'})))
|
||||
.pipe(bytediff.stop(data => {
|
||||
trackFile(data, {src: 'startSize', src_percent: 'percent', uglify: 'endSize'});
|
||||
return chalk.green('Build file "' + data.fileName + '"');
|
||||
return colors.green('Build file "' + data.fileName + '"');
|
||||
}))
|
||||
.pipe(gulp.dest(PATH.JS.DIST_BUILD, {overwrite: false}));
|
||||
});
|
||||
@@ -602,9 +602,9 @@ let gzipAssets = (config, taskName) => {
|
||||
.pipe(bytediff.stop(data => {
|
||||
trackFile(data, {gzipFile: 'fileName', gzip: 'endSize'});
|
||||
if(fileExtension(data.fileName) === gZipOptions.extension){
|
||||
return chalk.green('Gzip generate "' + data.fileName + '"');
|
||||
return colors.green('Gzip generate "' + data.fileName + '"');
|
||||
}else{
|
||||
return chalk.gray('Gzip skip "' + data.fileName + '". Size < ' + gZipOptions.threshold + ' (threehold)');
|
||||
return colors.gray('Gzip skip "' + data.fileName + '". Size < ' + gZipOptions.threshold + ' (threehold)');
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest(PATH.ASSETS.DIST));
|
||||
@@ -625,9 +625,9 @@ let brotliAssets = (config, taskName) => {
|
||||
.pipe(bytediff.stop(data => {
|
||||
trackFile(data, {brotliFile: 'fileName', brotli: 'endSize'});
|
||||
if(fileExtension(data.fileName) === brotliOptions.extension){
|
||||
return chalk.green('Brotli generate "' + data.fileName + '"');
|
||||
return colors.green('Brotli generate "' + data.fileName + '"');
|
||||
}else{
|
||||
return chalk.gray('Brotli skip "' + data.fileName + '"');
|
||||
return colors.gray('Brotli skip "' + data.fileName + '"');
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest(PATH.ASSETS.DIST));
|
||||
@@ -671,7 +671,7 @@ gulp.task('task:sass', () => {
|
||||
.pipe(bytediff.start())
|
||||
.pipe(bytediff.stop(data => {
|
||||
trackFile(data, {src: 'startSize', src_percent: 'percent', uglify: 'endSize'});
|
||||
return chalk.green('Build CSS file "' + data.fileName + '"');
|
||||
return colors.green('Build CSS file "' + data.fileName + '"');
|
||||
}))
|
||||
.pipe(gulp.dest(PATH.ASSETS.DIST + '/css/' + CONF.TAG));
|
||||
});
|
||||
@@ -710,13 +710,13 @@ gulp.task('task:printJsSummary', done => {
|
||||
* print task configuration (e.g. CLI parameters)
|
||||
*/
|
||||
gulp.task('task:printConfig', done => {
|
||||
let error = chalk.red;
|
||||
let success = chalk.green;
|
||||
let error = colors.red;
|
||||
let success = colors.green;
|
||||
|
||||
let columnLength = Math.round(cliBoxLength / 2);
|
||||
let cliLineLength = cliBoxLength - 9;
|
||||
|
||||
gutil.log(chalk.gray( '= CONFIG ' + '='.repeat(cliLineLength)));
|
||||
log(colors.gray( '= CONFIG ' + '='.repeat(cliLineLength)));
|
||||
|
||||
let configFlat = flatten(CONF);
|
||||
for (let key in configFlat) {
|
||||
@@ -724,13 +724,13 @@ gulp.task('task:printConfig', done => {
|
||||
let value = configFlat[key];
|
||||
// format value
|
||||
value = padEnd((typeof value === 'undefined') ? 'undefined': value, columnLength);
|
||||
gutil.log(
|
||||
chalk.gray.yellow(padEnd(key, columnLength)),
|
||||
log(
|
||||
colors.yellow(padEnd(key, columnLength)),
|
||||
configFlat[key] ? success(value) : error(value)
|
||||
);
|
||||
}
|
||||
}
|
||||
gutil.log(chalk.reset.gray('='.repeat(cliBoxLength)));
|
||||
log(colors.gray('='.repeat(cliBoxLength)));
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -740,7 +740,7 @@ gulp.task('task:printConfig', done => {
|
||||
gulp.task('task:checkConfig', done => {
|
||||
if(!CONF.TAG){
|
||||
printError(
|
||||
'Missing TAG version. Add param ' + chalk.cyan('--tag'),
|
||||
'Missing TAG version. Add param ' + colors.cyan('--tag'),
|
||||
'$ npm run gulp default -- --tag="v1.2.4"');
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -809,7 +809,7 @@ gulp.task('task:updateJsDest', gulp.series(
|
||||
'task:gzipJsAssets',
|
||||
'task:brotliJsAssets',
|
||||
'task:renameJsDest',
|
||||
'task:printJsSummary',
|
||||
// 'task:printJsSummary',
|
||||
'task:cleanJsBuild'
|
||||
)
|
||||
);
|
||||
@@ -888,7 +888,7 @@ gulp.task(
|
||||
// 'task:cleanCss',
|
||||
'task:gzipCssAssets',
|
||||
'task:brotliCssAssets',
|
||||
'task:printJsSummary',
|
||||
// 'task:printJsSummary',
|
||||
'task:notifyCssDone'
|
||||
)
|
||||
);
|
||||
@@ -896,11 +896,22 @@ gulp.task(
|
||||
/**
|
||||
* watch files for changes
|
||||
*/
|
||||
gulp.task('task:setWatcher', () => {
|
||||
gulp.watch(PATH.JS.SRC, gulp.series('task:watchJsSrc'));
|
||||
gulp.watch(PATH.CSS.SRC, gulp.series('task:watchCss'));
|
||||
|
||||
gulp.task('task:setWatcherJs', function() {
|
||||
return gulp.watch(PATH.JS.SRC, gulp.series('task:watchJsSrc', 'task:printJsSummary'));
|
||||
});
|
||||
|
||||
gulp.task('task:setWatcherCss', function() {
|
||||
return gulp.watch(PATH.CSS.SRC, gulp.series('task:watchCss', 'task:printJsSummary'));
|
||||
});
|
||||
|
||||
gulp.task('task:setWatcher',
|
||||
gulp.parallel(
|
||||
'task:setWatcherJs',
|
||||
'task:setWatcherCss'
|
||||
)
|
||||
);
|
||||
|
||||
// == Default/Main tasks ==============================================================================================
|
||||
|
||||
gulp.task(
|
||||
@@ -922,9 +933,10 @@ gulp.task(
|
||||
gulp.series(
|
||||
'task:cleanCssBuild',
|
||||
'task:watchCss'
|
||||
),
|
||||
'task:setWatcher'
|
||||
)
|
||||
)
|
||||
),
|
||||
'task:printJsSummary',
|
||||
'task:setWatcher'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -941,7 +953,8 @@ gulp.task(
|
||||
'task:cleanCssBuild',
|
||||
'task:watchCss'
|
||||
)
|
||||
)
|
||||
),
|
||||
'task:printJsSummary'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
15
package.json
15
package.json
@@ -9,12 +9,11 @@
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "gulpjs/gulp#4.0",
|
||||
"gulp-util": "3.0.x",
|
||||
"gulp-requirejs-optimize": "1.2.x",
|
||||
"gulp-filter": "5.0.x",
|
||||
"gulp": "next",
|
||||
"gulp-requirejs-optimize": "1.3.x",
|
||||
"gulp-filter": "5.1.x",
|
||||
"gulp-if": "2.0.x",
|
||||
"gulp-jshint": "2.0.x",
|
||||
"gulp-jshint": "2.1.x",
|
||||
"gulp-sourcemaps": "2.6.x",
|
||||
"gulp-gzip": "1.x.x",
|
||||
"gulp-brotli": "1.2.x",
|
||||
@@ -33,8 +32,10 @@
|
||||
"promised-del": "1.0.x",
|
||||
"flat": "2.0.x",
|
||||
"lodash.padend": "4.6.x",
|
||||
"slash": "1.0.x",
|
||||
"file-extension": "3.1.x"
|
||||
"slash": "2.x.x",
|
||||
"file-extension": "3.1.x",
|
||||
"fancy-log": "1.3.x",
|
||||
"ansi-colors": "1.x.x"
|
||||
},
|
||||
"scripts": {
|
||||
"gulp": "gulp"
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user