Package Exports
- @nkp/ansi
Readme
#packages @nkp/ansi
ANSI escape codes for styling strings in the terminal.
You probably want the higher-level chalk module for styling your strings.
Fork of ansi-styles that supports both ESM and CommonJS.
Table of contents
Fork
@nkp/ansi is a fork of ansi-styles that exports both ESM and CommonJS.
In 2021 Sindre Sorhus, prolific creator and maintainer of many popular npm packages, including some with over 150 million weekly monthly downloads, pushed a new major version of many of his packages removing CommonJS support and making them "pure ESM". This was a major breaking change. Sindre's universally popular packages were now incompatible with a large parts of the NodeJS ecosystem.
Sindre's packages could have been kept backwards compatible by producing both ESM and CJS exports, however Sindre believed he could push the NodeJS community to adopt ESM sooner by introducing breaking changes.
Personally, I plan to (migrate to Pure ESM instead of provide backwards compatibility) as I think it’s better to rip off the bandaid and push the ecosystem forward.
For many, the breaking change's haven't gone over well. Many project's now find themselves spending hours, days or even weeks trying to placate these pure EMS packages only to find too many incompatibilities and revert back.
Hence this fork. @nkp/ansi is intended to be an functionally equivalent clone of styles-ansi but with both ESM and CJS exports.
Installation
npm
npm install @nkp/ansiyarn
yarn add @nkp/ansipnpm
pnpm add @nkp/ansiExports
@nkp/ansi targets CommonJS and ES modules. To utilise ES modules consider using a bundler or setting package.json#module to module.
Updating dependencies
To update dependencies run one of
# if npm
# update package.json
npx npm-check-updates -u
# install
npm install
# if yarn
# update package.json
yarn create npm-check-updates -u
# install
yarn
# if pnpm
# update package.json
pnpx npm-check-updates -u
# install
pnpm installPublishing
To a release a new version:
- Update the version number in package.json
- Push the new version to the
masterbranch on GitHub - Create a
new releaseon GitHub for the latest version
This will trigger a GitHub action that tests and publishes the npm package.