Skip to content

Upgrading chalk 1 to 2

Breaking1.1.3 → 2.4.2Breaking4Platform1New7Changed1Fixed7Other1

BreakingUpgrade verdict

4 breaking changes and a platform requirement change.

  • The chalk.hasColor() helper is gone. Install and use the separate has-ansi package if you need that check.
  • The chalk.stripColor() helper is gone. Install and use the separate strip-ansi package if you need to strip colors.
  • The chalk.styles object is gone. Install and use the separate ansi-styles package if you need the style definitions.
  • If your project installs @types/chalk, remove it, because it conflicts with the types now included in Chalk.
Top 4 of 5 that need code or config changes

Node.js requirement changed in 2.0.0: >=0.10.0 → >=4.

Drops has-ansi, strip-ansi.

Breaking4
Removes chalk.hasColor(); use the has-ansi package directly instead.
chalk.hasColor()
Removes chalk.stripColor(); use the strip-ansi package directly instead.
chalk.stripColor()
Removes chalk.styles; use the ansi-styles package directly instead.
chalk.styles
The built-in types are incompatible with the @types/chalk package if you currently use it.
@types/chalk
Platform1
Requires Node.js 4 or later.