npm-to-yarn is designed to convert NPM CLI commands to their Yarn equivalents (and vice versa).
npm-to-yarn is super helpful in documentation, for example in generating code tabs.
import convert from 'npm-to-yarn' // or // var convert = require('npm-to-yarn') convert('npm install squirrelly', 'yarn') // yarn add squirrelly
npm-to-yarn exposes a UMD build, so you can also install it with a CDN (it exposes global variable
/** * Converts between npm and yarn command */ export default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm'): string
Tests can be run with
npm test. Multiple tests check that parsing, rendering, and compiling return expected results, formatting follows guidelines, and code coverage is at the expected level.
To be added
This project follows the all-contributors specification. Contributions of any kind are welcome!