Skip to content

Commit

Permalink
cleanup(misc): migrate from chalk to picocolors (#27967)
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored Sep 20, 2024
1 parent e9fd0a7 commit 0d37ef9
Show file tree
Hide file tree
Showing 5 changed files with 20,704 additions and 16,984 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
"ora": "5.3.0",
"parse-markdown-links": "^1.0.4",
"parse5": "4.0.0",
"picocolors": "^1.1.0",
"piscina": "^4.4.0",
"postcss": "8.4.38",
"postcss-import": "~14.1.0",
Expand Down
10 changes: 9 additions & 1 deletion packages/create-nx-plugin/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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
28 changes: 14 additions & 14 deletions packages/create-nx-plugin/bin/create-nx-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import chalk = require('chalk');
import * as pc from 'picocolors';
import enquirer = require('enquirer');
import yargs = require('yargs');

Expand All @@ -26,16 +26,16 @@ import {
} from 'create-nx-workspace/src/utils/nx/ab-testing';

export const yargsDecorator = {
'Options:': `${chalk.green`Options`}:`,
'Examples:': `${chalk.green`Examples`}:`,
boolean: `${chalk.blue`boolean`}`,
count: `${chalk.blue`count`}`,
string: `${chalk.blue`string`}`,
array: `${chalk.blue`array`}`,
required: `${chalk.blue`required`}`,
'default:': `${chalk.blue`default`}:`,
'choices:': `${chalk.blue`choices`}:`,
'aliases:': `${chalk.blue`aliases`}:`,
'Options:': `${pc.green(`Options`)}:`,
'Examples:': `${pc.green(`Examples`)}:`,
boolean: `${pc.blue(`boolean`)}`,
count: `${pc.blue(`count`)}`,
string: `${pc.blue(`string`)}`,
array: `${pc.blue(`array`)}`,
required: `${pc.blue(`required`)}`,
'default:': `${pc.blue(`default`)}:`,
'choices:': `${pc.blue(`choices`)}:`,
'aliases:': `${pc.blue(`aliases`)}:`,
};

const nxVersion = require('../package.json').version;
Expand Down Expand Up @@ -97,7 +97,7 @@ export const commandsObject: yargs.Argv<CreateNxPluginArguments> = yargs
withOptions(
yargs
.positional('pluginName', {
describe: chalk.dim`Plugin name`,
describe: pc.dim(`Plugin name`),
type: 'string',
alias: ['name'],
})
Expand All @@ -121,11 +121,11 @@ export const commandsObject: yargs.Argv<CreateNxPluginArguments> = yargs
},
[normalizeArgsMiddleware]
)
.help('help', chalk.dim`Show help`)
.help('help', pc.dim(`Show help`))
.updateLocale(yargsDecorator)
.version(
'version',
chalk.dim`Show version`,
pc.dim(`Show version`),
nxVersion
) as yargs.Argv<CreateNxPluginArguments>;

Expand Down
2 changes: 1 addition & 1 deletion packages/create-nx-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepage": "https://nx.dev",
"dependencies": {
"create-nx-workspace": "file:../create-nx-workspace",
"chalk": "^4.1.0",
"picocolors": "^1.1.0",
"enquirer": "~2.3.6",
"tslib": "^2.3.0",
"yargs": "^17.6.2"
Expand Down
Loading

0 comments on commit 0d37ef9

Please sign in to comment.