cleanup(misc): migrate rollup to picocolors (#28186)

This commit is contained in:
James Garbutt 2024-10-01 18:07:49 +07:00 committed by GitHub
parent 74061cf5ef
commit 2f09285b30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View File

@ -4,7 +4,15 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {} "rules": {
"no-restricted-imports": [
"error",
{
"name": "chalk",
"message": "Please use `picocolors` in place of `chalk` for rendering terminal colors"
}
]
}
}, },
{ {
"files": ["*.ts", "*.tsx"], "files": ["*.ts", "*.tsx"],

View File

@ -35,8 +35,8 @@
"@rollup/plugin-json": "^6.1.0", "@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"autoprefixer": "^10.4.9", "autoprefixer": "^10.4.9",
"chalk": "^4.1.0",
"minimatch": "9.0.3", "minimatch": "9.0.3",
"picocolors": "^1.1.0",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"rollup": "^4.14.0", "rollup": "^4.14.0",
"rollup-plugin-copy": "^3.5.0", "rollup-plugin-copy": "^3.5.0",

View File

@ -1,4 +1,4 @@
import * as chalk from 'chalk'; import * as pc from 'picocolors';
import { logger } from '@nx/devkit'; import { logger } from '@nx/devkit';
const formatBytes = (bytes) => { const formatBytes = (bytes) => {
@ -16,7 +16,7 @@ export function analyze() {
renderChunk(source, chunk) { renderChunk(source, chunk) {
const sourceBytes = formatBytes(source.length); const sourceBytes = formatBytes(source.length);
const fileName = chunk.fileName; const fileName = chunk.fileName;
logger.info(` ${chalk.bold(fileName)} ${chalk.cyan(sourceBytes)}`); logger.info(` ${pc.bold(fileName)} ${pc.cyan(sourceBytes)}`);
}, },
}; };
} }