From 2a8ad22c4ca5ccce785085102042c46fea42d8de Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Sat, 14 Jul 2018 19:08:00 +0900 Subject: [PATCH] Swap chalk for turbocolor. --- docs/generators_init-generator.js.html | 209 +++++++++++++--- docs/init_init.js.html | 207 +++++++++++++--- docs/migrate_index.js.html | 223 +++++++++++++++--- ...tedPlugins_removeDeprecatedPlugins.js.html | 221 ++++++++++++++--- docs/serve_index.js.html | 221 ++++++++++++++--- docs/utils_modify-config-helper.js.html | 207 +++++++++++++--- docs/utils_npm-packages-exists.js.html | 207 +++++++++++++--- docs/utils_resolve-packages.js.html | 209 +++++++++++++--- docs/utils_run-prettier.js.html | 221 ++++++++++++++--- docs/utils_scaffold.js.html | 207 +++++++++++++--- package-lock.json | 5 + package.json | 2 +- packages/generators/init-generator.js | 8 +- packages/generators/package.json | 2 +- packages/init/init.js | 6 +- packages/init/package.json | 2 +- packages/migrate/index.js | 22 +- packages/migrate/package.json | 2 +- .../removeDeprecatedPlugins.js | 6 +- packages/serve/index.js | 30 +-- packages/serve/package.json | 2 +- packages/utils/modify-config-helper.js | 30 +-- packages/utils/npm-packages-exists.js | 10 +- packages/utils/package.json | 2 +- packages/utils/resolve-packages.js | 8 +- packages/utils/run-prettier.js | 10 +- packages/utils/scaffold.js | 6 +- 27 files changed, 1890 insertions(+), 395 deletions(-) diff --git a/docs/generators_init-generator.js.html b/docs/generators_init-generator.js.html index 3776e41be0e..4bb397d258f 100644 --- a/docs/generators_init-generator.js.html +++ b/docs/generators_init-generator.js.html @@ -1,35 +1,36 @@ + - - JSDoc: Source: generators/init-generator.js + + JSDoc: Source: generators/init-generator.js - - - - - + + -
+
+ +

Source: generators/init-generator.js

-

Source: generators/init-generator.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const Generator = require("yeoman-generator");
-const chalk = require("chalk");
+const color = require("turbocolor");
 const logSymbols = require("log-symbols");
 
 const Input = require("@webpack-cli/webpack-scaffold").Input;
@@ -81,16 +82,16 @@ 

Source: generators/init-generator.js

process.stdout.write( "\n" + logSymbols.info + - chalk.blue(" INFO ") + + color.blue(" INFO ") + "For more information and a detailed description of each question, have a look at " + - chalk.bold.green( + color.bold.green( "https://github.com/webpack/webpack-cli/blob/master/INIT.md" ) + "\n" ); process.stdout.write( logSymbols.info + - chalk.blue(" INFO ") + + color.blue(" INFO ") + "Alternatively, run `webpack(-cli) --help` for usage info." + "\n\n" ); @@ -447,25 +448,173 @@

Source: generators/init-generator.js

} };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/init_init.js.html b/docs/init_init.js.html index ee693609ccb..48530fa5c0f 100644 --- a/docs/init_init.js.html +++ b/docs/init_init.js.html @@ -1,36 +1,37 @@ + - - JSDoc: Source: init/init.js + + JSDoc: Source: init/init.js - - - - - + + -
+
+ +

Source: init/init.js

-

Source: init/init.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const path = require("path");
 const j = require("jscodeshift");
-const chalk = require("chalk");
+const color = require("turbocolor");
 const pEachSeries = require("p-each-series");
 
 const runPrettier = require("@webpack-cli/utils/run-prettier");
@@ -105,7 +106,7 @@ 

Source: init/init.js

