Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHORE: migrate chalk to picocolors #61

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"node": ">=6.11.5"
},
"dependencies": {
"chalk": "^3.0.0",
"picocolors": "^1.0.0",
"fast-glob": "^3.1.1"
}
}
22 changes: 11 additions & 11 deletions src/detect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require("path");
const chalk = require("chalk");
const pico = require("picocolors");
const fs = require("fs");
const fg = require("fast-glob");
const getDirName = path.dirname;
Expand Down Expand Up @@ -139,20 +139,20 @@ function outputUnusedExportMap(compilation, chunk, module, includedFileMap, unus
}

function logUnusedExportMap(unusedExportMap) {
console.log(chalk.yellow("\n--------------------- Unused Exports ---------------------"));
console.log(pico.yellow("\n--------------------- Unused Exports ---------------------"));
if (Object.keys(unusedExportMap).length > 0) {
let numberOfUnusedExport = 0;

Object.keys(unusedExportMap).forEach(modulePath => {
const unusedExports = unusedExportMap[modulePath];

console.log(chalk.yellow(`\n${modulePath}`));
console.log(chalk.yellow(` ⟶ ${unusedExports.join(", ")}`));
console.log(pico.yellow(`\n${modulePath}`));
console.log(pico.yellow(` ⟶ ${unusedExports.join(", ")}`));
numberOfUnusedExport += unusedExports.length;
});
console.log(chalk.yellow(`\nThere are ${numberOfUnusedExport} unused exports (¬º-°)¬.\n`));
console.log(pico.yellow(`\nThere are ${numberOfUnusedExport} unused exports (¬º-°)¬.\n`));
} else {
console.log(chalk.green("\nPerfect, there is nothing to do ٩(◕‿◕。)۶."));
console.log(pico.green("\nPerfect, there is nothing to do ٩(◕‿◕。)۶."));
}
}

Expand Down Expand Up @@ -180,15 +180,15 @@ function convertFilesToDict(assets) {
}

function logUnusedFiles(unusedFiles) {
console.log(chalk.yellow("\n--------------------- Unused Files ---------------------"));
console.log(pico.yellow("\n--------------------- Unused Files ---------------------"));
if (unusedFiles.length > 0) {
unusedFiles.forEach(file => console.log(`\n${chalk.yellow(file)}`));
unusedFiles.forEach(file => console.log(`\n${pico.yellow(file)}`));
console.log(
chalk.yellow(`\nThere are ${unusedFiles.length} unused files (¬º-°)¬.`),
chalk.red.bold(`\n\nPlease be careful if you want to remove them.\n`),
pico.yellow(`\nThere are ${unusedFiles.length} unused files (¬º-°)¬.`),
pico.red.bold(`\n\nPlease be careful if you want to remove them.\n`),
);
} else {
console.log(chalk.green("\nPerfect, there is nothing to do ٩(◕‿◕。)۶."));
console.log(pico.green("\nPerfect, there is nothing to do ٩(◕‿◕。)۶."));
}
}

Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const path = require("path");
const detectDeadcode = require("./detect");

class WebpackDeadcodePlugin {
Expand Down
50 changes: 5 additions & 45 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,13 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"

"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==

ansi-styles@^4.1.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==
dependencies:
"@types/color-name" "^1.1.1"
color-convert "^2.0.1"

braces@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"

chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"

color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==

fast-glob@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.1.tgz#87ee30e9e9f3eb40d6f254a7997655da753d7c82"
Expand Down Expand Up @@ -95,11 +62,6 @@ glob-parent@^5.1.0:
dependencies:
is-glob "^4.0.1"

has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==

is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
Expand Down Expand Up @@ -129,6 +91,11 @@ micromatch@^4.0.2:
braces "^3.0.1"
picomatch "^2.0.5"

picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==

picomatch@^2.0.5:
version "2.2.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.1.tgz#21bac888b6ed8601f831ce7816e335bc779f0a4a"
Expand All @@ -144,13 +111,6 @@ run-parallel@^1.1.9:
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679"
integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==

supports-color@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1"
integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==
dependencies:
has-flag "^4.0.0"

to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
Expand Down