Skip to content

Commit

Permalink
chore(next-codemod): replace chalk with picocolors (#70984)
Browse files Browse the repository at this point in the history
### Why?

We already had `picocolors` in our deps. `picocolors` is lighter than `chalk`, and we use it on Next and CNA.
  • Loading branch information
devjiwonchoi authored and kdy1 committed Oct 10, 2024
1 parent d428890 commit ab2fe99
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
12 changes: 6 additions & 6 deletions packages/next-codemod/bin/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs'
import { execSync } from 'child_process'
import path from 'path'
import { compareVersions } from 'compare-versions'
import chalk from 'chalk'
import pc from 'picocolors'
import { getPkgManager, installPackages } from '../lib/handle-package'
import { runTransform } from './transform'
import { onCancel, TRANSFORMER_INQUIRER_CHOICES } from '../lib/utils'
Expand Down Expand Up @@ -53,7 +53,7 @@ export async function runUpgrade(
'peerDependencies' in targetNextPackageJson
if (!validRevision) {
throw new Error(
`${chalk.yellow(`next@${revision}`)} does not exist. Make sure you entered a valid Next.js version or dist-tag. Check available versions at ${chalk.underline('https://www.npmjs.com/package/next?activeTab=versions')}.`
`${pc.yellow(`next@${revision}`)} does not exist. Make sure you entered a valid Next.js version or dist-tag. Check available versions at ${pc.underline('https://www.npmjs.com/package/next?activeTab=versions')}.`
)
}

Expand Down Expand Up @@ -112,7 +112,7 @@ export async function runUpgrade(
}

console.log(
`Upgrading your project to ${chalk.blue('Next.js ' + targetNextVersion)}...\n`
`Upgrading your project to ${pc.blue('Next.js ' + targetNextVersion)}...\n`
)

installPackages([nextDependency, ...reactDependencies], {
Expand All @@ -125,7 +125,7 @@ export async function runUpgrade(
}

console.log(
`\n${chalk.green('✔')} Your Next.js project has been upgraded successfully. ${chalk.bold('Time to ship! 🚢')}`
`\n${pc.green('✔')} Your Next.js project has been upgraded successfully. ${pc.bold('Time to ship! 🚢')}`
)
}

Expand Down Expand Up @@ -184,7 +184,7 @@ async function suggestTurbopack(packageJson: any): Promise<void> {
}

console.log(
`${chalk.yellow('⚠')} Could not find "${chalk.bold('next dev')}" in your dev script.`
`${pc.yellow('⚠')} Could not find "${pc.bold('next dev')}" in your dev script.`
)

const responseCustomDevScript = await prompts(
Expand Down Expand Up @@ -234,7 +234,7 @@ async function suggestCodemods(
{
type: 'multiselect',
name: 'codemods',
message: `The following ${chalk.blue('codemods')} are recommended for your upgrade. Select the ones to apply.`,
message: `The following ${pc.blue('codemods')} are recommended for your upgrade. Select the ones to apply.`,
choices: relevantCodemods.reverse().map(({ title, value, version }) => {
return {
title: `(v${version}) ${value}`,
Expand Down
1 change: 0 additions & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"directory": "packages/next-codemod"
},
"dependencies": {
"chalk": "4.1.2",
"cheerio": "1.0.0-rc.9",
"commander": "12.1.0",
"compare-versions": "6.1.1",
Expand Down
Loading

0 comments on commit ab2fe99

Please sign in to comment.