cleanup(misc): migrate from chalk to picocolors (#27967)

This commit is contained in:
James Garbutt 2024-09-20 19:08:44 +07:00 committed by GitHub
parent e9fd0a7e2b
commit 0d37ef98da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21128 additions and 17408 deletions

View File

@ -247,6 +247,7 @@
"ora": "5.3.0", "ora": "5.3.0",
"parse-markdown-links": "^1.0.4", "parse-markdown-links": "^1.0.4",
"parse5": "4.0.0", "parse5": "4.0.0",
"picocolors": "^1.1.0",
"piscina": "^4.4.0", "piscina": "^4.4.0",
"postcss": "8.4.38", "postcss": "8.4.38",
"postcss-import": "~14.1.0", "postcss-import": "~14.1.0",

View File

@ -15,7 +15,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

@ -1,5 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
import chalk = require('chalk'); import * as pc from 'picocolors';
import enquirer = require('enquirer'); import enquirer = require('enquirer');
import yargs = require('yargs'); import yargs = require('yargs');
@ -26,16 +26,16 @@ import {
} from 'create-nx-workspace/src/utils/nx/ab-testing'; } from 'create-nx-workspace/src/utils/nx/ab-testing';
export const yargsDecorator = { export const yargsDecorator = {
'Options:': `${chalk.green`Options`}:`, 'Options:': `${pc.green(`Options`)}:`,
'Examples:': `${chalk.green`Examples`}:`, 'Examples:': `${pc.green(`Examples`)}:`,
boolean: `${chalk.blue`boolean`}`, boolean: `${pc.blue(`boolean`)}`,
count: `${chalk.blue`count`}`, count: `${pc.blue(`count`)}`,
string: `${chalk.blue`string`}`, string: `${pc.blue(`string`)}`,
array: `${chalk.blue`array`}`, array: `${pc.blue(`array`)}`,
required: `${chalk.blue`required`}`, required: `${pc.blue(`required`)}`,
'default:': `${chalk.blue`default`}:`, 'default:': `${pc.blue(`default`)}:`,
'choices:': `${chalk.blue`choices`}:`, 'choices:': `${pc.blue(`choices`)}:`,
'aliases:': `${chalk.blue`aliases`}:`, 'aliases:': `${pc.blue(`aliases`)}:`,
}; };
const nxVersion = require('../package.json').version; const nxVersion = require('../package.json').version;
@ -97,7 +97,7 @@ export const commandsObject: yargs.Argv<CreateNxPluginArguments> = yargs
withOptions( withOptions(
yargs yargs
.positional('pluginName', { .positional('pluginName', {
describe: chalk.dim`Plugin name`, describe: pc.dim(`Plugin name`),
type: 'string', type: 'string',
alias: ['name'], alias: ['name'],
}) })
@ -121,11 +121,11 @@ export const commandsObject: yargs.Argv<CreateNxPluginArguments> = yargs
}, },
[normalizeArgsMiddleware] [normalizeArgsMiddleware]
) )
.help('help', chalk.dim`Show help`) .help('help', pc.dim(`Show help`))
.updateLocale(yargsDecorator) .updateLocale(yargsDecorator)
.version( .version(
'version', 'version',
chalk.dim`Show version`, pc.dim(`Show version`),
nxVersion nxVersion
) as yargs.Argv<CreateNxPluginArguments>; ) as yargs.Argv<CreateNxPluginArguments>;

View File

@ -30,7 +30,7 @@
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"dependencies": { "dependencies": {
"create-nx-workspace": "file:../create-nx-workspace", "create-nx-workspace": "file:../create-nx-workspace",
"chalk": "^4.1.0", "picocolors": "^1.1.0",
"enquirer": "~2.3.6", "enquirer": "~2.3.6",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"yargs": "^17.6.2" "yargs": "^17.6.2"

38495
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff