npm-to-yarn icon indicating copy to clipboard operation
npm-to-yarn copied to clipboard

feat: add `npx` conversions

Open Jay-Karia opened this issue 1 year ago • 6 comments

This PR adds a new type of conversions (for npx).

The command npx create-next-app is converted into: yarn dlx create-next-app (yarn) pnpm dlx create-next-app (pnpm) bun x create-next-app (bun)

API Usage: To apply this conversions the convert function is modified with a new parameter: executor : boolean with default value false.

function convert(str: string, to: 'npm' | 'yarn' | 'pnpm' | 'bun', executor: boolean = false)

Here's a code example.

convert("npx create-next-app", "yarn", true);
// yarn dlx create-next-app

convert("npx create-next-app", "bun", true);
// bun x create-next-app

Closes #48

Jay-Karia avatar Aug 03 '24 05:08 Jay-Karia