diff --git a/dist/npm-to-yarn.mjs b/dist/npm-to-yarn.mjs index 425037a..9dc124d 100644 --- a/dist/npm-to-yarn.mjs +++ b/dist/npm-to-yarn.mjs @@ -203,7 +203,7 @@ function yarnToNPM(_m, command) { } } -function convertInstallArgs(args) { +function convertInstallArgs$1(args) { if (args.includes('--global') || args.includes('-g')) { args.unshift('global'); } @@ -239,14 +239,14 @@ var npmToYarnTable = { return ['install']; } args[0] = 'add'; - return convertInstallArgs(args); + return convertInstallArgs$1(args); }, i: function (args) { return npmToYarnTable.install(args); }, uninstall: function (args) { args[0] = 'remove'; - return convertInstallArgs(args); + return convertInstallArgs$1(args); }, un: function (args) { return npmToYarnTable.uninstall(args); @@ -485,6 +485,132 @@ function npmToPnpm(_m, command) { } } +function convertInstallArgs(args) { + // bun uses -g and --global flags + // bun mostly conforms to Yarn's CLI + return args.map(function (item) { + switch (item) { + case '--save-dev': + case '--development': + case '-D': + return '--dev'; + case '--save-prod': + case '-P': + return '--production'; + case '--no-package-lock': + return '--no-save'; + case '--save-optional': + case '-O': + return '--optional'; + case '--save-exact': + case '-E': + return '--exact'; + case '--save': + case '-S': + // this is default in bun + return ''; + case '--global': + case '-g': + return '--global'; + default: + return item; + } + }); +} +function npmToBun(_m, command) { + var args = parse((command || '').trim()); + var index = args.findIndex(function (a) { return a === '--'; }); + if (index >= 0) { + args.splice(index, 1); + } + var cmd = 'bun'; + switch (args[0]) { + case 'install': + case 'i': + if (args.length === 1) { + args = ['install']; + } + else { + args[0] = 'add'; + } + args = convertInstallArgs(args); + break; + case 'uninstall': + case 'un': + case 'remove': + case 'r': + case 'rm': + args[0] = 'remove'; + args = convertInstallArgs(args); + break; + case 'cache': + if (args[1] === 'clean') { + args = ['pm', 'cache', 'rm'].concat(args.slice(2)); + } + else { + cmd = 'npm'; + } + break; + case 'rebuild': + case 'rb': + args[0] = 'add'; + args.push('--force'); + break; + case 'run': + break; + case 'list': + case 'ls': + // 'npm ls' => 'bun pm ls' + args = convertInstallArgs(args); + args[0] = 'ls'; + args.unshift('pm'); + break; + case 'init': + case 'create': + if (args[1]) { + if (args[1].startsWith('@')) { + cmd = 'bunx'; + args[1] = args[1].replace('/', '/create-'); + args = args.slice(1); + } + else if (!args[1].startsWith('-')) { + cmd = 'bunx'; + args[1] = "create-".concat(args[1]); + args = args.slice(1); + } + else { + args[0] = 'init'; + } + } + break; + case 'link': + case 'ln': + args = convertInstallArgs(args); + args[0] = 'link'; + break; + case 'stop': + case 'start': + case 'unlink': + break; + case 'test': + case 't': + case 'tst': + args[0] = 'test'; + args.unshift('run'); + break; + case 'exec': + cmd = 'bunx'; + args.splice(0, 1); + break; + default: + // null == keep `npm` command + cmd = 'npm'; + break; + } + var filtered = args.filter(Boolean).filter(function (arg) { return arg !== '--'; }); + return "".concat(cmd, " ").concat(filtered.join(' ')).concat(cmd === 'npm' ? "\n# couldn't auto-convert command" : '').replace('=', ' '); +} + /** * Converts between npm and yarn command */ @@ -495,6 +621,9 @@ function convert(str, to) { else if (to === 'pnpm') { return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToPnpm); } + else if (to === 'bun') { + return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToBun); + } else { return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToYarn); } diff --git a/dist/npm-to-yarn.mjs.map b/dist/npm-to-yarn.mjs.map index b2b07be..87780b2 100644 --- a/dist/npm-to-yarn.mjs.map +++ b/dist/npm-to-yarn.mjs.map @@ -1 +1 @@ -{"version":3,"file":"npm-to-yarn.mjs","sources":["../src/utils.ts","../src/command.ts","../src/yarnToNpm.ts","../src/npmToYarn.ts","../src/npmToPnpm.ts","../src/index.ts"],"sourcesContent":["export const unchangedCLICommands = [\n 'test',\n 'login',\n 'logout',\n 'link',\n 'unlink',\n 'publish',\n 'cache',\n 'start',\n 'stop',\n 'test'\n]\n\nexport const yarnCLICommands = [\n 'init',\n 'run',\n 'add',\n 'audit',\n 'autoclean',\n 'bin',\n 'check',\n 'config',\n 'create',\n 'dedupe',\n 'generate-lock-entry',\n 'global',\n 'help',\n 'import',\n 'info',\n 'install',\n 'licenses',\n 'list',\n 'lockfile',\n 'outdated',\n 'owner',\n 'pack',\n 'policies',\n 'prune',\n 'remove',\n 'self-update',\n 'tag',\n 'team',\n 'upgrade',\n 'upgrade-interactive',\n 'version',\n 'versions',\n 'why',\n 'workspace',\n 'workspaces'\n]\n\nexport const npmCLICommands = [\n 'init',\n 'run',\n 'access',\n 'adduser',\n 'audit',\n 'bin',\n 'bugs',\n 'build',\n 'bundle',\n 'ci',\n 'completion',\n 'config',\n 'dedupe',\n 'deprecate',\n 'dist-tag',\n 'docs',\n 'doctor',\n 'edit',\n 'explore',\n 'exec',\n 'fund',\n 'help-search',\n 'help',\n 'hook',\n 'install-ci-test',\n 'install-test',\n 'install',\n 'ls',\n 'list',\n 'npm',\n 'org',\n 'outdated',\n 'owner',\n 'pack',\n 'ping',\n 'prefix',\n 'profile',\n 'prune',\n 'rebuild',\n 'repo',\n 'restart',\n 'root',\n 'run-script',\n 'search',\n 'shrinkwrap',\n 'star',\n 'stars',\n 'start',\n 'stop',\n 'team',\n 'token',\n 'uninstall',\n 'unpublish',\n 'update',\n 'version',\n 'view',\n 'whoami'\n]\n","export function parse (command: string) {\n const args: string[] = []\n let lastQuote: string | false = false\n let escaped = false\n let part = ''\n for (let i = 0; i < command.length; ++i) {\n const char = command.charAt(i)\n if (char === '\\\\') {\n part += char\n escaped = true\n } else {\n if (char === ' ' && !lastQuote) {\n args.push(part)\n part = ''\n } else if (!escaped && (char === '\"' || char === \"'\")) {\n part += char\n if (char === lastQuote) {\n lastQuote = false\n } else if (!lastQuote) {\n lastQuote = char\n }\n } else {\n part += char\n }\n escaped = false\n }\n }\n args.push(part)\n return args\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertAddRemoveArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--no-lockfile':\n return '--no-package-lock'\n case '--production':\n return '--save-prod'\n case '--dev':\n return '--save-dev'\n case '--optional':\n return '--save-optional'\n case '--exact':\n return '--save-exact'\n default:\n return item\n }\n })\n}\n\nconst yarnToNpmTable = {\n add (args: string[]) {\n if (args.length === 2 && args[1] === '--force') {\n return ['rebuild']\n }\n args[0] = 'install'\n return convertAddRemoveArgs(args)\n },\n remove (args: string[]) {\n args[0] = 'uninstall'\n return convertAddRemoveArgs(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--major':\n return 'major'\n case '--minor':\n return 'minor'\n case '--patch':\n return 'patch'\n default:\n return item\n }\n })\n },\n install: 'install',\n list (args: string[]) {\n args[0] = 'ls'\n const patternIndex = args.findIndex(item => item === '--pattern')\n if (patternIndex >= 0 && args[patternIndex + 1]) {\n const packages = args[patternIndex + 1].replace(/[\"']([^\"']+)[\"']/, '$1').split('|')\n args.splice(patternIndex, 2, packages.join(' '))\n }\n return args\n },\n init: 'init',\n create: 'init',\n outdated: 'outdated',\n run: 'run',\n global (args: string[]) {\n switch (args[1]) {\n case 'add':\n args.shift()\n args = yarnToNpmTable.add(args)\n args.push('--global')\n return args\n case 'remove':\n args.shift()\n args = yarnToNpmTable.remove(args)\n args.push('--global')\n return args\n case 'list':\n args.shift()\n args = yarnToNpmTable.list(args)\n args.push('--global')\n return args\n // case 'bin':\n // case 'upgrade':\n default:\n args.push(\"\\n# couldn't auto-convert command\")\n return args\n }\n },\n pack (args: string[]) {\n return args.map(item => {\n if (item === '--filename') {\n return '--pack-destination'\n }\n return item\n })\n }\n}\n\nexport function yarnToNPM (_m: string, command: string): string {\n command = (command || '').trim()\n if (command === '') {\n return 'npm install'\n }\n let args = parse(command)\n const firstCommand = (/\\w+/.exec(command) || [''])[0]\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'npm ' + command\n } else if (args[0] in yarnToNpmTable) {\n const converter = yarnToNpmTable[args[0] as keyof typeof yarnToNpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'npm ' + args.filter(Boolean).join(' ')\n } else if (!yarnCLICommands.includes(firstCommand)) {\n // i.e., yarn grunt -> npm run grunt\n return 'npm run ' + command\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertInstallArgs (args: string[]) {\n if (args.includes('--global') || args.includes('-g')) {\n args.unshift('global')\n }\n\n return args.map(item => {\n switch (item) {\n case '--save-dev':\n case '-D':\n return '--dev'\n case '--save-prod':\n case '-P':\n return '--production'\n case '--no-package-lock':\n return '--no-lockfile'\n case '--save-optional':\n case '-O':\n return '--optional'\n case '--save-exact':\n case '-E':\n return '--exact'\n case '--save':\n case '-S':\n case '--global':\n case '-g':\n return ''\n default:\n return item\n }\n })\n}\n\nconst npmToYarnTable = {\n install (args: string[]) {\n if (args.length === 1) {\n return ['install']\n }\n args[0] = 'add'\n\n return convertInstallArgs(args)\n },\n i (args: string[]) {\n return npmToYarnTable.install(args)\n },\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertInstallArgs(args)\n },\n un (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case 'major':\n return '--major'\n case 'minor':\n return '--minor'\n case 'patch':\n return '--patch'\n default:\n return item\n }\n })\n },\n rb (args: string[]) {\n return npmToYarnTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'add'\n args.push('--force')\n return args\n },\n run (args: string[]) {\n if (args[1] && !unchangedCLICommands.includes(args[1]) && !yarnCLICommands.includes(args[1])) {\n args.splice(0, 1)\n }\n return args\n },\n exec (args: string[]) {\n args[0] = 'run'\n return npmToYarnTable.run(args)\n },\n ls (args: string[]) {\n args[0] = 'list'\n\n let ended = false\n const packages = args.filter((item, id) => {\n if (id > 0 && !ended) {\n ended = item.startsWith('-')\n return !ended\n }\n return false\n })\n if (packages.length > 0) {\n args.splice(1, packages.length, '--pattern', '\"' + packages.join('|') + '\"')\n }\n return args\n },\n list (args: string[]) {\n return npmToYarnTable.ls(args)\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n tst: 'test',\n outdated: 'outdated',\n pack (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--filename ')\n }\n return item\n })\n }\n}\n\nexport function npmToYarn (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n const index = args.findIndex(a => a === '--')\n if (index >= 0) {\n args.splice(index, 1)\n }\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else if (args[0] in npmToYarnTable) {\n const converter = npmToYarnTable[args[0] as keyof typeof npmToYarnTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { parse } from './command'\n\nfunction convertPnpmInstallArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--save':\n case '-S':\n return ''\n case '--no-package-lock':\n return '--frozen-lockfile'\n // case '--save-dev':\n // case '-D':\n // case '--save-prod':\n // case '-P':\n // case '--save-optional':\n // case '-O':\n // case '--save-exact':\n // case '-E':\n // case '--global':\n // case '-g':\n default:\n return item\n }\n })\n}\n\nfunction convertFilterArg (args: string[]) {\n if (args.length > 1) {\n const filter = args.filter((item, index) => index !== 0 && !item.startsWith('-'))\n if (filter.length > 0) {\n args = args.filter((item, index) => index === 0 || item.startsWith('-'))\n args.push('--filter')\n args.push(filter.join(' '))\n }\n }\n\n return args\n}\n\nconst npmToPnpmTable = {\n // ------------------------------\n install (args: string[]) {\n if (args.length > 1 && args.filter(item => !item.startsWith('-')).length > 1) {\n args[0] = 'add'\n }\n return convertPnpmInstallArgs(args)\n },\n i (args: string[]) {\n return npmToPnpmTable.install(args)\n },\n // ------------------------------\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertPnpmInstallArgs(args)\n },\n un (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n // ------------------------------\n rb (args: string[]) {\n return npmToPnpmTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'rebuild'\n return convertFilterArg(args)\n },\n run: 'run',\n exec: 'exec',\n ls (args: string[]) {\n return npmToPnpmTable.list(args)\n },\n list (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--depth=')) {\n return `--depth ${item.split('=')[1]}`\n }\n switch (item) {\n case '--production':\n return '--prod'\n case '--development':\n return '--dev'\n default:\n return item\n }\n })\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n test: 'test',\n tst: 'test',\n start: 'start',\n link: 'link',\n unlink (args: string[]) {\n return convertFilterArg(args)\n },\n outdated: 'outdated',\n pack: (args: string[]) => {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--pack-destination ')\n }\n return item\n })\n }\n}\n\nexport function npmToPnpm (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n if (args[0] in npmToPnpmTable) {\n const converter = npmToPnpmTable[args[0] as keyof typeof npmToPnpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'pnpm ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { yarnToNPM } from './yarnToNpm'\nimport { npmToYarn } from './npmToYarn'\nimport { npmToPnpm } from './npmToPnpm'\n\n/**\n * Converts between npm and yarn command\n */\nexport default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm'): string {\n if (to === 'npm') {\n return str.replace(/yarn(?: +([^&\\n\\r]*))?/gm, yarnToNPM)\n } else if (to === 'pnpm') {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToPnpm)\n } else {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToYarn)\n }\n}\n"],"names":[],"mappings":"AAAO,IAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;CACP,CAAA;AAEM,IAAM,eAAe,GAAG;IAC7B,MAAM;IACN,KAAK;IACL,KAAK;IACL,OAAO;IACP,WAAW;IACX,KAAK;IACL,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,qBAAqB;IACrB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,SAAS;IACT,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;IACP,QAAQ;IACR,aAAa;IACb,KAAK;IACL,MAAM;IACN,SAAS;IACT,qBAAqB;IACrB,SAAS;IACT,UAAU;IACV,KAAK;IACL,WAAW;IACX,YAAY;CACb;;ACjDK,SAAU,KAAK,CAAE,OAAe,EAAA;IACpC,IAAM,IAAI,GAAa,EAAE,CAAA;IACzB,IAAI,SAAS,GAAmB,KAAK,CAAA;IACrC,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,IAAI,GAAG,EAAE,CAAA;AACb,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE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CAAC,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AAExC,IAAA,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,EAAE;QAC7B,IAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAgC,CAAC,CAAA;AAExE,QAAA,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;AACnC,YAAA,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;AACvB,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AACpB,SAAA;AAED,QAAA,OAAO,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAChD,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,MAAM,GAAG,OAAO,GAAG,mCAAmC,CAAA;AAC9D,KAAA;AACH;;ACtIA;;AAEG;AACW,SAAU,OAAO,CAAE,GAAW,EAAE,EAA2B,EAAA;IACvE,IAAI,EAAE,KAAK,KAAK,EAAE;QAChB,OAAO,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;AAC1D,KAAA;SAAM,IAAI,EAAE,KAAK,MAAM,EAAE;QACxB,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;AACzD,KAAA;AAAM,SAAA;QACL,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;AACzD,KAAA;AACH;;;;"} \ No newline at end of file +{"version":3,"file":"npm-to-yarn.mjs","sources":["../src/utils.ts","../src/command.ts","../src/yarnToNpm.ts","../src/npmToYarn.ts","../src/npmToPnpm.ts","../src/npmToBun.ts","../src/index.ts"],"sourcesContent":["export const unchangedCLICommands = [\n 'test',\n 'login',\n 'logout',\n 'link',\n 'unlink',\n 'publish',\n 'cache',\n 'start',\n 'stop',\n 'test'\n]\n\nexport const yarnCLICommands = [\n 'init',\n 'run',\n 'add',\n 'audit',\n 'autoclean',\n 'bin',\n 'check',\n 'config',\n 'create',\n 'dedupe',\n 'generate-lock-entry',\n 'global',\n 'help',\n 'import',\n 'info',\n 'install',\n 'licenses',\n 'list',\n 'lockfile',\n 'outdated',\n 'owner',\n 'pack',\n 'policies',\n 'prune',\n 'remove',\n 'self-update',\n 'tag',\n 'team',\n 'upgrade',\n 'upgrade-interactive',\n 'version',\n 'versions',\n 'why',\n 'workspace',\n 'workspaces'\n]\n\nexport const npmCLICommands = [\n 'init',\n 'run',\n 'access',\n 'adduser',\n 'audit',\n 'bin',\n 'bugs',\n 'build',\n 'bundle',\n 'ci',\n 'completion',\n 'config',\n 'dedupe',\n 'deprecate',\n 'dist-tag',\n 'docs',\n 'doctor',\n 'edit',\n 'explore',\n 'exec',\n 'fund',\n 'help-search',\n 'help',\n 'hook',\n 'install-ci-test',\n 'install-test',\n 'install',\n 'ls',\n 'list',\n 'npm',\n 'org',\n 'outdated',\n 'owner',\n 'pack',\n 'ping',\n 'prefix',\n 'profile',\n 'prune',\n 'rebuild',\n 'repo',\n 'restart',\n 'root',\n 'run-script',\n 'search',\n 'shrinkwrap',\n 'star',\n 'stars',\n 'start',\n 'stop',\n 'team',\n 'token',\n 'uninstall',\n 'unpublish',\n 'update',\n 'version',\n 'view',\n 'whoami'\n]\n","export function parse (command: string) {\n const args: string[] = []\n let lastQuote: string | false = false\n let escaped = false\n let part = ''\n for (let i = 0; i < command.length; ++i) {\n const char = command.charAt(i)\n if (char === '\\\\') {\n part += char\n escaped = true\n } else {\n if (char === ' ' && !lastQuote) {\n args.push(part)\n part = ''\n } else if (!escaped && (char === '\"' || char === \"'\")) {\n part += char\n if (char === lastQuote) {\n lastQuote = false\n } else if (!lastQuote) {\n lastQuote = char\n }\n } else {\n part += char\n }\n escaped = false\n }\n }\n args.push(part)\n return args\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertAddRemoveArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--no-lockfile':\n return '--no-package-lock'\n case '--production':\n return '--save-prod'\n case '--dev':\n return '--save-dev'\n case '--optional':\n return '--save-optional'\n case '--exact':\n return '--save-exact'\n default:\n return item\n }\n })\n}\n\nconst yarnToNpmTable = {\n add (args: string[]) {\n if (args.length === 2 && args[1] === '--force') {\n return ['rebuild']\n }\n args[0] = 'install'\n return convertAddRemoveArgs(args)\n },\n remove (args: string[]) {\n args[0] = 'uninstall'\n return convertAddRemoveArgs(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--major':\n return 'major'\n case '--minor':\n return 'minor'\n case '--patch':\n return 'patch'\n default:\n return item\n }\n })\n },\n install: 'install',\n list (args: string[]) {\n args[0] = 'ls'\n const patternIndex = args.findIndex(item => item === '--pattern')\n if (patternIndex >= 0 && args[patternIndex + 1]) {\n const packages = args[patternIndex + 1].replace(/[\"']([^\"']+)[\"']/, '$1').split('|')\n args.splice(patternIndex, 2, packages.join(' '))\n }\n return args\n },\n init: 'init',\n create: 'init',\n outdated: 'outdated',\n run: 'run',\n global (args: string[]) {\n switch (args[1]) {\n case 'add':\n args.shift()\n args = yarnToNpmTable.add(args)\n args.push('--global')\n return args\n case 'remove':\n args.shift()\n args = yarnToNpmTable.remove(args)\n args.push('--global')\n return args\n case 'list':\n args.shift()\n args = yarnToNpmTable.list(args)\n args.push('--global')\n return args\n // case 'bin':\n // case 'upgrade':\n default:\n args.push(\"\\n# couldn't auto-convert command\")\n return args\n }\n },\n pack (args: string[]) {\n return args.map(item => {\n if (item === '--filename') {\n return '--pack-destination'\n }\n return item\n })\n }\n}\n\nexport function yarnToNPM (_m: string, command: string): string {\n command = (command || '').trim()\n if (command === '') {\n return 'npm install'\n }\n let args = parse(command)\n const firstCommand = (/\\w+/.exec(command) || [''])[0]\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'npm ' + command\n } else if (args[0] in yarnToNpmTable) {\n const converter = yarnToNpmTable[args[0] as keyof typeof yarnToNpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'npm ' + args.filter(Boolean).join(' ')\n } else if (!yarnCLICommands.includes(firstCommand)) {\n // i.e., yarn grunt -> npm run grunt\n return 'npm run ' + command\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertInstallArgs (args: string[]) {\n if (args.includes('--global') || args.includes('-g')) {\n args.unshift('global')\n }\n\n return args.map(item => {\n switch (item) {\n case '--save-dev':\n case '-D':\n return '--dev'\n case '--save-prod':\n case '-P':\n return '--production'\n case '--no-package-lock':\n return '--no-lockfile'\n case '--save-optional':\n case '-O':\n return '--optional'\n case '--save-exact':\n case '-E':\n return '--exact'\n case '--save':\n case '-S':\n case '--global':\n case '-g':\n return ''\n default:\n return item\n }\n })\n}\n\nconst npmToYarnTable = {\n install (args: string[]) {\n if (args.length === 1) {\n return ['install']\n }\n args[0] = 'add'\n\n return convertInstallArgs(args)\n },\n i (args: string[]) {\n return npmToYarnTable.install(args)\n },\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertInstallArgs(args)\n },\n un (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case 'major':\n return '--major'\n case 'minor':\n return '--minor'\n case 'patch':\n return '--patch'\n default:\n return item\n }\n })\n },\n rb (args: string[]) {\n return npmToYarnTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'add'\n args.push('--force')\n return args\n },\n run (args: string[]) {\n if (args[1] && !unchangedCLICommands.includes(args[1]) && !yarnCLICommands.includes(args[1])) {\n args.splice(0, 1)\n }\n return args\n },\n exec (args: string[]) {\n args[0] = 'run'\n return npmToYarnTable.run(args)\n },\n ls (args: string[]) {\n args[0] = 'list'\n\n let ended = false\n const packages = args.filter((item, id) => {\n if (id > 0 && !ended) {\n ended = item.startsWith('-')\n return !ended\n }\n return false\n })\n if (packages.length > 0) {\n args.splice(1, packages.length, '--pattern', '\"' + packages.join('|') + '\"')\n }\n return args\n },\n list (args: string[]) {\n return npmToYarnTable.ls(args)\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n tst: 'test',\n outdated: 'outdated',\n pack (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--filename ')\n }\n return item\n })\n }\n}\n\nexport function npmToYarn (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n const index = args.findIndex(a => a === '--')\n if (index >= 0) {\n args.splice(index, 1)\n }\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else if (args[0] in npmToYarnTable) {\n const converter = npmToYarnTable[args[0] as keyof typeof npmToYarnTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { parse } from './command'\n\nfunction convertPnpmInstallArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--save':\n case '-S':\n return ''\n case '--no-package-lock':\n return '--frozen-lockfile'\n // case '--save-dev':\n // case '-D':\n // case '--save-prod':\n // case '-P':\n // case '--save-optional':\n // case '-O':\n // case '--save-exact':\n // case '-E':\n // case '--global':\n // case '-g':\n default:\n return item\n }\n })\n}\n\nfunction convertFilterArg (args: string[]) {\n if (args.length > 1) {\n const filter = args.filter((item, index) => index !== 0 && !item.startsWith('-'))\n if (filter.length > 0) {\n args = args.filter((item, index) => index === 0 || item.startsWith('-'))\n args.push('--filter')\n args.push(filter.join(' '))\n }\n }\n\n return args\n}\n\nconst npmToPnpmTable = {\n // ------------------------------\n install (args: string[]) {\n if (args.length > 1 && args.filter(item => !item.startsWith('-')).length > 1) {\n args[0] = 'add'\n }\n return convertPnpmInstallArgs(args)\n },\n i (args: string[]) {\n return npmToPnpmTable.install(args)\n },\n // ------------------------------\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertPnpmInstallArgs(args)\n },\n un (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n // ------------------------------\n rb (args: string[]) {\n return npmToPnpmTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'rebuild'\n return convertFilterArg(args)\n },\n run: 'run',\n exec: 'exec',\n ls (args: string[]) {\n return npmToPnpmTable.list(args)\n },\n list (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--depth=')) {\n return `--depth ${item.split('=')[1]}`\n }\n switch (item) {\n case '--production':\n return '--prod'\n case '--development':\n return '--dev'\n default:\n return item\n }\n })\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n test: 'test',\n tst: 'test',\n start: 'start',\n link: 'link',\n unlink (args: string[]) {\n return convertFilterArg(args)\n },\n outdated: 'outdated',\n pack: (args: string[]) => {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--pack-destination ')\n }\n return item\n })\n }\n}\n\nexport function npmToPnpm (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n if (args[0] in npmToPnpmTable) {\n const converter = npmToPnpmTable[args[0] as keyof typeof npmToPnpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'pnpm ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { parse } from './command'\n\nfunction convertInstallArgs (args: string[]) {\n // bun uses -g and --global flags\n // bun mostly conforms to Yarn's CLI\n return args.map(item => {\n switch (item) {\n case '--save-dev':\n case '--development':\n case '-D':\n return '--dev'\n case '--save-prod':\n case '-P':\n return '--production'\n case '--no-package-lock':\n return '--no-save'\n case '--save-optional':\n case '-O':\n return '--optional'\n case '--save-exact':\n case '-E':\n return '--exact'\n case '--save':\n case '-S':\n // this is default in bun\n return ''\n case '--global':\n case '-g':\n return '--global'\n default:\n return item\n }\n })\n}\n\nexport const bunCLICommands = [\n 'init',\n 'run',\n 'add',\n 'pm',\n 'help',\n 'install',\n 'remove',\n 'upgrade',\n 'version'\n] as const\ntype bunCLICommands = typeof bunCLICommands[number]\n\nexport function npmToBun (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n const index = args.findIndex(a => a === '--')\n if (index >= 0) {\n args.splice(index, 1)\n }\n\n let cmd = 'bun'\n switch (args[0]) {\n case 'install':\n case 'i':\n if (args.length === 1) {\n args = ['install']\n } else {\n args[0] = 'add'\n }\n args = convertInstallArgs(args)\n break\n case 'uninstall':\n case 'un':\n case 'remove':\n case 'r':\n case 'rm':\n args[0] = 'remove'\n args = convertInstallArgs(args)\n break\n case 'cache':\n if (args[1] === 'clean') {\n args = ['pm', 'cache', 'rm'].concat(args.slice(2))\n } else {\n cmd = 'npm'\n }\n break\n case 'rebuild':\n case 'rb':\n args[0] = 'add'\n args.push('--force')\n break\n case 'run':\n break\n case 'list':\n case 'ls':\n // 'npm ls' => 'bun pm ls'\n args = convertInstallArgs(args)\n args[0] = 'ls'\n args.unshift('pm')\n break\n case 'init':\n case 'create':\n if (args[1]) {\n if (args[1].startsWith('@')) {\n cmd = 'bunx'\n\n args[1] = args[1].replace('/', '/create-')\n args = args.slice(1)\n } else if (!args[1].startsWith('-')) {\n cmd = 'bunx'\n args[1] = `create-${args[1]}`\n args = args.slice(1)\n } else {\n args[0] = 'init'\n }\n }\n break\n\n case 'link':\n case 'ln':\n args = convertInstallArgs(args)\n args[0] = 'link'\n break\n case 'stop':\n case 'start':\n case 'unlink':\n break\n case 'test':\n case 't':\n case 'tst':\n args[0] = 'test'\n args.unshift('run')\n break\n case 'exec':\n cmd = 'bunx'\n args.splice(0, 1)\n break\n default:\n // null == keep `npm` command\n cmd = 'npm'\n break\n }\n\n const filtered = args.filter(Boolean).filter(arg => arg !== '--')\n return `${cmd} ${filtered.join(' ')}${\n cmd === 'npm' ? \"\\n# couldn't auto-convert command\" : ''\n }`.replace('=', ' ')\n}\n","import { yarnToNPM } from './yarnToNpm'\nimport { npmToYarn } from './npmToYarn'\nimport { npmToPnpm } from './npmToPnpm'\nimport { npmToBun } from './npmToBun'\n\n/**\n * Converts between npm and yarn command\n */\nexport default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm' | 'bun'): string {\n if (to === 'npm') {\n return str.replace(/yarn(?: +([^&\\n\\r]*))?/gm, yarnToNPM)\n } else if (to === 'pnpm') {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToPnpm)\n } else if (to === 'bun') {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToBun)\n } else {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToYarn)\n }\n}\n"],"names":["convertInstallArgs"],"mappings":"AAAO,IAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;CACP,CAAA;AAEM,IAAM,eAAe,GAAG;IAC7B,MAAM;IACN,KAAK;IACL,KAAK;IACL,OAAO;IACP,WAAW;IACX,KAAK;IACL,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,qBAAqB;I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 --- a/dist/npm-to-yarn.umd.js +++ b/dist/npm-to-yarn.umd.js @@ -209,7 +209,7 @@ } } - function convertInstallArgs(args) { + function convertInstallArgs$1(args) { if (args.includes('--global') || args.includes('-g')) { args.unshift('global'); } @@ -245,14 +245,14 @@ return ['install']; } args[0] = 'add'; - return convertInstallArgs(args); + return convertInstallArgs$1(args); }, i: function (args) { return npmToYarnTable.install(args); }, uninstall: function (args) { args[0] = 'remove'; - return convertInstallArgs(args); + return convertInstallArgs$1(args); }, un: function (args) { return npmToYarnTable.uninstall(args); @@ -491,6 +491,132 @@ } } + function convertInstallArgs(args) { + // bun uses -g and --global flags + // bun mostly conforms to Yarn's CLI + return args.map(function (item) { + switch (item) { + case '--save-dev': + case '--development': + case '-D': + return '--dev'; + case '--save-prod': + case '-P': + return '--production'; + case '--no-package-lock': + return '--no-save'; + case '--save-optional': + case '-O': + return '--optional'; + case '--save-exact': + case '-E': + return '--exact'; + case '--save': + case '-S': + // this is default in bun + return ''; + case '--global': + case '-g': + return '--global'; + default: + return item; + } + }); + } + function npmToBun(_m, command) { + var args = parse((command || '').trim()); + var index = args.findIndex(function (a) { return a === '--'; }); + if (index >= 0) { + args.splice(index, 1); + } + var cmd = 'bun'; + switch (args[0]) { + case 'install': + case 'i': + if (args.length === 1) { + args = ['install']; + } + else { + args[0] = 'add'; + } + args = convertInstallArgs(args); + break; + case 'uninstall': + case 'un': + case 'remove': + case 'r': + case 'rm': + args[0] = 'remove'; + args = convertInstallArgs(args); + break; + case 'cache': + if (args[1] === 'clean') { + args = ['pm', 'cache', 'rm'].concat(args.slice(2)); + } + else { + cmd = 'npm'; + } + break; + case 'rebuild': + case 'rb': + args[0] = 'add'; + args.push('--force'); + break; + case 'run': + break; + case 'list': + case 'ls': + // 'npm ls' => 'bun pm ls' + args = convertInstallArgs(args); + args[0] = 'ls'; + args.unshift('pm'); + break; + case 'init': + case 'create': + if (args[1]) { + if (args[1].startsWith('@')) { + cmd = 'bunx'; + args[1] = args[1].replace('/', '/create-'); + args = args.slice(1); + } + else if (!args[1].startsWith('-')) { + cmd = 'bunx'; + args[1] = "create-".concat(args[1]); + args = args.slice(1); + } + else { + args[0] = 'init'; + } + } + break; + case 'link': + case 'ln': + args = convertInstallArgs(args); + args[0] = 'link'; + break; + case 'stop': + case 'start': + case 'unlink': + break; + case 'test': + case 't': + case 'tst': + args[0] = 'test'; + args.unshift('run'); + break; + case 'exec': + cmd = 'bunx'; + args.splice(0, 1); + break; + default: + // null == keep `npm` command + cmd = 'npm'; + break; + } + var filtered = args.filter(Boolean).filter(function (arg) { return arg !== '--'; }); + return "".concat(cmd, " ").concat(filtered.join(' ')).concat(cmd === 'npm' ? "\n# couldn't auto-convert command" : '').replace('=', ' '); + } + /** * Converts between npm and yarn command */ @@ -501,6 +627,9 @@ else if (to === 'pnpm') { return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToPnpm); } + else if (to === 'bun') { + return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToBun); + } else { return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToYarn); } diff --git a/dist/npm-to-yarn.umd.js.map b/dist/npm-to-yarn.umd.js.map index 6e64274..89e21d7 100644 --- a/dist/npm-to-yarn.umd.js.map +++ b/dist/npm-to-yarn.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"npm-to-yarn.umd.js","sources":["../src/utils.ts","../src/command.ts","../src/yarnToNpm.ts","../src/npmToYarn.ts","../src/npmToPnpm.ts","../src/index.ts"],"sourcesContent":["export const unchangedCLICommands = [\n 'test',\n 'login',\n 'logout',\n 'link',\n 'unlink',\n 'publish',\n 'cache',\n 'start',\n 'stop',\n 'test'\n]\n\nexport const yarnCLICommands = [\n 'init',\n 'run',\n 'add',\n 'audit',\n 'autoclean',\n 'bin',\n 'check',\n 'config',\n 'create',\n 'dedupe',\n 'generate-lock-entry',\n 'global',\n 'help',\n 'import',\n 'info',\n 'install',\n 'licenses',\n 'list',\n 'lockfile',\n 'outdated',\n 'owner',\n 'pack',\n 'policies',\n 'prune',\n 'remove',\n 'self-update',\n 'tag',\n 'team',\n 'upgrade',\n 'upgrade-interactive',\n 'version',\n 'versions',\n 'why',\n 'workspace',\n 'workspaces'\n]\n\nexport const npmCLICommands = [\n 'init',\n 'run',\n 'access',\n 'adduser',\n 'audit',\n 'bin',\n 'bugs',\n 'build',\n 'bundle',\n 'ci',\n 'completion',\n 'config',\n 'dedupe',\n 'deprecate',\n 'dist-tag',\n 'docs',\n 'doctor',\n 'edit',\n 'explore',\n 'exec',\n 'fund',\n 'help-search',\n 'help',\n 'hook',\n 'install-ci-test',\n 'install-test',\n 'install',\n 'ls',\n 'list',\n 'npm',\n 'org',\n 'outdated',\n 'owner',\n 'pack',\n 'ping',\n 'prefix',\n 'profile',\n 'prune',\n 'rebuild',\n 'repo',\n 'restart',\n 'root',\n 'run-script',\n 'search',\n 'shrinkwrap',\n 'star',\n 'stars',\n 'start',\n 'stop',\n 'team',\n 'token',\n 'uninstall',\n 'unpublish',\n 'update',\n 'version',\n 'view',\n 'whoami'\n]\n","export function parse (command: string) {\n const args: string[] = []\n let lastQuote: string | false = false\n let escaped = false\n let part = ''\n for (let i = 0; i < command.length; ++i) {\n const char = command.charAt(i)\n if (char === '\\\\') {\n part += char\n escaped = true\n } else {\n if (char === ' ' && !lastQuote) {\n args.push(part)\n part = ''\n } else if (!escaped && (char === '\"' || char === \"'\")) {\n part += char\n if (char === lastQuote) {\n lastQuote = false\n } else if (!lastQuote) {\n lastQuote = char\n }\n } else {\n part += char\n }\n escaped = false\n }\n }\n args.push(part)\n return args\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertAddRemoveArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--no-lockfile':\n return '--no-package-lock'\n case '--production':\n return '--save-prod'\n case '--dev':\n return '--save-dev'\n case '--optional':\n return '--save-optional'\n case '--exact':\n return '--save-exact'\n default:\n return item\n }\n })\n}\n\nconst yarnToNpmTable = {\n add (args: string[]) {\n if (args.length === 2 && args[1] === '--force') {\n return ['rebuild']\n }\n args[0] = 'install'\n return convertAddRemoveArgs(args)\n },\n remove (args: string[]) {\n args[0] = 'uninstall'\n return convertAddRemoveArgs(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--major':\n return 'major'\n case '--minor':\n return 'minor'\n case '--patch':\n return 'patch'\n default:\n return item\n }\n })\n },\n install: 'install',\n list (args: string[]) {\n args[0] = 'ls'\n const patternIndex = args.findIndex(item => item === '--pattern')\n if (patternIndex >= 0 && args[patternIndex + 1]) {\n const packages = args[patternIndex + 1].replace(/[\"']([^\"']+)[\"']/, '$1').split('|')\n args.splice(patternIndex, 2, packages.join(' '))\n }\n return args\n },\n init: 'init',\n create: 'init',\n outdated: 'outdated',\n run: 'run',\n global (args: string[]) {\n switch (args[1]) {\n case 'add':\n args.shift()\n args = yarnToNpmTable.add(args)\n args.push('--global')\n return args\n case 'remove':\n args.shift()\n args = yarnToNpmTable.remove(args)\n args.push('--global')\n return args\n case 'list':\n args.shift()\n args = yarnToNpmTable.list(args)\n args.push('--global')\n return args\n // case 'bin':\n // case 'upgrade':\n default:\n args.push(\"\\n# couldn't auto-convert command\")\n return args\n }\n },\n pack (args: string[]) {\n return args.map(item => {\n if (item === '--filename') {\n return '--pack-destination'\n }\n return item\n })\n }\n}\n\nexport function yarnToNPM (_m: string, command: string): string {\n command = (command || '').trim()\n if (command === '') {\n return 'npm install'\n }\n let args = parse(command)\n const firstCommand = (/\\w+/.exec(command) || [''])[0]\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'npm ' + command\n } else if (args[0] in yarnToNpmTable) {\n const converter = yarnToNpmTable[args[0] as keyof typeof yarnToNpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'npm ' + args.filter(Boolean).join(' ')\n } else if (!yarnCLICommands.includes(firstCommand)) {\n // i.e., yarn grunt -> npm run grunt\n return 'npm run ' + command\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertInstallArgs (args: string[]) {\n if (args.includes('--global') || args.includes('-g')) {\n args.unshift('global')\n }\n\n return args.map(item => {\n switch (item) {\n case '--save-dev':\n case '-D':\n return '--dev'\n case '--save-prod':\n case '-P':\n return '--production'\n case '--no-package-lock':\n return '--no-lockfile'\n case '--save-optional':\n case '-O':\n return '--optional'\n case '--save-exact':\n case '-E':\n return '--exact'\n case '--save':\n case '-S':\n case '--global':\n case '-g':\n return ''\n default:\n return item\n }\n })\n}\n\nconst npmToYarnTable = {\n install (args: string[]) {\n if (args.length === 1) {\n return ['install']\n }\n args[0] = 'add'\n\n return convertInstallArgs(args)\n },\n i (args: string[]) {\n return npmToYarnTable.install(args)\n },\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertInstallArgs(args)\n },\n un (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case 'major':\n return '--major'\n case 'minor':\n return '--minor'\n case 'patch':\n return '--patch'\n default:\n return item\n }\n })\n },\n rb (args: string[]) {\n return npmToYarnTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'add'\n args.push('--force')\n return args\n },\n run (args: string[]) {\n if (args[1] && !unchangedCLICommands.includes(args[1]) && !yarnCLICommands.includes(args[1])) {\n args.splice(0, 1)\n }\n return args\n },\n exec (args: string[]) {\n args[0] = 'run'\n return npmToYarnTable.run(args)\n },\n ls (args: string[]) {\n args[0] = 'list'\n\n let ended = false\n const packages = args.filter((item, id) => {\n if (id > 0 && !ended) {\n ended = item.startsWith('-')\n return !ended\n }\n return false\n })\n if (packages.length > 0) {\n args.splice(1, packages.length, '--pattern', '\"' + packages.join('|') + '\"')\n }\n return args\n },\n list (args: string[]) {\n return npmToYarnTable.ls(args)\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n tst: 'test',\n outdated: 'outdated',\n pack (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--filename ')\n }\n return item\n })\n }\n}\n\nexport function npmToYarn (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n const index = args.findIndex(a => a === '--')\n if (index >= 0) {\n args.splice(index, 1)\n }\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else if (args[0] in npmToYarnTable) {\n const converter = npmToYarnTable[args[0] as keyof typeof npmToYarnTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { parse } from './command'\n\nfunction convertPnpmInstallArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--save':\n case '-S':\n return ''\n case '--no-package-lock':\n return '--frozen-lockfile'\n // case '--save-dev':\n // case '-D':\n // case '--save-prod':\n // case '-P':\n // case '--save-optional':\n // case '-O':\n // case '--save-exact':\n // case '-E':\n // case '--global':\n // case '-g':\n default:\n return item\n }\n })\n}\n\nfunction convertFilterArg (args: string[]) {\n if (args.length > 1) {\n const filter = args.filter((item, index) => index !== 0 && !item.startsWith('-'))\n if (filter.length > 0) {\n args = args.filter((item, index) => index === 0 || item.startsWith('-'))\n args.push('--filter')\n args.push(filter.join(' '))\n }\n }\n\n return args\n}\n\nconst npmToPnpmTable = {\n // ------------------------------\n install (args: string[]) {\n if (args.length > 1 && args.filter(item => !item.startsWith('-')).length > 1) {\n args[0] = 'add'\n }\n return convertPnpmInstallArgs(args)\n },\n i (args: string[]) {\n return npmToPnpmTable.install(args)\n },\n // ------------------------------\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertPnpmInstallArgs(args)\n },\n un (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n // ------------------------------\n rb (args: string[]) {\n return npmToPnpmTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'rebuild'\n return convertFilterArg(args)\n },\n run: 'run',\n exec: 'exec',\n ls (args: string[]) {\n return npmToPnpmTable.list(args)\n },\n list (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--depth=')) {\n return `--depth ${item.split('=')[1]}`\n }\n switch (item) {\n case '--production':\n return '--prod'\n case '--development':\n return '--dev'\n default:\n return item\n }\n })\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n test: 'test',\n tst: 'test',\n start: 'start',\n link: 'link',\n unlink (args: string[]) {\n return convertFilterArg(args)\n },\n outdated: 'outdated',\n pack: (args: string[]) => {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--pack-destination ')\n }\n return item\n })\n }\n}\n\nexport function npmToPnpm (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n if (args[0] in npmToPnpmTable) {\n const converter = npmToPnpmTable[args[0] as keyof typeof npmToPnpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'pnpm ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { yarnToNPM } from './yarnToNpm'\nimport { npmToYarn } from './npmToYarn'\nimport { npmToPnpm } from './npmToPnpm'\n\n/**\n * Converts between npm and yarn command\n */\nexport default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm'): string {\n if (to === 'npm') {\n return str.replace(/yarn(?: +([^&\\n\\r]*))?/gm, yarnToNPM)\n } else if (to === 'pnpm') {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToPnpm)\n } else {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToYarn)\n }\n}\n"],"names":[],"mappings":";;;;;;IAAO,IAAM,oBAAoB,GAAG;QAClC,MAAM;QACN,OAAO;QACP,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,SAAS;QACT,OAAO;QACP,OAAO;QACP,MAAM;QACN,MAAM;KACP,CAAA;IAEM,IAAM,eAAe,GAAG;QAC7B,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;QACP,WAAW;QACX,KAAK;QACL,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,qBAAqB;QACrB,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,MAAM;QACN,SAAS;QACT,UAAU;QACV,MAAM;QACN,UAAU;QACV,UAAU;QACV,OAAO;QACP,MAAM;QACN,UAAU;QACV,OAAO;QACP,QAAQ;QACR,aAAa;QACb,KAAK;QACL,MAAM;QACN,SAAS;QACT,qBAAqB;QACrB,SAAS;QACT,UAAU;QACV,KAAK;QACL,WAAW;QACX,YAAY;KACb;;ICjDK,SAAU,KAAK,CAAE,OAAe,EAAA;QACpC,IAAM,IAAI,GAAa,EAAE,CAAA;QACzB,IAAI,SAAS,GAAmB,KAAK,CAAA;QACrC,IAAI,OAAO,GAAG,KAAK,CAAA;QACnB,IAAI,IAAI,GAAG,EAAE,CAAA;IACb,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACvC,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YAC9B,IAAI,IAAI,KA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,CAAC,IAAI,cAAc,EAAE;YAC7B,IAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAgC,CAAC,CAAA;IAExE,QAAA,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;IACnC,YAAA,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IACvB,SAAA;IAAM,aAAA;IACL,YAAA,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IACpB,SAAA;IAED,QAAA,OAAO,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChD,KAAA;IAAM,SAAA;IACL,QAAA,OAAO,MAAM,GAAG,OAAO,GAAG,mCAAmC,CAAA;IAC9D,KAAA;IACH;;ICtIA;;IAEG;IACW,SAAU,OAAO,CAAE,GAAW,EAAE,EAA2B,EAAA;QACvE,IAAI,EAAE,KAAK,KAAK,EAAE;YAChB,OAAO,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;IAC1D,KAAA;aAAM,IAAI,EAAE,KAAK,MAAM,EAAE;YACxB,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;IACzD,KAAA;IAAM,SAAA;YACL,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;IACzD,KAAA;IACH;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"npm-to-yarn.umd.js","sources":["../src/utils.ts","../src/command.ts","../src/yarnToNpm.ts","../src/npmToYarn.ts","../src/npmToPnpm.ts","../src/npmToBun.ts","../src/index.ts"],"sourcesContent":["export const unchangedCLICommands = [\n 'test',\n 'login',\n 'logout',\n 'link',\n 'unlink',\n 'publish',\n 'cache',\n 'start',\n 'stop',\n 'test'\n]\n\nexport const yarnCLICommands = [\n 'init',\n 'run',\n 'add',\n 'audit',\n 'autoclean',\n 'bin',\n 'check',\n 'config',\n 'create',\n 'dedupe',\n 'generate-lock-entry',\n 'global',\n 'help',\n 'import',\n 'info',\n 'install',\n 'licenses',\n 'list',\n 'lockfile',\n 'outdated',\n 'owner',\n 'pack',\n 'policies',\n 'prune',\n 'remove',\n 'self-update',\n 'tag',\n 'team',\n 'upgrade',\n 'upgrade-interactive',\n 'version',\n 'versions',\n 'why',\n 'workspace',\n 'workspaces'\n]\n\nexport const npmCLICommands = [\n 'init',\n 'run',\n 'access',\n 'adduser',\n 'audit',\n 'bin',\n 'bugs',\n 'build',\n 'bundle',\n 'ci',\n 'completion',\n 'config',\n 'dedupe',\n 'deprecate',\n 'dist-tag',\n 'docs',\n 'doctor',\n 'edit',\n 'explore',\n 'exec',\n 'fund',\n 'help-search',\n 'help',\n 'hook',\n 'install-ci-test',\n 'install-test',\n 'install',\n 'ls',\n 'list',\n 'npm',\n 'org',\n 'outdated',\n 'owner',\n 'pack',\n 'ping',\n 'prefix',\n 'profile',\n 'prune',\n 'rebuild',\n 'repo',\n 'restart',\n 'root',\n 'run-script',\n 'search',\n 'shrinkwrap',\n 'star',\n 'stars',\n 'start',\n 'stop',\n 'team',\n 'token',\n 'uninstall',\n 'unpublish',\n 'update',\n 'version',\n 'view',\n 'whoami'\n]\n","export function parse (command: string) {\n const args: string[] = []\n let lastQuote: string | false = false\n let escaped = false\n let part = ''\n for (let i = 0; i < command.length; ++i) {\n const char = command.charAt(i)\n if (char === '\\\\') {\n part += char\n escaped = true\n } else {\n if (char === ' ' && !lastQuote) {\n args.push(part)\n part = ''\n } else if (!escaped && (char === '\"' || char === \"'\")) {\n part += char\n if (char === lastQuote) {\n lastQuote = false\n } else if (!lastQuote) {\n lastQuote = char\n }\n } else {\n part += char\n }\n escaped = false\n }\n }\n args.push(part)\n return args\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertAddRemoveArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--no-lockfile':\n return '--no-package-lock'\n case '--production':\n return '--save-prod'\n case '--dev':\n return '--save-dev'\n case '--optional':\n return '--save-optional'\n case '--exact':\n return '--save-exact'\n default:\n return item\n }\n })\n}\n\nconst yarnToNpmTable = {\n add (args: string[]) {\n if (args.length === 2 && args[1] === '--force') {\n return ['rebuild']\n }\n args[0] = 'install'\n return convertAddRemoveArgs(args)\n },\n remove (args: string[]) {\n args[0] = 'uninstall'\n return convertAddRemoveArgs(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--major':\n return 'major'\n case '--minor':\n return 'minor'\n case '--patch':\n return 'patch'\n default:\n return item\n }\n })\n },\n install: 'install',\n list (args: string[]) {\n args[0] = 'ls'\n const patternIndex = args.findIndex(item => item === '--pattern')\n if (patternIndex >= 0 && args[patternIndex + 1]) {\n const packages = args[patternIndex + 1].replace(/[\"']([^\"']+)[\"']/, '$1').split('|')\n args.splice(patternIndex, 2, packages.join(' '))\n }\n return args\n },\n init: 'init',\n create: 'init',\n outdated: 'outdated',\n run: 'run',\n global (args: string[]) {\n switch (args[1]) {\n case 'add':\n args.shift()\n args = yarnToNpmTable.add(args)\n args.push('--global')\n return args\n case 'remove':\n args.shift()\n args = yarnToNpmTable.remove(args)\n args.push('--global')\n return args\n case 'list':\n args.shift()\n args = yarnToNpmTable.list(args)\n args.push('--global')\n return args\n // case 'bin':\n // case 'upgrade':\n default:\n args.push(\"\\n# couldn't auto-convert command\")\n return args\n }\n },\n pack (args: string[]) {\n return args.map(item => {\n if (item === '--filename') {\n return '--pack-destination'\n }\n return item\n })\n }\n}\n\nexport function yarnToNPM (_m: string, command: string): string {\n command = (command || '').trim()\n if (command === '') {\n return 'npm install'\n }\n let args = parse(command)\n const firstCommand = (/\\w+/.exec(command) || [''])[0]\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'npm ' + command\n } else if (args[0] in yarnToNpmTable) {\n const converter = yarnToNpmTable[args[0] as keyof typeof yarnToNpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'npm ' + args.filter(Boolean).join(' ')\n } else if (!yarnCLICommands.includes(firstCommand)) {\n // i.e., yarn grunt -> npm run grunt\n return 'npm run ' + command\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { unchangedCLICommands, yarnCLICommands } from './utils'\nimport { parse } from './command'\n\nfunction convertInstallArgs (args: string[]) {\n if (args.includes('--global') || args.includes('-g')) {\n args.unshift('global')\n }\n\n return args.map(item => {\n switch (item) {\n case '--save-dev':\n case '-D':\n return '--dev'\n case '--save-prod':\n case '-P':\n return '--production'\n case '--no-package-lock':\n return '--no-lockfile'\n case '--save-optional':\n case '-O':\n return '--optional'\n case '--save-exact':\n case '-E':\n return '--exact'\n case '--save':\n case '-S':\n case '--global':\n case '-g':\n return ''\n default:\n return item\n }\n })\n}\n\nconst npmToYarnTable = {\n install (args: string[]) {\n if (args.length === 1) {\n return ['install']\n }\n args[0] = 'add'\n\n return convertInstallArgs(args)\n },\n i (args: string[]) {\n return npmToYarnTable.install(args)\n },\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertInstallArgs(args)\n },\n un (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToYarnTable.uninstall(args)\n },\n version (args: string[]) {\n return args.map(item => {\n switch (item) {\n case 'major':\n return '--major'\n case 'minor':\n return '--minor'\n case 'patch':\n return '--patch'\n default:\n return item\n }\n })\n },\n rb (args: string[]) {\n return npmToYarnTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'add'\n args.push('--force')\n return args\n },\n run (args: string[]) {\n if (args[1] && !unchangedCLICommands.includes(args[1]) && !yarnCLICommands.includes(args[1])) {\n args.splice(0, 1)\n }\n return args\n },\n exec (args: string[]) {\n args[0] = 'run'\n return npmToYarnTable.run(args)\n },\n ls (args: string[]) {\n args[0] = 'list'\n\n let ended = false\n const packages = args.filter((item, id) => {\n if (id > 0 && !ended) {\n ended = item.startsWith('-')\n return !ended\n }\n return false\n })\n if (packages.length > 0) {\n args.splice(1, packages.length, '--pattern', '\"' + packages.join('|') + '\"')\n }\n return args\n },\n list (args: string[]) {\n return npmToYarnTable.ls(args)\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n tst: 'test',\n outdated: 'outdated',\n pack (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--filename ')\n }\n return item\n })\n }\n}\n\nexport function npmToYarn (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n const index = args.findIndex(a => a === '--')\n if (index >= 0) {\n args.splice(index, 1)\n }\n\n if (unchangedCLICommands.includes(args[0])) {\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else if (args[0] in npmToYarnTable) {\n const converter = npmToYarnTable[args[0] as keyof typeof npmToYarnTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'yarn ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { parse } from './command'\n\nfunction convertPnpmInstallArgs (args: string[]) {\n return args.map(item => {\n switch (item) {\n case '--save':\n case '-S':\n return ''\n case '--no-package-lock':\n return '--frozen-lockfile'\n // case '--save-dev':\n // case '-D':\n // case '--save-prod':\n // case '-P':\n // case '--save-optional':\n // case '-O':\n // case '--save-exact':\n // case '-E':\n // case '--global':\n // case '-g':\n default:\n return item\n }\n })\n}\n\nfunction convertFilterArg (args: string[]) {\n if (args.length > 1) {\n const filter = args.filter((item, index) => index !== 0 && !item.startsWith('-'))\n if (filter.length > 0) {\n args = args.filter((item, index) => index === 0 || item.startsWith('-'))\n args.push('--filter')\n args.push(filter.join(' '))\n }\n }\n\n return args\n}\n\nconst npmToPnpmTable = {\n // ------------------------------\n install (args: string[]) {\n if (args.length > 1 && args.filter(item => !item.startsWith('-')).length > 1) {\n args[0] = 'add'\n }\n return convertPnpmInstallArgs(args)\n },\n i (args: string[]) {\n return npmToPnpmTable.install(args)\n },\n // ------------------------------\n uninstall (args: string[]) {\n args[0] = 'remove'\n\n return convertPnpmInstallArgs(args)\n },\n un (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n remove (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n r (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n rm (args: string[]) {\n return npmToPnpmTable.uninstall(args)\n },\n // ------------------------------\n rb (args: string[]) {\n return npmToPnpmTable.rebuild(args)\n },\n rebuild (args: string[]) {\n args[0] = 'rebuild'\n return convertFilterArg(args)\n },\n run: 'run',\n exec: 'exec',\n ls (args: string[]) {\n return npmToPnpmTable.list(args)\n },\n list (args: string[]) {\n return args.map(item => {\n if (item.startsWith('--depth=')) {\n return `--depth ${item.split('=')[1]}`\n }\n switch (item) {\n case '--production':\n return '--prod'\n case '--development':\n return '--dev'\n default:\n return item\n }\n })\n },\n init (args: string[]) {\n if (args[1] && !args[1].startsWith('-')) {\n args[0] = 'create'\n }\n return args.filter(item => item !== '--scope')\n },\n ln: 'link',\n t: 'test',\n test: 'test',\n tst: 'test',\n start: 'start',\n link: 'link',\n unlink (args: string[]) {\n return convertFilterArg(args)\n },\n outdated: 'outdated',\n pack: (args: string[]) => {\n return args.map(item => {\n if (item.startsWith('--pack-destination')) {\n return item.replace(/^--pack-destination[\\s=]/, '--pack-destination ')\n }\n return item\n })\n }\n}\n\nexport function npmToPnpm (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n if (args[0] in npmToPnpmTable) {\n const converter = npmToPnpmTable[args[0] as keyof typeof npmToPnpmTable]\n\n if (typeof converter === 'function') {\n args = converter(args)\n } else {\n args[0] = converter\n }\n\n return 'pnpm ' + args.filter(Boolean).join(' ')\n } else {\n return 'npm ' + command + \"\\n# couldn't auto-convert command\"\n }\n}\n","import { parse } from './command'\n\nfunction convertInstallArgs (args: string[]) {\n // bun uses -g and --global flags\n // bun mostly conforms to Yarn's CLI\n return args.map(item => {\n switch (item) {\n case '--save-dev':\n case '--development':\n case '-D':\n return '--dev'\n case '--save-prod':\n case '-P':\n return '--production'\n case '--no-package-lock':\n return '--no-save'\n case '--save-optional':\n case '-O':\n return '--optional'\n case '--save-exact':\n case '-E':\n return '--exact'\n case '--save':\n case '-S':\n // this is default in bun\n return ''\n case '--global':\n case '-g':\n return '--global'\n default:\n return item\n }\n })\n}\n\nexport const bunCLICommands = [\n 'init',\n 'run',\n 'add',\n 'pm',\n 'help',\n 'install',\n 'remove',\n 'upgrade',\n 'version'\n] as const\ntype bunCLICommands = typeof bunCLICommands[number]\n\nexport function npmToBun (_m: string, command: string): string {\n let args = parse((command || '').trim())\n\n const index = args.findIndex(a => a === '--')\n if (index >= 0) {\n args.splice(index, 1)\n }\n\n let cmd = 'bun'\n switch (args[0]) {\n case 'install':\n case 'i':\n if (args.length === 1) {\n args = ['install']\n } else {\n args[0] = 'add'\n }\n args = convertInstallArgs(args)\n break\n case 'uninstall':\n case 'un':\n case 'remove':\n case 'r':\n case 'rm':\n args[0] = 'remove'\n args = convertInstallArgs(args)\n break\n case 'cache':\n if (args[1] === 'clean') {\n args = ['pm', 'cache', 'rm'].concat(args.slice(2))\n } else {\n cmd = 'npm'\n }\n break\n case 'rebuild':\n case 'rb':\n args[0] = 'add'\n args.push('--force')\n break\n case 'run':\n break\n case 'list':\n case 'ls':\n // 'npm ls' => 'bun pm ls'\n args = convertInstallArgs(args)\n args[0] = 'ls'\n args.unshift('pm')\n break\n case 'init':\n case 'create':\n if (args[1]) {\n if (args[1].startsWith('@')) {\n cmd = 'bunx'\n\n args[1] = args[1].replace('/', '/create-')\n args = args.slice(1)\n } else if (!args[1].startsWith('-')) {\n cmd = 'bunx'\n args[1] = `create-${args[1]}`\n args = args.slice(1)\n } else {\n args[0] = 'init'\n }\n }\n break\n\n case 'link':\n case 'ln':\n args = convertInstallArgs(args)\n args[0] = 'link'\n break\n case 'stop':\n case 'start':\n case 'unlink':\n break\n case 'test':\n case 't':\n case 'tst':\n args[0] = 'test'\n args.unshift('run')\n break\n case 'exec':\n cmd = 'bunx'\n args.splice(0, 1)\n break\n default:\n // null == keep `npm` command\n cmd = 'npm'\n break\n }\n\n const filtered = args.filter(Boolean).filter(arg => arg !== '--')\n return `${cmd} ${filtered.join(' ')}${\n cmd === 'npm' ? \"\\n# couldn't auto-convert command\" : ''\n }`.replace('=', ' ')\n}\n","import { yarnToNPM } from './yarnToNpm'\nimport { npmToYarn } from './npmToYarn'\nimport { npmToPnpm } from './npmToPnpm'\nimport { npmToBun } from './npmToBun'\n\n/**\n * Converts between npm and yarn command\n */\nexport default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm' | 'bun'): string {\n if (to === 'npm') {\n return str.replace(/yarn(?: +([^&\\n\\r]*))?/gm, yarnToNPM)\n } else if (to === 'pnpm') {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToPnpm)\n } else if (to === 'bun') {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToBun)\n } else {\n return str.replace(/npm(?: +([^&\\n\\r]*))?/gm, npmToYarn)\n }\n}\n"],"names":["convertInstallArgs"],"mappings":";;;;;;IAAO,IAAM,oBAAoB,GAAG;QAClC,MAAM;QACN,OAAO;QACP,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,SAAS;QACT,OAAO;QACP,OAAO;QACP,MAAM;QACN,MAAM;KACP,CAAA;IAEM,IAAM,eAAe,GAAG;QAC7B,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;QACP,WAAW;QACX,KAAK;QACL,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,qBAAqB;QACrB,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,MAAM;QACN,SAAS;QACT,UAAU;QACV,MAAM;QACN,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AAK,MAAM;gBACT,GAAG,GAAG,MAAM,CAAA;IACZ,YAAA,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBACjB,MAAK;IACP,QAAA;;gBAEE,GAAG,GAAG,KAAK,CAAA;gBACX,MAAK;IACR,KAAA;QAED,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,KAAK,IAAI,CAAA,EAAA,CAAC,CAAA;IACjE,IAAA,OAAO,EAAG,CAAA,MAAA,CAAA,GAAG,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,MAAA,CACjC,GAAG,KAAK,KAAK,GAAG,mCAAmC,GAAG,EAAE,CACxD,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACtB;;IC1IA;;IAEG;IACW,SAAU,OAAO,CAAE,GAAW,EAAE,EAAmC,EAAA;QAC/E,IAAI,EAAE,KAAK,KAAK,EAAE;YAChB,OAAO,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;IAC1D,KAAA;aAAM,IAAI,EAAE,KAAK,MAAM,EAAE;YACxB,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;IACzD,KAAA;aAAM,IAAI,EAAE,KAAK,KAAK,EAAE;YACvB,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAA;IACxD,KAAA;IAAM,SAAA;YACL,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;IACzD,KAAA;IACH;;;;;;;;"} \ No newline at end of file diff --git a/dist/types/index.d.ts b/dist/types/index.d.ts index 94dca7d..bd5009a 100644 --- a/dist/types/index.d.ts +++ b/dist/types/index.d.ts @@ -1,4 +1,4 @@ /** * Converts between npm and yarn command */ -export default function convert(str: string, to: 'npm' | 'yarn' | 'pnpm'): string; +export default function convert(str: string, to: 'npm' | 'yarn' | 'pnpm' | 'bun'): string; diff --git a/dist/types/npmToBun.d.ts b/dist/types/npmToBun.d.ts new file mode 100644 index 0000000..8441efd --- /dev/null +++ b/dist/types/npmToBun.d.ts @@ -0,0 +1,2 @@ +export declare const bunCLICommands: readonly ["init", "run", "add", "pm", "help", "install", "remove", "upgrade", "version"]; +export declare function npmToBun(_m: string, command: string): string; diff --git a/src/index.ts b/src/index.ts index 63135a2..d1ede35 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,15 +1,18 @@ import { yarnToNPM } from './yarnToNpm' import { npmToYarn } from './npmToYarn' import { npmToPnpm } from './npmToPnpm' +import { npmToBun } from './npmToBun' /** * Converts between npm and yarn command */ -export default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm'): string { +export default function convert (str: string, to: 'npm' | 'yarn' | 'pnpm' | 'bun'): string { if (to === 'npm') { return str.replace(/yarn(?: +([^&\n\r]*))?/gm, yarnToNPM) } else if (to === 'pnpm') { return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToPnpm) + } else if (to === 'bun') { + return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToBun) } else { return str.replace(/npm(?: +([^&\n\r]*))?/gm, npmToYarn) } diff --git a/src/npmToBun.ts b/src/npmToBun.ts new file mode 100644 index 0000000..e080b44 --- /dev/null +++ b/src/npmToBun.ts @@ -0,0 +1,144 @@ +import { parse } from './command' + +function convertInstallArgs (args: string[]) { + // bun uses -g and --global flags + // bun mostly conforms to Yarn's CLI + return args.map(item => { + switch (item) { + case '--save-dev': + case '--development': + case '-D': + return '--dev' + case '--save-prod': + case '-P': + return '--production' + case '--no-package-lock': + return '--no-save' + case '--save-optional': + case '-O': + return '--optional' + case '--save-exact': + case '-E': + return '--exact' + case '--save': + case '-S': + // this is default in bun + return '' + case '--global': + case '-g': + return '--global' + default: + return item + } + }) +} + +export const bunCLICommands = [ + 'init', + 'run', + 'add', + 'pm', + 'help', + 'install', + 'remove', + 'upgrade', + 'version' +] as const +type bunCLICommands = typeof bunCLICommands[number] + +export function npmToBun (_m: string, command: string): string { + let args = parse((command || '').trim()) + + const index = args.findIndex(a => a === '--') + if (index >= 0) { + args.splice(index, 1) + } + + let cmd = 'bun' + switch (args[0]) { + case 'install': + case 'i': + if (args.length === 1) { + args = ['install'] + } else { + args[0] = 'add' + } + args = convertInstallArgs(args) + break + case 'uninstall': + case 'un': + case 'remove': + case 'r': + case 'rm': + args[0] = 'remove' + args = convertInstallArgs(args) + break + case 'cache': + if (args[1] === 'clean') { + args = ['pm', 'cache', 'rm'].concat(args.slice(2)) + } else { + cmd = 'npm' + } + break + case 'rebuild': + case 'rb': + args[0] = 'add' + args.push('--force') + break + case 'run': + break + case 'list': + case 'ls': + // 'npm ls' => 'bun pm ls' + args = convertInstallArgs(args) + args[0] = 'ls' + args.unshift('pm') + break + case 'init': + case 'create': + if (args[1]) { + if (args[1].startsWith('@')) { + cmd = 'bunx' + + args[1] = args[1].replace('/', '/create-') + args = args.slice(1) + } else if (!args[1].startsWith('-')) { + cmd = 'bunx' + args[1] = `create-${args[1]}` + args = args.slice(1) + } else { + args[0] = 'init' + } + } + break + + case 'link': + case 'ln': + args = convertInstallArgs(args) + args[0] = 'link' + break + case 'stop': + case 'start': + case 'unlink': + break + case 'test': + case 't': + case 'tst': + args[0] = 'test' + args.unshift('run') + break + case 'exec': + cmd = 'bunx' + args.splice(0, 1) + break + default: + // null == keep `npm` command + cmd = 'npm' + break + } + + const filtered = args.filter(Boolean).filter(arg => arg !== '--') + return `${cmd} ${filtered.join(' ')}${ + cmd === 'npm' ? "\n# couldn't auto-convert command" : '' + }`.replace('=', ' ') +} diff --git a/test/index.spec.ts b/test/index.spec.ts index b7030f0..3a2fe10 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -3,190 +3,320 @@ import convert from '../src' describe('NPM tests', () => { - const tests = [ + const tests: [npm: string, yarn: string, pnpm: string, bun: string][] = [ // install - ['npm install', 'yarn install', 'pnpm install'], - ['npm i', 'yarn install', 'pnpm i'], - ['npm i squirrelly', 'yarn add squirrelly', 'pnpm add squirrelly'], - ['npm install squirrelly', 'yarn add squirrelly', 'pnpm add squirrelly'], - ['npm install my--save-dev', 'yarn add my--save-dev', 'pnpm add my--save-dev'], + ['npm install', 'yarn install', 'pnpm install', 'bun install'], + ['npm i', 'yarn install', 'pnpm i', 'bun install'], + ['npm i squirrelly', 'yarn add squirrelly', 'pnpm add squirrelly', 'bun add squirrelly'], + ['npm install squirrelly', 'yarn add squirrelly', 'pnpm add squirrelly', 'bun add squirrelly'], + [ + 'npm install my--save-dev', + 'yarn add my--save-dev', + 'pnpm add my--save-dev', + 'bun add my--save-dev', + ], [ 'npm install squirrelly --no-package-lock', 'yarn add squirrelly --no-lockfile', - 'pnpm add squirrelly --frozen-lockfile' + 'pnpm add squirrelly --frozen-lockfile', + 'bun add squirrelly --no-save', ], [ 'npm install squirrelly --save-optional', 'yarn add squirrelly --optional', - 'pnpm add squirrelly --save-optional' + 'pnpm add squirrelly --save-optional', + 'bun add squirrelly --optional', + ], + [ + 'npm install squirrelly -O', + 'yarn add squirrelly --optional', + 'pnpm add squirrelly -O', + 'bun add squirrelly --optional', ], - ['npm install squirrelly -O', 'yarn add squirrelly --optional', 'pnpm add squirrelly -O'], [ 'npm install squirrelly --save-exact', 'yarn add squirrelly --exact', - 'pnpm add squirrelly --save-exact' + 'pnpm add squirrelly --save-exact', + 'bun add squirrelly --exact', + ], + [ + 'npm install squirrelly -E', + 'yarn add squirrelly --exact', + 'pnpm add squirrelly -E', + 'bun add squirrelly --exact', ], - ['npm install squirrelly -E', 'yarn add squirrelly --exact', 'pnpm add squirrelly -E'], [ 'npm install squirrelly --save-dev', 'yarn add squirrelly --dev', - 'pnpm add squirrelly --save-dev' + 'pnpm add squirrelly --save-dev', + 'bun add squirrelly --dev', + ], + [ + 'npm install squirrelly -D', + 'yarn add squirrelly --dev', + 'pnpm add squirrelly -D', + 'bun add squirrelly --dev', ], - ['npm install squirrelly -D', 'yarn add squirrelly --dev', 'pnpm add squirrelly -D'], [ 'npm install squirrelly --save-prod', 'yarn add squirrelly --production', - 'pnpm add squirrelly --save-prod' + 'pnpm add squirrelly --save-prod', + 'bun add squirrelly --production', + ], + [ + 'npm install squirrelly -P', + 'yarn add squirrelly --production', + 'pnpm add squirrelly -P', + 'bun add squirrelly --production', + ], + [ + 'npm install squirrelly --save', + 'yarn add squirrelly', + 'pnpm add squirrelly', + 'bun add squirrelly', + ], + [ + 'npm install squirrelly -S', + 'yarn add squirrelly', + 'pnpm add squirrelly', + 'bun add squirrelly', ], - ['npm install squirrelly -P', 'yarn add squirrelly --production', 'pnpm add squirrelly -P'], - ['npm install squirrelly --save', 'yarn add squirrelly', 'pnpm add squirrelly'], - ['npm install squirrelly -S', 'yarn add squirrelly', 'pnpm add squirrelly'], [ 'npm install squirrelly --global', 'yarn global add squirrelly', - 'pnpm add squirrelly --global' + 'pnpm add squirrelly --global', + 'bun add squirrelly --global', + ], + [ + 'npm install squirrelly -g', + 'yarn global add squirrelly', + 'pnpm add squirrelly -g', + 'bun add squirrelly --global', ], - ['npm install squirrelly -g', 'yarn global add squirrelly', 'pnpm add squirrelly -g'], [ 'npm install squirrelly --no-save', 'yarn add squirrelly --no-save', - 'pnpm add squirrelly --no-save' + 'pnpm add squirrelly --no-save', + 'bun add squirrelly --no-save', ], // uninstall - ['npm r squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly'], - ['npm remove squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly'], - ['npm uninstall squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly'], - ['npm un squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly'], + ['npm r squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly', 'bun remove squirrelly'], + ['npm remove squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly', 'bun remove squirrelly'], + ['npm uninstall squirrelly', 'yarn remove squirrelly', 'pnpm remove squirrelly', 'bun remove squirrelly'], + [ + 'npm un squirrelly', + 'yarn remove squirrelly', + 'pnpm remove squirrelly', + 'bun remove squirrelly', + ], [ 'npm uninstall squirrelly --global', 'yarn global remove squirrelly', - 'pnpm remove squirrelly --global' + 'pnpm remove squirrelly --global', + 'bun remove squirrelly --global', ], // cache - ['npm cache clean', 'yarn cache clean', "npm cache clean\n# couldn't auto-convert command"], + [ + 'npm cache clean', + 'yarn cache clean', + "npm cache clean\n# couldn't auto-convert command", + 'bun pm cache rm', + ], // version - ['npm version', 'yarn version', "npm version\n# couldn't auto-convert command"], + [ + 'npm version', + 'yarn version', + "npm version\n# couldn't auto-convert command", + "npm version\n# couldn't auto-convert command", + ], [ 'npm version major', 'yarn version --major', - "npm version major\n# couldn't auto-convert command" + "npm version major\n# couldn't auto-convert command", + "npm version major\n# couldn't auto-convert command", ], [ 'npm version minor', 'yarn version --minor', - "npm version minor\n# couldn't auto-convert command" + "npm version minor\n# couldn't auto-convert command", + "npm version minor\n# couldn't auto-convert command", ], [ 'npm version patch', 'yarn version --patch', - "npm version patch\n# couldn't auto-convert command" + "npm version patch\n# couldn't auto-convert command", + "npm version patch\n# couldn't auto-convert command", ], // rebuild - ['npm rebuild', 'yarn add --force', 'pnpm rebuild'], - ['npm rb', 'yarn add --force', 'pnpm rebuild'], - ['npm rebuild package', 'yarn add package --force', 'pnpm rebuild --filter package'], - ['npm rb package', 'yarn add package --force', 'pnpm rebuild --filter package'], + ['npm rebuild', 'yarn add --force', 'pnpm rebuild', 'bun add --force'], + ['npm rb', 'yarn add --force', 'pnpm rebuild', 'bun add --force'], + [ + 'npm rebuild package', + 'yarn add package --force', + 'pnpm rebuild --filter package', + 'bun add package --force', + ], + [ + 'npm rb package', + 'yarn add package --force', + 'pnpm rebuild --filter package', + 'bun add package --force', + ], // run - ['npm run', 'yarn run', 'pnpm run'], - ['npm run package', 'yarn package', 'pnpm run package'], - ['npm run test -- --version', 'yarn run test --version', 'pnpm run test -- --version'], - ['npm run test -- -v', 'yarn run test -v', 'pnpm run test -- -v'], - ['npm run custom', 'yarn custom', 'pnpm run custom'], - ['npm run add', 'yarn run add', 'pnpm run add'], - ['npm run install', 'yarn run install', 'pnpm run install'], - ['npm run run', 'yarn run run', 'pnpm run run'], - ['npm exec custom', 'yarn custom', 'pnpm exec custom'], - ['npm exec add', 'yarn run add', 'pnpm exec add'], - ['npm exec install', 'yarn run install', 'pnpm exec install'], - ['npm exec run', 'yarn run run', 'pnpm exec run'], - ['npm exec custom -- --version', 'yarn custom --version', 'pnpm exec custom -- --version'], + ['npm run', 'yarn run', 'pnpm run', 'bun run'], + ['npm run package', 'yarn package', 'pnpm run package', 'bun run package'], + [ + 'npm run test -- --version', + 'yarn run test --version', + 'pnpm run test -- --version', + 'bun run test --version', + ], + ['npm run test -- -v', 'yarn run test -v', 'pnpm run test -- -v', 'bun run test -v'], + ['npm run custom', 'yarn custom', 'pnpm run custom', 'bun run custom'], + ['npm run add', 'yarn run add', 'pnpm run add', 'bun run add'], + ['npm run install', 'yarn run install', 'pnpm run install', 'bun run install'], + ['npm run run', 'yarn run run', 'pnpm run run', 'bun run run'], + ['npm exec custom', 'yarn custom', 'pnpm exec custom', 'bunx custom'], + ['npm exec add', 'yarn run add', 'pnpm exec add', 'bunx add'], + ['npm exec install', 'yarn run install', 'pnpm exec install', 'bunx install'], + ['npm exec run', 'yarn run run', 'pnpm exec run', 'bunx run'], + ['npm exec custom -- --version', 'yarn custom --version', 'pnpm exec custom -- --version', 'bunx custom --version'], // test - ['npm test', 'yarn test', 'pnpm test'], - ['npm t', 'yarn test', 'pnpm test'], - ['npm tst', 'yarn test', 'pnpm test'], - ['npm test -- --version', 'yarn test --version', 'pnpm test -- --version'], - ['npm test -- -v', 'yarn test -v', 'pnpm test -- -v'], + ['npm test', 'yarn test', 'pnpm test', 'bun run test'], + ['npm t', 'yarn test', 'pnpm test', 'bun run test'], + ['npm tst', 'yarn test', 'pnpm test', 'bun run test'], + [ + 'npm test -- --version', + 'yarn test --version', + 'pnpm test -- --version', + 'bun run test --version', + ], + ['npm test -- -v', 'yarn test -v', 'pnpm test -- -v', 'bun run test -v'], // unchanged - ['npm start', 'yarn start', 'pnpm start'], - ['npm stop', 'yarn stop', "npm stop\n# couldn't auto-convert command"], + ['npm start', 'yarn start', 'pnpm start', 'bun start'], + ['npm stop', 'yarn stop', "npm stop\n# couldn't auto-convert command", 'bun stop'], // unsupported [ 'npm whoami', "npm whoami\n# couldn't auto-convert command", - "npm whoami\n# couldn't auto-convert command" + "npm whoami\n# couldn't auto-convert command", + "npm whoami\n# couldn't auto-convert command", ], // init - ['npm init', 'yarn init', 'pnpm init'], - ['npm init -y', 'yarn init -y', 'pnpm init -y'], - ['npm init --yes', 'yarn init --yes', 'pnpm init --yes'], - ['npm init --scope', 'yarn init', 'pnpm init'], - ['npm init --private', 'yarn init --private', 'pnpm init --private'], - ['npm init --unknown-arg', 'yarn init --unknown-arg', 'pnpm init --unknown-arg'], - ['npm init esm --yes', 'yarn create esm --yes', 'pnpm create esm --yes'], + ['npm init', 'yarn init', 'pnpm init', 'bun init'], + ['npm init -y', 'yarn init -y', 'pnpm init -y', 'bun init -y'], + ['npm init --yes', 'yarn init --yes', 'pnpm init --yes', 'bun init --yes'], + ['npm init --scope', 'yarn init', 'pnpm init', 'bun init --scope'], + ['npm init --private', 'yarn init --private', 'pnpm init --private', 'bun init --private'], + [ + 'npm init --unknown-arg', + 'yarn init --unknown-arg', + 'pnpm init --unknown-arg', + 'bun init --unknown-arg', + ], + ['npm init esm --yes', 'yarn create esm --yes', 'pnpm create esm --yes', 'bunx create-esm --yes'], [ 'npm init @scope/my-package', 'yarn create @scope/my-package', - 'pnpm create @scope/my-package' + 'pnpm create @scope/my-package', + 'bunx @scope/create-my-package', ], [ 'npm init react-app ./my-react-app', 'yarn create react-app ./my-react-app', - 'pnpm create react-app ./my-react-app' + 'pnpm create react-app ./my-react-app', + 'bunx create-react-app ./my-react-app', ], // list - ['npm list', 'yarn list', 'pnpm list'], - ['npm ls', 'yarn list', 'pnpm ls'], - ['npm list --production', 'yarn list --production', 'pnpm list --prod'], - ['npm list --development', 'yarn list --development', 'pnpm list --dev'], - ['npm list --global', 'yarn list --global', 'pnpm list --global'], - ['npm list --depth=0', 'yarn list --depth=0', 'pnpm list --depth 0'], - ['npm list package', 'yarn list --pattern "package"', 'pnpm list package'], + ['npm list', 'yarn list', 'pnpm list', 'bun pm ls'], + ['npm ls', 'yarn list', 'pnpm ls', 'bun pm ls'], + [ + 'npm list --production', + 'yarn list --production', + 'pnpm list --prod', + 'bun pm ls --production', + ], + ['npm list --development', 'yarn list --development', 'pnpm list --dev', 'bun pm ls --dev'], + ['npm list --global', 'yarn list --global', 'pnpm list --global', 'bun pm ls --global'], + ['npm list --depth=0', 'yarn list --depth=0', 'pnpm list --depth 0', 'bun pm ls --depth 0'], + ['npm list package', 'yarn list --pattern "package"', 'pnpm list package', 'bun pm ls package'], [ 'npm list package package2', 'yarn list --pattern "package|package2"', - 'pnpm list package package2' + 'pnpm list package package2', + 'bun pm ls package package2', ], [ 'npm list @scope/package @scope/package2', 'yarn list --pattern "@scope/package|@scope/package2"', - 'pnpm list @scope/package @scope/package2' + 'pnpm list @scope/package @scope/package2', + 'bun pm ls @scope/package @scope/package2', ], [ 'npm list @scope/package @scope/package2 --depth=2', 'yarn list --pattern "@scope/package|@scope/package2" --depth=2', - 'pnpm list @scope/package @scope/package2 --depth 2' + 'pnpm list @scope/package @scope/package2 --depth 2', + 'bun pm ls @scope/package @scope/package2 --depth 2', ], [ 'npm list @scope/package @scope/package2 --depth 2', 'yarn list --pattern "@scope/package|@scope/package2" --depth 2', - 'pnpm list @scope/package @scope/package2 --depth 2' + 'pnpm list @scope/package @scope/package2 --depth 2', + 'bun pm ls @scope/package @scope/package2 --depth 2', ], [ 'npm list @scope/package --json', 'yarn list --pattern "@scope/package" --json', - 'pnpm list @scope/package --json' + 'pnpm list @scope/package --json', + 'bun pm ls @scope/package --json', ], // link - ['npm ln', 'yarn link', 'pnpm link'], - ['npm ln package', 'yarn link package', 'pnpm link package'], - ['npm link', 'yarn link', 'pnpm link'], - ['npm link package', 'yarn link package', 'pnpm link package'], + ['npm ln', 'yarn link', 'pnpm link', 'bun link'], + ['npm ln package', 'yarn link package', 'pnpm link package', 'bun link package'], + ['npm link', 'yarn link', 'pnpm link', 'bun link'], + ['npm link package', 'yarn link package', 'pnpm link package', 'bun link package'], // unlink - ['npm unlink', 'yarn unlink', 'pnpm unlink'], - ['npm unlink package', 'yarn unlink package', 'pnpm unlink --filter package'], + ['npm unlink', 'yarn unlink', 'pnpm unlink', 'bun unlink'], + [ + 'npm unlink package', + 'yarn unlink package', + 'pnpm unlink --filter package', + 'bun unlink package', + ], // outdated - ['npm outdated', 'yarn outdated', 'pnpm outdated'], - ['npm outdated --json', 'yarn outdated --json', 'pnpm outdated --json'], - ['npm outdated --long', 'yarn outdated --long', 'pnpm outdated --long'], - ['npm outdated lodash', 'yarn outdated lodash', 'pnpm outdated lodash'], + [ + 'npm outdated', + 'yarn outdated', + 'pnpm outdated', + "npm outdated\n# couldn't auto-convert command", + ], + [ + 'npm outdated --json', + 'yarn outdated --json', + 'pnpm outdated --json', + "npm outdated --json\n# couldn't auto-convert command", + ], + [ + 'npm outdated --long', + 'yarn outdated --long', + 'pnpm outdated --long', + "npm outdated --long\n# couldn't auto-convert command", + ], + [ + 'npm outdated lodash', + 'yarn outdated lodash', + 'pnpm outdated lodash', + "npm outdated lodash\n# couldn't auto-convert command", + ], // pack - ['npm pack', 'yarn pack', 'pnpm pack'], + ['npm pack', 'yarn pack', 'pnpm pack', "npm pack\n# couldn't auto-convert command"], [ 'npm pack --pack-destination=foobar', 'yarn pack --filename foobar', - 'pnpm pack --pack-destination foobar' - ] - ] + 'pnpm pack --pack-destination foobar', + "npm pack --pack-destination foobar\n# couldn't auto-convert command", + ], + ]; describe('to Yarn', () => { it.each(tests)('%s', (npmValue, yarnValue) => { @@ -199,6 +329,12 @@ describe('NPM tests', () => { expect(convert(npmValue, 'pnpm')).toEqual(pnpmValue) }) }) + + describe('to Bun', () => { + it.each(tests)('%s', (npmValue, _yarnValue, _pnpmValue, bunValue) => { + expect(convert(npmValue, 'bun')).toEqual(bunValue) + }) + }) }) describe('Yarn to NPM tests', () => {