Skip to content

Commit

Permalink
cleanup(webpack): migrate to picocolors (#28315)
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored Nov 5, 2024
1 parent 5d21f21 commit e2f5eaa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion packages/webpack/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
"overrides": [
{
"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"],
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"autoprefixer": "^10.4.9",
"babel-loader": "^9.1.2",
"browserslist": "^4.21.4",
"chalk": "^4.1.0",
"picocolors": "^1.1.0",
"copy-webpack-plugin": "^10.2.4",
"css-loader": "^6.4.0",
"css-minimizer-webpack-plugin": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
readTargetOptions,
runExecutor,
} from '@nx/devkit';
import * as chalk from 'chalk';
import * as pc from 'picocolors';
import { combineAsyncIterables } from '@nx/devkit/src/utils/async-iterable';

import { WebpackExecutorOptions } from '../webpack/schema';
Expand Down Expand Up @@ -62,7 +62,7 @@ export async function* ssrDevServerExecutor(
if (nodeStarted && browserBuilt) {
await waitUntilServerIsListening(options.port);
console.log(
`[ ${chalk.green('ready')} ] on http://localhost:${options.port}`
`[ ${pc.green('ready')} ] on http://localhost:${options.port}`
);
yield {
...output,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { logger, type ProjectGraph } from '@nx/devkit';
import { registerTsProject } from '@nx/js/src/internal';
import { findMatchingProjects } from 'nx/src/utils/find-matching-projects';
import * as chalk from 'chalk';
import * as pc from 'picocolors';
import { join } from 'path';
import { existsSync, readFileSync } from 'fs';
import { ModuleFederationConfig } from './models/index';
Expand Down Expand Up @@ -107,7 +107,7 @@ export function getRemotes(
);

logger.info(
`NX Starting module federation dev-server for ${chalk.bold(
`NX Starting module federation dev-server for ${pc.bold(
context.projectName
)} with ${[...knownRemotes, ...knownDynamicRemotes].length} remotes`
);
Expand Down

0 comments on commit e2f5eaa

Please sign in to comment.