cleanup(web): migrate to picocolors (#28039)

This commit is contained in:
James Garbutt 2024-09-23 17:01:34 +07:00 committed by GitHub
parent 0d50b13a25
commit 246494ae2d
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"], "files": ["**/*.ts"],

View File

@ -31,9 +31,9 @@
"migrations": "./migrations.json" "migrations": "./migrations.json"
}, },
"dependencies": { "dependencies": {
"chalk": "^4.1.0",
"detect-port": "^1.5.1", "detect-port": "^1.5.1",
"http-server": "^14.1.0", "http-server": "^14.1.0",
"picocolors": "^1.1.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"@nx/devkit": "file:../devkit", "@nx/devkit": "file:../devkit",
"@nx/js": "file:../js" "@nx/js": "file:../js"

View File

@ -1,5 +1,5 @@
import { execFileSync, fork } from 'child_process'; import { execFileSync, fork } from 'child_process';
import * as chalk from 'chalk'; import * as pc from 'picocolors';
import { import {
ExecutorContext, ExecutorContext,
output, output,
@ -176,7 +176,7 @@ export default async function* fileServerExecutor(
}); });
} catch { } catch {
throw new Error( throw new Error(
`Build target failed: ${chalk.bold(options.buildTarget)}` `Build target failed: ${pc.bold(options.buildTarget)}`
); );
} finally { } finally {
process.env.NX_SERVE_STATIC_BUILD_RUNNING = undefined; process.env.NX_SERVE_STATIC_BUILD_RUNNING = undefined;