if (initActionNotDefined && webpackProperties.config.item) { process.stdout.write( "\n" + - chalk.green( + color.green( `Congratulations! ${ webpackProperties.config.item } has been ${action}ed!\n` @@ -114,32 +115,180 @@

Source: init/init.js

} else { process.stdout.write( "\n" + - chalk.green( + color.green( "Congratulations! Your new webpack configuration file has been created!\n" ) ); } };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/migrate_index.js.html b/docs/migrate_index.js.html index bde3b566827..ca8843a3806 100644 --- a/docs/migrate_index.js.html +++ b/docs/migrate_index.js.html @@ -1,36 +1,37 @@ + - - JSDoc: Source: migrate/index.js + + JSDoc: Source: migrate/index.js - - - - - + + -
+
+ +

Source: migrate/index.js

-

Source: migrate/index.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const fs = require("fs");
 const path = require("path");
-const chalk = require("chalk");
+const color = require("turbocolor");
 const diff = require("diff");
 const inquirer = require("inquirer");
 const PLazy = require("p-lazy");
@@ -56,7 +57,7 @@ 

Source: migrate/index.js

const filePaths = args.slice(3); if (!filePaths.length) { const errMsg = "\n ✖ Please specify a path to your webpack config \n "; - console.error(chalk.red(errMsg)); + console.error(color.red(errMsg)); return; } const currentConfigPath = path.resolve(process.cwd(), filePaths[0]); @@ -76,7 +77,7 @@

Source: migrate/index.js

]) .then(ans => { if (!ans["confirmPath"]) { - console.error(chalk.red("✖ ︎Migration aborted due no output path")); + console.error(color.red("✖ ︎Migration aborted due no output path")); return; } outputConfigPath = path.resolve(process.cwd(), filePaths[0]); @@ -150,9 +151,9 @@

Source: migrate/index.js

const diffOutput = diff.diffLines(ctx.source, result); diffOutput.forEach(diffLine => { if (diffLine.added) { - process.stdout.write(chalk.green(`+ ${diffLine.value}`)); + process.stdout.write(color.green(`+ ${diffLine.value}`)); } else if (diffLine.removed) { - process.stdout.write(chalk.red(`- ${diffLine.value}`)); + process.stdout.write(color.red(`- ${diffLine.value}`)); } }); return inquirer @@ -177,7 +178,7 @@

Source: migrate/index.js

} ]); } else { - console.log(chalk.red("✖ Migration aborted")); + console.log(color.red("✖ Migration aborted")); } }) .then(answer => { @@ -195,7 +196,7 @@

Source: migrate/index.js

); if (webpackOptionsValidationErrors.length) { console.log( - chalk.red( + color.red( "\n✖ Your configuration validation wasn't successful \n" ) ); @@ -207,17 +208,17 @@

Source: migrate/index.js

} } console.log( - chalk.green( + color.green( `\n✔︎ New webpack config file is at ${outputConfigPath}.` ) ); console.log( - chalk.green( + color.green( "✔︎ Heads up! Updating to the latest version could contain breaking changes." ) ); console.log( - chalk.green( + color.green( "✔︎ Plugin and loader dependencies may need to be updated." ) ); @@ -225,31 +226,179 @@

Source: migrate/index.js

}) .catch(err => { const errMsg = "\n ✖ ︎Migration aborted due to some errors: \n"; - console.error(chalk.red(errMsg)); + console.error(color.red(errMsg)); console.error(err); process.exitCode = 1; }); }
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/migrate_removeDeprecatedPlugins_removeDeprecatedPlugins.js.html b/docs/migrate_removeDeprecatedPlugins_removeDeprecatedPlugins.js.html index 4edf84ad47f..7d7f47236d2 100644 --- a/docs/migrate_removeDeprecatedPlugins_removeDeprecatedPlugins.js.html +++ b/docs/migrate_removeDeprecatedPlugins_removeDeprecatedPlugins.js.html @@ -1,32 +1,33 @@ + - - JSDoc: Source: migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js + + JSDoc: Source: migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js - - - - - + + -
+
+ +

Source: migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js

+ -

Source: migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js

- - -
-
-
const chalk = require("chalk");
+		
+
+
const color = require("turbocolor");
 const utils = require("@webpack-cli/utils/ast-utils");
 
 /**
@@ -63,33 +64,181 @@ 

Source: migrate/removeDeprecatedPlugins/removeDeprecatedP } } else { console.log(` -${chalk.red("Please remove deprecated plugins manually. ")} -See ${chalk.underline( +${color.red("Please remove deprecated plugins manually. ")} +See ${color.underline( "https://webpack.js.org/guides/migrating/" )} for more information.`); } }); };

-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
- - - + + + + + + +
+ + + +
+ +
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
+ + + + diff --git a/docs/serve_index.js.html b/docs/serve_index.js.html index adb683d7d8b..f7b774e1faa 100644 --- a/docs/serve_index.js.html +++ b/docs/serve_index.js.html @@ -1,36 +1,37 @@ + - - JSDoc: Source: serve/index.js + + JSDoc: Source: serve/index.js - - - - - + + -
+
+ +

Source: serve/index.js

-

Source: serve/index.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const inquirer = require("inquirer");
 const path = require("path");
-const chalk = require("chalk");
+const color = require("turbocolor");
 const spawn = require("cross-spawn");
 const List = require("@webpack-cli/webpack-scaffold").List;
 const processPromise = require("@webpack-cli/utils/resolve-packages")
@@ -85,7 +86,7 @@ 

Source: serve/index.js

if (!packageJSONPath) { console.log( "\n", - chalk.red("✖ Could not find your package.json file"), + color.red("✖ Could not find your package.json file"), "\n" ); process.exit(1); @@ -106,14 +107,14 @@

Source: serve/index.js

if (!WDSPath) { console.log( "\n", - chalk.red( + color.red( "✖ Could not find the webpack-dev-server dependency in node_modules root path" ) ); console.log( - chalk.bold.green(" ✔︎"), + color.bold.green(" ✔︎"), "Try this command:", - chalk.bold.green("rm -rf node_modules && npm install") + color.bold.green("rm -rf node_modules && npm install") ); process.exit(1); } @@ -121,13 +122,13 @@

Source: serve/index.js

} else { process.stdout.write( "\n" + - chalk.bold( + color.bold( "✖ We didn't find any webpack-dev-server dependency in your project," ) + "\n" + - chalk.bold.green(" 'webpack serve'") + + color.bold.green(" 'webpack serve'") + " " + - chalk.bold("requires you to have it installed ") + + color.bold("requires you to have it installed ") + "\n\n" ); return inquirer @@ -182,12 +183,12 @@

Source: serve/index.js

}); }); } else { - console.log(chalk.bold.red("✖ Serve aborted due cancelling")); + console.log(color.bold.red("✖ Serve aborted due cancelling")); process.exitCode = 1; } }) .catch(err => { - console.log(chalk.red("✖ Serve aborted due to some errors")); + console.log(color.red("✖ Serve aborted due to some errors")); console.error(err); process.exitCode = 1; }); @@ -201,25 +202,173 @@

Source: serve/index.js

spawnYarnWithArg };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/utils_modify-config-helper.js.html b/docs/utils_modify-config-helper.js.html index 27e0563c81a..70f0f7d0051 100644 --- a/docs/utils_modify-config-helper.js.html +++ b/docs/utils_modify-config-helper.js.html @@ -1,36 +1,37 @@ + - - JSDoc: Source: utils/modify-config-helper.js + + JSDoc: Source: utils/modify-config-helper.js - - - - - + + -
+
+ +

Source: utils/modify-config-helper.js

-

Source: utils/modify-config-helper.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const fs = require("fs");
 const path = require("path");
-const chalk = require("chalk");
+const color = require("turbocolor");
 const yeoman = require("yeoman-environment");
 const runTransform = require("./scaffold");
 const Generator = require("yeoman-generator");
@@ -81,10 +82,10 @@ 

Source: utils/modify-config-helper.js

configModule = tmpConfig; } catch (err) { console.error( - chalk.red("\nCould not find a yeoman configuration file.\n") + color.red("\nCould not find a yeoman configuration file.\n") ); console.error( - chalk.red( + color.red( "\nPlease make sure to use 'this.config.set('configuration', this.configuration);' at the end of the generator.\n" ) ); @@ -102,25 +103,173 @@

Source: utils/modify-config-helper.js

}); };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/utils_npm-packages-exists.js.html b/docs/utils_npm-packages-exists.js.html index ac5f0c43a0c..c82bcef80b2 100644 --- a/docs/utils_npm-packages-exists.js.html +++ b/docs/utils_npm-packages-exists.js.html @@ -1,33 +1,34 @@ + - - JSDoc: Source: utils/npm-packages-exists.js + + JSDoc: Source: utils/npm-packages-exists.js - - - - - + + -
+
+ +

Source: utils/npm-packages-exists.js

-

Source: utils/npm-packages-exists.js

- - -
-
-
"use strict";
-const chalk = require("chalk");
+
+		
+
+
"use strict";
+const color = require("turbocolor");
 const isLocalPath = require("./is-local-path");
 const npmExists = require("./npm-exists");
 const resolvePackages = require("./resolve-packages").resolvePackages;
@@ -65,8 +66,8 @@ 

Source: utils/npm-packages-exists.js

addon.slice(0, WEBPACK_SCAFFOLD_PREFIX.length) !== WEBPACK_SCAFFOLD_PREFIX ) { throw new TypeError( - chalk.bold(`${addon} isn't a valid name.\n`) + - chalk.red( + color.bold(`${addon} isn't a valid name.\n`) + + color.red( `\nIt should be prefixed with '${WEBPACK_SCAFFOLD_PREFIX}', but have different suffix.\n` ) ); @@ -90,25 +91,173 @@

Source: utils/npm-packages-exists.js

}); };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/utils_resolve-packages.js.html b/docs/utils_resolve-packages.js.html index c276cd54dd3..b8e8900bf52 100644 --- a/docs/utils_resolve-packages.js.html +++ b/docs/utils_resolve-packages.js.html @@ -1,35 +1,36 @@ + - - JSDoc: Source: utils/resolve-packages.js + + JSDoc: Source: utils/resolve-packages.js - - - - - + + -
+
+ +

Source: utils/resolve-packages.js

-

Source: utils/resolve-packages.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const path = require("path");
-const chalk = require("chalk");
+const color = require("turbocolor");
 
 const modifyConfigHelper = require("./modify-config-helper");
 
@@ -88,7 +89,7 @@ 

Source: utils/resolve-packages.js

} catch (err) { console.log(`Cannot find a generator at ${absolutePath}.`); console.log("\nReason:\n"); - console.error(chalk.bold.red(err)); + console.error(color.bold.red(err)); process.exitCode = 1; } @@ -106,14 +107,14 @@

Source: utils/resolve-packages.js

console.log("Package wasn't validated correctly.."); console.log("Submit an issue for", pkg, "if this persists"); console.log("\nReason: \n"); - console.error(chalk.bold.red(err)); + console.error(color.bold.red(err)); process.exitCode = 1; } }) .catch(err => { console.log("Package couldn't be installed, aborting.."); console.log("\nReason: \n"); - console.error(chalk.bold.red(err)); + console.error(color.bold.red(err)); process.exitCode = 1; }) .then(invokeGeneratorIfReady); @@ -125,25 +126,173 @@

Source: utils/resolve-packages.js

processPromise };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/docs/utils_run-prettier.js.html b/docs/utils_run-prettier.js.html index 7c9cf919f41..0df1b5442d3 100644 --- a/docs/utils_run-prettier.js.html +++ b/docs/utils_run-prettier.js.html @@ -1,36 +1,37 @@ + - - JSDoc: Source: utils/run-prettier.js + + JSDoc: Source: utils/run-prettier.js - - - - - + + -
+
+ +

Source: utils/run-prettier.js

+ -

Source: utils/run-prettier.js

- - -
-
-
"use strict";
+		
+
+
"use strict";
 
 const prettier = require("prettier");
 const fs = require("fs");
-const chalk = require("chalk");
+const color = require("turbocolor");
 
 /**
  *
@@ -55,7 +56,7 @@ 

Source: utils/run-prettier.js

} catch (err) { process.stdout.write( "\n" + - chalk.yellow( + color.yellow( `WARNING: Could not apply prettier to ${outputPath}` + " due validation error, but the file has been created\n" ) @@ -71,25 +72,173 @@

Source: utils/run-prettier.js

return fs.writeFile(outputPath, source, "utf8", validateConfig); };
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
- - - + + + + + + +
+ + + +
+ +
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
+ + + + diff --git a/docs/utils_scaffold.js.html b/docs/utils_scaffold.js.html index d41f4d87439..fd232a3c375 100644 --- a/docs/utils_scaffold.js.html +++ b/docs/utils_scaffold.js.html @@ -1,36 +1,37 @@ + - - JSDoc: Source: utils/scaffold.js + + JSDoc: Source: utils/scaffold.js - - - - - + + -
+
+ +

Source: utils/scaffold.js

-

Source: utils/scaffold.js

- - -
-
-
"use strict";
+
+		
+
+
"use strict";
 
 const path = require("path");
 const j = require("jscodeshift");
-const chalk = require("chalk");
+const color = require("turbocolor");
 const pEachSeries = require("p-each-series");
 
 const runPrettier = require("./run-prettier");
@@ -113,7 +114,7 @@ 

Source: utils/scaffold.js

if (initActionNotDefined && webpackProperties.config.item) { process.stdout.write( "\n" + - chalk.green( + color.green( `Congratulations! ${ webpackProperties.config.item } has been ${action}ed!\n` @@ -122,32 +123,180 @@

Source: utils/scaffold.js

} else { process.stdout.write( "\n" + - chalk.green( + color.green( "Congratulations! Your new webpack configuration file has been created!\n" ) ); } };
-
-
+
+
-
+
- + -
+
-
- Documentation generated by JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) -
+
+ Documentation generated by + JSDoc 3.5.5 on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST) +
- - + + + diff --git a/package-lock.json b/package-lock.json index c80a8f2436a..0bc99b04fed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18262,6 +18262,11 @@ "safe-buffer": "^5.0.1" } }, + "turbocolor": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/turbocolor/-/turbocolor-2.0.1.tgz", + "integrity": "sha1-AKmOAJ3Bhzd/kLL6bxqcl+ME4OM=" + }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", diff --git a/package.json b/package.json index f2019bc71ed..5053790a1b0 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ } }, "dependencies": { - "chalk": "^2.4.1", + "turbocolor": "^2.0.1", "cross-spawn": "^6.0.5", "enhanced-resolve": "^4.0.0", "global-modules-path": "^2.1.0", diff --git a/packages/generators/init-generator.js b/packages/generators/init-generator.js index 39197a86127..cf3ac58ee49 100644 --- a/packages/generators/init-generator.js +++ b/packages/generators/init-generator.js @@ -1,7 +1,7 @@ "use strict"; const Generator = require("yeoman-generator"); -const chalk = require("chalk"); +const color = require("turbocolor"); const logSymbols = require("log-symbols"); const Input = require("@webpack-cli/webpack-scaffold").Input; @@ -53,16 +53,16 @@ module.exports = class InitGenerator extends Generator { process.stdout.write( "\n" + logSymbols.info + - chalk.blue(" INFO ") + + color.blue(" INFO ") + "For more information and a detailed description of each question, have a look at " + - chalk.bold.green( + color.bold.green( "https://github.com/webpack/webpack-cli/blob/master/INIT.md" ) + "\n" ); process.stdout.write( logSymbols.info + - chalk.blue(" INFO ") + + color.blue(" INFO ") + "Alternatively, run `webpack(-cli) --help` for usage info." + "\n\n" ); diff --git a/packages/generators/package.json b/packages/generators/package.json index ba96df5bb1d..456970c3241 100644 --- a/packages/generators/package.json +++ b/packages/generators/package.json @@ -12,7 +12,7 @@ "dependencies": { "@webpack-cli/utils": "^0.0.8", "@webpack-cli/webpack-scaffold": "^0.0.8", - "chalk": "^2.4.1", + "turbocolor": "^2.0.1", "glob-all": "^3.1.0", "inquirer-autocomplete-prompt": "^0.12.2", "lodash": "^4.17.10", diff --git a/packages/init/init.js b/packages/init/init.js index fdbb4db9d23..9a6627c6210 100644 --- a/packages/init/init.js +++ b/packages/init/init.js @@ -2,7 +2,7 @@ const path = require("path"); const j = require("jscodeshift"); -const chalk = require("chalk"); +const color = require("turbocolor"); const pEachSeries = require("p-each-series"); const runPrettier = require("@webpack-cli/utils/run-prettier"); @@ -77,7 +77,7 @@ module.exports = function runTransform(webpackProperties, action) { if (initActionNotDefined && webpackProperties.config.item) { process.stdout.write( "\n" + - chalk.green( + color.green( `Congratulations! ${ webpackProperties.config.item } has been ${action}ed!\n` @@ -86,7 +86,7 @@ module.exports = function runTransform(webpackProperties, action) { } else { process.stdout.write( "\n" + - chalk.green( + color.green( "Congratulations! Your new webpack configuration file has been created!\n" ) ); diff --git a/packages/init/package.json b/packages/init/package.json index 5e4a006f01d..08a829fee6f 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -11,7 +11,7 @@ "dependencies": { "@webpack-cli/generators": "^0.0.8", "@webpack-cli/utils": "^0.0.8", - "chalk": "^2.4.1", + "turbocolor": "^2.0.1", "jscodeshift": "^0.5.0", "p-each-series": "^1.0.0" } diff --git a/packages/migrate/index.js b/packages/migrate/index.js index 3fc5ac3892f..0fa54d32db1 100644 --- a/packages/migrate/index.js +++ b/packages/migrate/index.js @@ -2,7 +2,7 @@ const fs = require("fs"); const path = require("path"); -const chalk = require("chalk"); +const color = require("turbocolor"); const diff = require("diff"); const inquirer = require("inquirer"); const PLazy = require("p-lazy"); @@ -28,7 +28,7 @@ module.exports = function migrate(...args) { const filePaths = args.slice(3); if (!filePaths.length) { const errMsg = "\n ✖ Please specify a path to your webpack config \n "; - console.error(chalk.red(errMsg)); + console.error(color.red(errMsg)); return; } const currentConfigPath = path.resolve(process.cwd(), filePaths[0]); @@ -48,7 +48,7 @@ module.exports = function migrate(...args) { ]) .then(ans => { if (!ans["confirmPath"]) { - console.error(chalk.red("✖ ︎Migration aborted due no output path")); + console.error(color.red("✖ ︎Migration aborted due no output path")); return; } outputConfigPath = path.resolve(process.cwd(), filePaths[0]); @@ -122,9 +122,9 @@ function runMigration(currentConfigPath, outputConfigPath) { const diffOutput = diff.diffLines(ctx.source, result); diffOutput.forEach(diffLine => { if (diffLine.added) { - process.stdout.write(chalk.green(`+ ${diffLine.value}`)); + process.stdout.write(color.green(`+ ${diffLine.value}`)); } else if (diffLine.removed) { - process.stdout.write(chalk.red(`- ${diffLine.value}`)); + process.stdout.write(color.red(`- ${diffLine.value}`)); } }); return inquirer @@ -149,7 +149,7 @@ function runMigration(currentConfigPath, outputConfigPath) { } ]); } else { - console.log(chalk.red("✖ Migration aborted")); + console.log(color.red("✖ Migration aborted")); } }) .then(answer => { @@ -167,7 +167,7 @@ function runMigration(currentConfigPath, outputConfigPath) { ); if (webpackOptionsValidationErrors.length) { console.log( - chalk.red( + color.red( "\n✖ Your configuration validation wasn't successful \n" ) ); @@ -179,17 +179,17 @@ function runMigration(currentConfigPath, outputConfigPath) { } } console.log( - chalk.green( + color.green( `\n✔︎ New webpack config file is at ${outputConfigPath}.` ) ); console.log( - chalk.green( + color.green( "✔︎ Heads up! Updating to the latest version could contain breaking changes." ) ); console.log( - chalk.green( + color.green( "✔︎ Plugin and loader dependencies may need to be updated." ) ); @@ -197,7 +197,7 @@ function runMigration(currentConfigPath, outputConfigPath) { }) .catch(err => { const errMsg = "\n ✖ ︎Migration aborted due to some errors: \n"; - console.error(chalk.red(errMsg)); + console.error(color.red(errMsg)); console.error(err); process.exitCode = 1; }); diff --git a/packages/migrate/package.json b/packages/migrate/package.json index 78f596f1262..25601043805 100644 --- a/packages/migrate/package.json +++ b/packages/migrate/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@webpack-cli/utils": "^0.0.8", - "chalk": "^2.4.1", + "turbocolor": "^2.0.1", "diff": "^3.5.0", "inquirer": "^5.2.0", "jscodeshift": "^0.5.0", diff --git a/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js b/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js index 4945b1841d5..ee17c0ef017 100644 --- a/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js +++ b/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.js @@ -1,4 +1,4 @@ -const chalk = require("chalk"); +const color = require("turbocolor"); const utils = require("@webpack-cli/utils/ast-utils"); /** @@ -35,8 +35,8 @@ module.exports = function(j, ast, source) { } } else { console.log(` -${chalk.red("Please remove deprecated plugins manually. ")} -See ${chalk.underline( +${color.red("Please remove deprecated plugins manually. ")} +See ${color.underline( "https://webpack.js.org/guides/migrating/" )} for more information.`); } diff --git a/packages/serve/index.js b/packages/serve/index.js index 16f4ff89a4a..4206f258ac1 100644 --- a/packages/serve/index.js +++ b/packages/serve/index.js @@ -2,7 +2,7 @@ const inquirer = require("inquirer"); const path = require("path"); -const chalk = require("chalk"); +const color = require("turbocolor"); const spawn = require("cross-spawn"); const List = require("@webpack-cli/webpack-scaffold").List; const processPromise = require("@webpack-cli/utils/resolve-packages") @@ -57,7 +57,7 @@ function serve() { if (!packageJSONPath) { console.log( "\n", - chalk.red("✖ Could not find your package.json file"), + color.red("✖ Could not find your package.json file"), "\n" ); process.exit(1); @@ -78,14 +78,14 @@ function serve() { if (!WDSPath) { console.log( "\n", - chalk.red( + color.red( "✖ Could not find the webpack-dev-server dependency in node_modules root path" ) ); console.log( - chalk.bold.green(" ✔︎"), + color.bold.green(" ✔︎"), "Try this command:", - chalk.bold.green("rm -rf node_modules && npm install") + color.bold.green("rm -rf node_modules && npm install") ); process.exit(1); } @@ -93,14 +93,14 @@ function serve() { } else { process.stdout.write( "\n" + - chalk.bold( - "✖ We didn't find any webpack-dev-server dependency in your project," - ) + - "\n" + - chalk.bold.green(" 'webpack serve'") + - " " + - chalk.bold("requires you to have it installed ") + - "\n\n" + color.bold( + "✖ We didn't find any webpack-dev-server dependency in your project," + ) + + "\n" + + color.bold.green(" 'webpack serve'") + + " " + + color.bold("requires you to have it installed ") + + "\n\n" ); return inquirer .prompt([ @@ -154,12 +154,12 @@ function serve() { }); }); } else { - console.log(chalk.bold.red("✖ Serve aborted due cancelling")); + console.log(color.bold.red("✖ Serve aborted due cancelling")); process.exitCode = 1; } }) .catch(err => { - console.log(chalk.red("✖ Serve aborted due to some errors")); + console.log(color.red("✖ Serve aborted due to some errors")); console.error(err); process.exitCode = 1; }); diff --git a/packages/serve/package.json b/packages/serve/package.json index 53cfdb8058c..14760e8951b 100644 --- a/packages/serve/package.json +++ b/packages/serve/package.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@webpack-cli/webpack-scaffold": "^0.0.8", - "chalk": "^2.4.1", + "turbocolor": "^2.0.1", "cross-spawn": "^6.0.5", "inquirer": "^5.2.0" } diff --git a/packages/utils/modify-config-helper.js b/packages/utils/modify-config-helper.js index 6c47514ea63..ccb36b3b9b0 100644 --- a/packages/utils/modify-config-helper.js +++ b/packages/utils/modify-config-helper.js @@ -2,7 +2,7 @@ const fs = require("fs"); const path = require("path"); -const chalk = require("chalk"); +const color = require("turbocolor"); const yeoman = require("yeoman-environment"); const Generator = require("yeoman-generator"); const logSymbols = require("log-symbols"); @@ -29,22 +29,22 @@ module.exports = function modifyHelperUtil(action, generator, configFile, packag if (webpackConfigExists) { process.stdout.write( "\n" + - logSymbols.success + - chalk.green(" SUCCESS ") + - "Found config " + - chalk.cyan(configFile + "\n") + - "\n" + logSymbols.success + + color.green(" SUCCESS ") + + "Found config " + + color.cyan(configFile + "\n") + + "\n" ); } else { process.stdout.write( "\n" + - logSymbols.error + - chalk.red(" ERROR ") + - chalk.cyan(configFile) + - " not found. Please specify a valid path to your webpack config like " + - chalk.white("$ ") + - chalk.cyan(`webpack-cli ${action} webpack.dev.js`) + - "\n" + logSymbols.error + + color.red(" ERROR ") + + color.cyan(configFile) + + " not found. Please specify a valid path to your webpack config like " + + color.white("$ ") + + color.cyan(`webpack-cli ${action} webpack.dev.js`) + + "\n" ); return; } @@ -80,10 +80,10 @@ module.exports = function modifyHelperUtil(action, generator, configFile, packag configModule = tmpConfig; } catch (err) { console.error( - chalk.red("\nCould not find a yeoman configuration file.\n") + color.red("\nCould not find a yeoman configuration file.\n") ); console.error( - chalk.red( + color.red( "\nPlease make sure to use 'this.config.set('configuration', this.configuration);' at the end of the generator.\n" ) ); diff --git a/packages/utils/npm-packages-exists.js b/packages/utils/npm-packages-exists.js index 054674140fe..06c166a8733 100644 --- a/packages/utils/npm-packages-exists.js +++ b/packages/utils/npm-packages-exists.js @@ -1,5 +1,5 @@ "use strict"; -const chalk = require("chalk"); +const color = require("turbocolor"); const isLocalPath = require("./is-local-path"); const npmExists = require("./npm-exists"); const resolvePackages = require("./resolve-packages").resolvePackages; @@ -37,10 +37,10 @@ module.exports = function npmPackagesExists(pkg) { addon.slice(0, WEBPACK_SCAFFOLD_PREFIX.length) !== WEBPACK_SCAFFOLD_PREFIX ) { throw new TypeError( - chalk.bold(`${addon} isn't a valid name.\n`) + - chalk.red( - `\nIt should be prefixed with '${WEBPACK_SCAFFOLD_PREFIX}', but have different suffix.\n` - ) + color.bold(`${addon} isn't a valid name.\n`) + + color.red( + `\nIt should be prefixed with '${WEBPACK_SCAFFOLD_PREFIX}', but have different suffix.\n` + ) ); } diff --git a/packages/utils/package.json b/packages/utils/package.json index cc3addb5af9..b5a423587f6 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -12,7 +12,7 @@ "author": "", "license": "MIT", "dependencies": { - "chalk": "^2.4.1", + "turbocolor": "^2.0.1", "cross-spawn": "^6.0.5", "global-modules": "^1.0.0", "got": "^8.3.1", diff --git a/packages/utils/resolve-packages.js b/packages/utils/resolve-packages.js index efb432faa96..52a62a95fa6 100644 --- a/packages/utils/resolve-packages.js +++ b/packages/utils/resolve-packages.js @@ -1,7 +1,7 @@ "use strict"; const path = require("path"); -const chalk = require("chalk"); +const color = require("turbocolor"); const modifyConfigHelper = require("./modify-config-helper"); @@ -60,7 +60,7 @@ function resolvePackages(pkg) { } catch (err) { console.log(`Cannot find a generator at ${absolutePath}.`); console.log("\nReason:\n"); - console.error(chalk.bold.red(err)); + console.error(color.bold.red(err)); process.exitCode = 1; } @@ -78,14 +78,14 @@ function resolvePackages(pkg) { console.log("Package wasn't validated correctly.."); console.log("Submit an issue for", pkg, "if this persists"); console.log("\nReason: \n"); - console.error(chalk.bold.red(err)); + console.error(color.bold.red(err)); process.exitCode = 1; } }) .catch(err => { console.log("Package couldn't be installed, aborting.."); console.log("\nReason: \n"); - console.error(chalk.bold.red(err)); + console.error(color.bold.red(err)); process.exitCode = 1; }) .then(invokeGeneratorIfReady); diff --git a/packages/utils/run-prettier.js b/packages/utils/run-prettier.js index 99e64003ced..b07e3f2d11f 100644 --- a/packages/utils/run-prettier.js +++ b/packages/utils/run-prettier.js @@ -2,7 +2,7 @@ const prettier = require("prettier"); const fs = require("fs"); -const chalk = require("chalk"); +const color = require("turbocolor"); /** * @@ -27,10 +27,10 @@ module.exports = function runPrettier(outputPath, source, cb) { } catch (err) { process.stdout.write( "\n" + - chalk.yellow( - `WARNING: Could not apply prettier to ${outputPath}` + - " due validation error, but the file has been created\n" - ) + color.yellow( + `WARNING: Could not apply prettier to ${outputPath}` + + " due validation error, but the file has been created\n" + ) ); prettySource = source; error = err; diff --git a/packages/utils/scaffold.js b/packages/utils/scaffold.js index deb395a6142..33d77a5280f 100644 --- a/packages/utils/scaffold.js +++ b/packages/utils/scaffold.js @@ -2,7 +2,7 @@ const path = require("path"); const j = require("jscodeshift"); -const chalk = require("chalk"); +const color = require("turbocolor"); const pEachSeries = require("p-each-series"); const runPrettier = require("./run-prettier"); @@ -85,7 +85,7 @@ module.exports = function runTransform(webpackProperties, action) { if (initActionNotDefined && webpackProperties.config.item) { process.stdout.write( "\n" + - chalk.green( + color.green( `Congratulations! ${ webpackProperties.config.item } has been ${action}ed!\n` @@ -94,7 +94,7 @@ module.exports = function runTransform(webpackProperties, action) { } else { process.stdout.write( "\n" + - chalk.green( + color.green( "Congratulations! Your new webpack configuration file has been created!\n" ) );