From: Daniel Ruf Date: Sat, 23 Feb 2019 15:48:09 +0000 (+0100) Subject: refactor: replace chalk with kleur X-Git-Tag: v6.6.0~3^2~26^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11693%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git refactor: replace chalk with kleur --- diff --git a/gulp/tasks/babel-error.js b/gulp/tasks/babel-error.js index 9e0a3f0f9..68068326f 100644 --- a/gulp/tasks/babel-error.js +++ b/gulp/tasks/babel-error.js @@ -1,8 +1,8 @@ -var chalk = require('chalk'); +var { red } = require('kleur'); module.exports = function(err) { console.log( - chalk.red( + red( err.fileName + ( err.loc ? @@ -13,4 +13,4 @@ module.exports = function(err) { 'error Babel: ' + err.message + '\n' + err.codeFrame ); -} \ No newline at end of file +} diff --git a/package.json b/package.json index efe202804..2c0e62338 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "browserstack-runner": "^0.9.0", "chai": "^4.1.2", "chai-jquery": "^2.1.0", - "chalk": "^2.4.2", "clipboard": "^2.0.4", "corejs-typeahead": "^1.1.1", "cz-conventional-changelog": "^2.1.0", @@ -78,6 +77,7 @@ "is-empty-object": "^1.1.1", "jquery": "^3.3.1", "js-yaml": "^3.12.1", + "kleur": "^3.0.2", "mocha": "^5.0.5", "mocha-headless-chrome": "^2.0.1", "motion-ui": "^2.0.2", diff --git a/script/husky-commit-lint.js b/script/husky-commit-lint.js index 988df4944..30f25fb30 100644 --- a/script/husky-commit-lint.js +++ b/script/husky-commit-lint.js @@ -1,9 +1,9 @@ -const chalk = require('chalk') +const { yellow, red } = require('kleur'); const spawn = require('child_process').spawn const args = process.argv.splice(process.execArgv.length + 2); -console.log(chalk.yellow('🐶 Checking the commit message...')) +console.log(yellow('🐶 Checking the commit message...')) const child = spawn('commitlint', args, { shell: true }) @@ -12,13 +12,13 @@ child.stdout.on('data', function (data) { }) child.on('error', function (err) { - console.log(chalk.red(err)) + console.log(red(err)) }) child.on('exit', function (code) { if(code !== 0){ - console.log(chalk.yellow('🐶 ✗ Commit message is invalid.')) - console.log(chalk.yellow(' See https://git.io/contribute for help')) + console.log(yellow('🐶 ✗ Commit message is invalid.')) + console.log(yellow(' See https://git.io/contribute for help')) process.exit(code); } }) diff --git a/script/husky-commit-test.js b/script/husky-commit-test.js index 3a665ff50..191673a6f 100644 --- a/script/husky-commit-test.js +++ b/script/husky-commit-test.js @@ -1,7 +1,7 @@ -const chalk = require('chalk') +const { yellow, red } = require('kleur'); const spawn = require('child_process').spawn -console.log(chalk.yellow('🐶 Checking tests before committing...')) +console.log(yellow('🐶 Checking tests before committing...')) const child = spawn('npm run test', [], { shell: true }) @@ -10,14 +10,14 @@ child.stdout.on('data', function (data) { }) child.on('error', function (err) { - console.log(chalk.red(err)) + console.log(red(err)) }) child.on('exit', function (code) { if(code === 0){ - console.log(chalk.yellow('🐶 ✓ Tests run well, we can commit...')) + console.log(yellow('🐶 ✓ Tests run well, we can commit...')) } else { - console.log(chalk.yellow('🐶 ✗ Tests are failing, please fix them before committing.')) + console.log(yellow('🐶 ✗ Tests are failing, please fix them before committing.')) process.exit(code); } }) diff --git a/script/husky-push-test.js b/script/husky-push-test.js index 259c98b6f..a9631a72c 100644 --- a/script/husky-push-test.js +++ b/script/husky-push-test.js @@ -1,7 +1,7 @@ -const chalk = require('chalk') +const { yellow, red } = require('kleur'); const spawn = require('child_process').spawn -console.log(chalk.yellow('🐶 Checking tests before pushing...')) +console.log(yellow('🐶 Checking tests before pushing...')) const child = spawn('npm run test', [], { shell: true }) @@ -10,14 +10,14 @@ child.stdout.on('data', function (data) { }) child.on('error', function (err) { - console.log(chalk.red(err)) + console.log(red(err)) }) child.on('exit', function (code) { if(code === 0){ - console.log(chalk.yellow('🐶 ✓ Tests run well, we can push...')) + console.log(yellow('🐶 ✓ Tests run well, we can push...')) } else { - console.log(chalk.yellow('🐶 ✗ Tests are failing, please fix them before pushing.')) + console.log(yellow('🐶 ✗ Tests are failing, please fix them before pushing.')) process.exit(code); } })