From d7e97d16c7fde4974f04430b0b3ee06da9a5d9bf Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 28 May 2017 05:09:32 +0200 Subject: [PATCH] remove gulp-util --- README.md | 1 - gulpfile.babel.js | 30 +++++++++++++++++------------- package.json | 8 ++++---- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 34708455..2c21d491 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ Requirements You need to have the following tools installed on your development machine before moving on: - [node.js](http://nodejs.org/) & [npm](https://npmjs.org/) -- [Bower](http://bower.io/) - [Ruby](https://www.ruby-lang.org) (for sanity, install with [rvm](https://rvm.io/)) and [Bundler](http://bundler.io/) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 16e76669..6e7b0df7 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -11,6 +11,8 @@ import critical from 'critical' import request from 'request' import fs from 'fs' import yaml from 'js-yaml' +import chalk from 'chalk' +import yargs from 'yargs' // get all the configs: `pkg` and `site` import pkg from './package.json' @@ -21,26 +23,28 @@ const $ = plugins() // handle errors const onError = (error) => { - $.util.log('') - $.util.log($.util.colors.red('You fucked up:', error.message, 'on line' , error.lineNumber)) - $.util.log('') + console.log('') + console.log(chalk.red('You fucked up:', error.message, 'on line' , error.lineNumber)) + console.log('') this.emit('end') } // 'development' is just default, production overrides are triggered // by adding the production flag to the gulp command e.g. `gulp build --production` -const isProduction = ($.util.env.production === true ? true : false) +const argv = yargs.parse(process.argv.slice(1)) +const isProduction = argv.production + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // Terminal Banner // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ console.log("") -console.log($.util.colors.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")) +console.log(chalk.dim(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")) console.log("") -console.log($.util.colors.cyan(" (o) Just what do you think you're doing,", process.env.USER, "? ")) +console.log(chalk.cyan(" (o) Just what do you think you're doing,", process.env.USER, "? ")) console.log("") -console.log($.util.colors.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")) +console.log(chalk.dim(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")) console.log("") // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -304,12 +308,12 @@ export const seo = (done) => { const response = (error, response) => { if (error) { - $.util.log($.util.colors.red(error)) + console.log(chalk.red(error)) } else { - $.util.log($.util.colors.gray('Status:', response && response.statusCode)) + console.log(chalk.dim('Status:', response && response.statusCode)) if (response.statusCode === 200) { - $.util.log($.util.colors.green('Successfully notified')) + console.log(chalk.green('Successfully notified')) } } } @@ -351,9 +355,9 @@ export const watchSrc = () => { // Build banner // export const buildBanner = (done) => { - console.log($.util.colors.gray(" ------------------------------------------")) - console.log($.util.colors.green(' Building ' + ($.util.env.production ? 'production' : 'dev') + ' version...')) - console.log($.util.colors.gray(" ------------------------------------------")) + console.log(chalk.dim(" ------------------------------------------")) + console.log(chalk.green(' Building ' + (isProduction ? 'production' : 'dev') + ' version...')) + console.log(chalk.dim(" ------------------------------------------")) done() } diff --git a/package.json b/package.json index ac2e5a10..abbed59c 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "babel-core": ">=6.24.0", "babel-preset-es2015": ">=6.24.0", "browser-sync": ">=2.10.0", + "chalk": ">=1.1.3", "concurrent-transform": ">=1.0.0", "critical": ">=0.8.4", "cssnano": ">=3.6.2", @@ -43,7 +44,6 @@ "gulp-awspublish": ">=2.0.2", "gulp-awspublish-router": ">=0.1.1", "gulp-cli": ">=1.2.2", - "gulp-filter": ">=2.0.2", "gulp-header": ">=1.2.2", "gulp-htmlmin": ">=1.1.2", "gulp-if": ">=1.2.5", @@ -59,12 +59,12 @@ "gulp-stylus": ">=2.3.1", "gulp-svg-sprite": ">=1.2.2", "gulp-uglify": ">=1.2.0", - "gulp-util": ">=3.0.6", "js-yaml": ">=3.8.3", - "request": ">=2.81.0" + "request": ">=2.81.0", + "yargs": ">=8.0.1" }, "engines": { - "node": ">=5.0.0" + "node": ">=7.0.0" }, "repository": { "type": "git",