Commit 06c4fc22 authored by Stefan Galinski's avatar Stefan Galinski 🎮

[TASK] Update node and apply ALL major upgrades

parent a443f681
nodeversion="10.9.0"
nodeversion="10.16.3"
......@@ -108,17 +108,17 @@ module.exports = class Images extends Task {
this._loadingSpinner = ora();
this._loadingSpinner.start(`Optimizing images...`);
}
let q = async.queue((image, callback) => {
let queue = async.queue((image, callback) => {
this._optimizeImage(image).then(callback);
}, 20);
_files.map(async (image) => {
q.push(image, (_error) => {
queue.push(image, (_error) => {
if (_error) {
this._handleError(_error.message);
}
});
});
q.drain = () => {
queue.drain(() => {
if (!this._embedded) {
this._loadingSpinner.stop();
}
......@@ -126,7 +126,7 @@ module.exports = class Images extends Task {
if (this._failedFiles.length) {
// emit empty line before
console.log();
this._logger.warning(chalk.bgYellow(chalk.black(' Please note that the following images have been skipped due to an error:' )));
this._logger.warning(chalk.bgYellow(chalk.black(' Please note that the following images have been skipped due to an error:')));
this._failedFiles.forEach((file) => {
this._logger.warning(chalk.white(` - ${file.name}:`));
this._logger.warning(chalk.whiteBright(` ${typeof file.error === 'string' ? file.error : 'Error unknown'}`));
......@@ -137,7 +137,9 @@ module.exports = class Images extends Task {
this._logger.success(`Optimized ${chalk.white(this._touchedFiles)} of ${_files.length} images in ${_imagesPath}`);
this._logger.success(`Checked ${chalk.white(_files.length)} images and saved ${chalk.white(prettyBytes(saved))} (~ ${chalk.white(Math.round((saved / this._totalBefore) * 100) + '%')})`);
_resolve();
};
});
// or await the end
await queue.drain();
});
}
......@@ -159,7 +161,7 @@ module.exports = class Images extends Task {
result = await imagemin.buffer(buffer, {
plugins: [
imageminJpegtran(),
imageminPngquant({quality: '65-80'}),
imageminPngquant({quality: [0.65, 0.8]}),
imageminGifsicle(),
imageminSvgo({
plugins: [
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment