Skip to content

Commit

Permalink
cleanup(react): migrate to picocolors
Browse files Browse the repository at this point in the history
Migrates from `chalk` to `picocolors`.
  • Loading branch information
43081j committed Sep 28, 2024
1 parent f221a41 commit ebf7750
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
10 changes: 9 additions & 1 deletion packages/react/.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"],
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"dependencies": {
"@phenomnomnominal/tsquery": "~5.0.1",
"@svgr/webpack": "^8.0.1",
"chalk": "^4.1.0",
"file-loader": "^6.2.0",
"minimatch": "9.0.3",
"picocolors": "^1.1.0",
"tslib": "^2.3.0",
"@module-federation/enhanced": "~0.6.0",
"@nx/devkit": "file:../devkit",
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { maybeJs } from '../../utils/maybe-js';
import { installCommonDependencies } from './lib/install-common-dependencies';
import { extractTsConfigBase } from '../../utils/create-ts-config';
import { addSwcDependencies } from '@nx/js/src/utils/swc/add-swc-dependencies';
import * as chalk from 'chalk';
import * as pc from 'picocolors';
import { showPossibleWarnings } from './lib/show-possible-warnings';
import { addE2e } from './lib/add-e2e';
import {
Expand Down Expand Up @@ -319,9 +319,9 @@ export async function applicationGeneratorInternal(

if (options.bundler === 'rspack' && options.style === 'styled-jsx') {
logger.warn(
`${chalk.bold('styled-jsx')} is not supported by ${chalk.bold(
`${pc.bold('styled-jsx')} is not supported by ${pc.bold(
'Rspack'
)}. We've added ${chalk.bold(
)}. We've added ${pc.bold(
'babel-loader'
)} to your project, but using babel will slow down your build.`
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as chalk from 'chalk';
import * as pc from 'picocolors';
import { logger, Tree } from '@nx/devkit';
import { NormalizedSchema, Schema } from '../schema';

Expand All @@ -8,7 +8,7 @@ export function showPossibleWarnings(
) {
if (options.style === 'styled-jsx' && options.compiler === 'swc') {
logger.warn(
`styled-jsx may not work with SWC. Try using ${chalk.bold(
`styled-jsx may not work with SWC. Try using ${pc.bold(
'nx g @nx/react:app --compiler=babel'
)} instead.`
);
Expand Down

0 comments on commit ebf7750

Please sign in to comment.