From ca64dcec76d62378412172de9f1bcc8d18012119 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 19 Feb 2023 17:11:55 +0100 Subject: [PATCH] fix: add missing yarn pack and outdated, and remove incorrect --save --- dist/npm-to-yarn.mjs | 19 ++-- dist/npm-to-yarn.mjs.map | 2 +- dist/npm-to-yarn.umd.js | 19 ++-- dist/npm-to-yarn.umd.js.map | 2 +- src/npmToYarn.ts | 2 +- src/yarnToNpm.ts | 21 ++-- test/index.spec.ts | 208 +++++++++++++++--------------------- 7 files changed, 115 insertions(+), 158 deletions(-) diff --git a/dist/npm-to-yarn.mjs b/dist/npm-to-yarn.mjs index 06fa265..425037a 100644 --- a/dist/npm-to-yarn.mjs +++ b/dist/npm-to-yarn.mjs @@ -107,20 +107,10 @@ var yarnToNpmTable = { return ['rebuild']; } args[0] = 'install'; - if (!args.includes('--dev') && - !args.includes('--force') && - !args.includes('--exact') && - !args.includes('--optional') && - !args.includes('--production')) { - args.push('--save'); - } return convertAddRemoveArgs(args); }, remove: function (args) { args[0] = 'uninstall'; - if (!args.includes('--dev')) { - args.push('--save'); - } return convertAddRemoveArgs(args); }, version: function (args) { @@ -149,6 +139,7 @@ var yarnToNpmTable = { }, init: 'init', create: 'init', + outdated: 'outdated', run: 'run', global: function (args) { switch (args[1]) { @@ -173,6 +164,14 @@ var yarnToNpmTable = { args.push("\n# couldn't auto-convert command"); return args; } + }, + pack: function (args) { + return args.map(function (item) { + if (item === '--filename') { + return '--pack-destination'; + } + return item; + }); } }; function yarnToNPM(_m, command) { diff --git a/dist/npm-to-yarn.mjs.map b/dist/npm-to-yarn.mjs.map index 7c03476..b2b07be 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 if (\n !args.includes('--dev') &&\n !args.includes('--force') &&\n !args.includes('--exact') &&\n !args.includes('--optional') &&\n !args.includes('--production')\n ) {\n args.push('--save')\n }\n return convertAddRemoveArgs(args)\n },\n remove (args: string[]) {\n args[0] = 'uninstall'\n if (!args.includes('--dev')) {\n args.push('--save')\n }\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 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}\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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AAI,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/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,qBA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B,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 diff --git a/dist/npm-to-yarn.umd.js b/dist/npm-to-yarn.umd.js index 9a0ad73..2688fff 100644 --- a/dist/npm-to-yarn.umd.js +++ b/dist/npm-to-yarn.umd.js @@ -113,20 +113,10 @@ return ['rebuild']; } args[0] = 'install'; - if (!args.includes('--dev') && - !args.includes('--force') && - !args.includes('--exact') && - !args.includes('--optional') && - !args.includes('--production')) { - args.push('--save'); - } return convertAddRemoveArgs(args); }, remove: function (args) { args[0] = 'uninstall'; - if (!args.includes('--dev')) { - args.push('--save'); - } return convertAddRemoveArgs(args); }, version: function (args) { @@ -155,6 +145,7 @@ }, init: 'init', create: 'init', + outdated: 'outdated', run: 'run', global: function (args) { switch (args[1]) { @@ -179,6 +170,14 @@ args.push("\n# couldn't auto-convert command"); return args; } + }, + pack: function (args) { + return args.map(function (item) { + if (item === '--filename') { + return '--pack-destination'; + } + return item; + }); } }; function yarnToNPM(_m, command) { diff --git a/dist/npm-to-yarn.umd.js.map b/dist/npm-to-yarn.umd.js.map index babf36f..d1b8126 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 if (\n !args.includes('--dev') &&\n !args.includes('--force') &&\n !args.includes('--exact') &&\n !args.includes('--optional') &&\n !args.includes('--production')\n ) {\n args.push('--save')\n }\n return convertAddRemoveArgs(args)\n },\n remove (args: string[]) {\n args[0] = 'uninstall'\n if (!args.includes('--dev')) {\n args.push('--save')\n }\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 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}\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":";;;;;;EAAO,IAAM,oBAAoB,GAAG;MAClC,MAAM;MACN,OAAO;MACP,QAAQ;MACR,MAAM;MACN,QAAQ;MACR,SAAS;MACT,OAAO;MACP,OAAO;MACP,MAAM;MACN,MAAM;GACP,CAAA;EAEM,IAAM,eAAe,GAAG;MAC7B,MAAM;MACN,KAAK;MACL,KAAK;MACL,OAAO;MACP,WAAW;MACX,KAAK;MACL,OAAO;MACP,QAAQ;MACR,QAAQ;MACR,QAAQ;MACR,qBAAqB;MACrB,QAAQ;MACR,MAAM;MACN,QAAQ;MACR,MAAM;MACN,SAAS;MACT,UAAU;MACV,MAAM;MACN,UAAU;MACV,UAAU;MACV,OAAO;MACP,MAAM;MACN,UAAU;MACV,OAAO;MACP,QAAQ;MACR,aAAa;MACb,KAAK;MACL,MAAM;MACN,SAAS;MACT,qBAAqB;MACrB,SAAS;MACT,UAAU;MACV,KAAK;MACL,WAAW;MACX,YAAY;GACb;;ECjDK,SAAU,KAAK,CAAE,OAAe,EAAA;MACpC,IAAM,IAAI,GAAa,EAAE,CAAA;MACzB,IAAI,SAAS,GAAmB,KA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B,EAAE,SAAS,CAAC,CAAA;EACzD,KAAA;EAAM,SAAA;UACL,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;EACzD,KAAA;EACH;;;;;;;;"} \ 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/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":";;;;;;EAAO,IAAM,oBAAoB,GAAG;MAClC,MAAM;MACN,OAAO;MACP,QAAQ;MACR,MAAM;MACN,QAAQ;MACR,SAAS;MACT,OAAO;MACP,OAAO;MACP,MAAM;MACN,MAAM;GACP,CAAA;EAEM,IAAM,eAAe,GAAG;MAC7B,MAAM;MACN,KAAK;MACL,KAAK;MACL,OAAO;MACP,WAAW;MACX,KAAK;MACL,OAAO;MACP,QAAQ;MACR,QAAQ;MACR,QAAQ;MACR,qBAAqB;MACrB,QAAQ;MACR,MAAM;MACN,QAAQ;MACR,MAAM;MACN,SA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CAAA;EAC1D,KAAA;WAAM,IAAI,EAAE,KAAK,MAAM,EAAE;UACxB,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;EACzD,KAAA;EAAM,SAAA;UACL,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;EACzD,KAAA;EACH;;;;;;;;"} \ No newline at end of file diff --git a/src/npmToYarn.ts b/src/npmToYarn.ts index 229aa7d..3368268 100644 --- a/src/npmToYarn.ts +++ b/src/npmToYarn.ts @@ -123,7 +123,7 @@ const npmToYarnTable = { t: 'test', tst: 'test', outdated: 'outdated', - pack: (args: string[]) => { + pack (args: string[]) { return args.map(item => { if (item.startsWith('--pack-destination')) { return item.replace(/^--pack-destination[\s=]/, '--filename ') diff --git a/src/yarnToNpm.ts b/src/yarnToNpm.ts index 2f9204c..19fa26c 100644 --- a/src/yarnToNpm.ts +++ b/src/yarnToNpm.ts @@ -26,22 +26,10 @@ const yarnToNpmTable = { return ['rebuild'] } args[0] = 'install' - if ( - !args.includes('--dev') && - !args.includes('--force') && - !args.includes('--exact') && - !args.includes('--optional') && - !args.includes('--production') - ) { - args.push('--save') - } return convertAddRemoveArgs(args) }, remove (args: string[]) { args[0] = 'uninstall' - if (!args.includes('--dev')) { - args.push('--save') - } return convertAddRemoveArgs(args) }, version (args: string[]) { @@ -70,6 +58,7 @@ const yarnToNpmTable = { }, init: 'init', create: 'init', + outdated: 'outdated', run: 'run', global (args: string[]) { switch (args[1]) { @@ -94,6 +83,14 @@ const yarnToNpmTable = { args.push("\n# couldn't auto-convert command") return args } + }, + pack (args: string[]) { + return args.map(item => { + if (item === '--filename') { + return '--pack-destination' + } + return item + }) } } diff --git a/test/index.spec.ts b/test/index.spec.ts index 48d5e62..b7030f0 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -202,130 +202,92 @@ describe('NPM tests', () => { }) describe('Yarn to NPM tests', () => { - it('Simple convert works', () => { - expect(convert('yarn add squirrelly', 'npm')).toEqual('npm install squirrelly --save') - expect(convert('yarn add squirrelly --no-lockfile', 'npm')).toEqual( - 'npm install squirrelly --no-package-lock --save' - ) - expect(convert('yarn add squirrelly --optional', 'npm')).toEqual( - 'npm install squirrelly --save-optional' - ) - expect(convert('yarn add squirrelly --exact', 'npm')).toEqual( - 'npm install squirrelly --save-exact' - ) - expect(convert('yarn add test --production', 'npm')).toEqual('npm install test --save-prod') - }) - - it('Convert with dev works', () => { - expect(convert('yarn add squirrelly --dev', 'npm')).toEqual('npm install squirrelly --save-dev') - }) - - it('Convert with remove works', () => { - expect(convert('yarn remove squirrelly --dev', 'npm')).toEqual( - 'npm uninstall squirrelly --save-dev' - ) - }) - - it('Convert with cache clean works', () => { - expect(convert('yarn cache clean', 'npm')).toEqual('npm cache clean') - }) - - it('Yarn implied run', () => { - expect(convert('yarn grunt', 'npm')).toEqual('npm run grunt') - }) - - it('Plain yarn install', () => { - expect(convert('yarn install', 'npm')).toEqual('npm install') - }) - - it('Yarn global', () => { - expect(convert('yarn global add squirrelly', 'npm')).toEqual( - 'npm install squirrelly --save --global' - ) - expect(convert('yarn global remove squirrelly', 'npm')).toEqual( - 'npm uninstall squirrelly --save --global' - ) - expect(convert('yarn global squirrelly', 'npm')).toEqual( - 'npm global squirrelly \n' + "# couldn't auto-convert command" - ) - expect(convert('yarn global list', 'npm')).toEqual('npm ls --global') - }) - - it('Plain `yarn`', () => { - expect(convert('yarn', 'npm')).toEqual('npm install') - }) - - it('yarn add --force', () => { - expect(convert('yarn add --force', 'npm')).toEqual('npm rebuild') - expect(convert('yarn add package --force', 'npm')).toEqual('npm install package --force') - }) - - it('Version works', () => { - expect(convert('yarn version', 'npm')).toEqual('npm version') - expect(convert('yarn version --major', 'npm')).toEqual('npm version major') - expect(convert('yarn version --minor', 'npm')).toEqual('npm version minor') - expect(convert('yarn version --patch', 'npm')).toEqual('npm version patch') - }) - - it('Yarn remove', () => { - expect(convert('yarn remove squirrelly', 'npm')).toEqual('npm uninstall squirrelly --save') - }) - - it("Yarn upgrade-interactive can't auto-convert", () => { - expect(convert('yarn upgrade-interactive', 'npm')).toEqual( - "npm upgrade-interactive\n# couldn't auto-convert command" - ) - }) - - it('yarn init', () => { - expect(convert('yarn init', 'npm')).toEqual('npm init') - expect(convert('yarn init -y', 'npm')).toEqual('npm init -y') - expect(convert('yarn init --yes', 'npm')).toEqual('npm init --yes') - expect(convert('yarn init --private', 'npm')).toEqual('npm init --private') - expect(convert('yarn init --unknown-arg', 'npm')).toEqual('npm init --unknown-arg') - }) - - it('yarn create', () => { - expect(convert('yarn create esm --yes', 'npm')).toEqual('npm init esm --yes') - expect(convert('yarn create @scope/my-package', 'npm')).toEqual('npm init @scope/my-package') - expect(convert('yarn create react-app ./my-react-app', 'npm')).toEqual( - 'npm init react-app ./my-react-app' - ) - }) - - it('npm custom', () => { - expect(convert('yarn start', 'npm')).toEqual('npm start') - expect(convert('yarn stop', 'npm')).toEqual('npm stop') - expect(convert('yarn test', 'npm')).toEqual('npm test') - }) - - it('yarn run', () => { - expect(convert('yarn custom', 'npm')).toEqual('npm run custom') - expect(convert('yarn run custom', 'npm')).toEqual('npm run custom') - expect(convert('yarn run add', 'npm')).toEqual('npm run add') - expect(convert('yarn run install', 'npm')).toEqual('npm run install') - expect(convert('yarn run run', 'npm')).toEqual('npm run run') - // with args - expect(convert('yarn custom -- --version', 'npm')).toEqual('npm run custom -- --version') - expect(convert('yarn run custom --version', 'npm')).toEqual('npm run custom --version') - expect(convert('yarn run custom -- --version', 'npm')).toEqual('npm run custom -- --version') - }) - - it('yarn list', () => { - expect(convert('yarn list', 'npm')).toEqual('npm ls') - expect(convert('yarn list --pattern "package"', 'npm')).toEqual('npm ls package') - expect(convert('yarn list --pattern "package|package2"', 'npm')).toEqual( - 'npm ls package package2' - ) - expect(convert('yarn list --pattern "@scope/package|@scope/package2"', 'npm')).toEqual( + const tests = [ + // install + ['yarn', 'npm install'], + ['yarn install', 'npm install'], + // add + ['yarn add squirrelly', 'npm install squirrelly'], + ['yarn add squirrelly --no-lockfile', 'npm install squirrelly --no-package-lock'], + ['yarn add squirrelly --optional', 'npm install squirrelly --save-optional'], + ['yarn add squirrelly --exact', 'npm install squirrelly --save-exact'], + ['yarn add squirrelly --production', 'npm install squirrelly --save-prod'], + ['yarn add squirrelly --dev', 'npm install squirrelly --save-dev'], + ['yarn add --force', 'npm rebuild'], + ['yarn add package --force', 'npm install package --force'], + // remove + ['yarn remove squirrelly', 'npm uninstall squirrelly'], + ['yarn remove squirrelly --dev', 'npm uninstall squirrelly --save-dev'], + // cache + ['yarn cache clean', 'npm cache clean'], + // implied run + ['yarn grunt', 'npm run grunt'], + // global + ['yarn global add squirrelly', 'npm install squirrelly --global'], + ['yarn global remove squirrelly', 'npm uninstall squirrelly --global'], + ['yarn global squirrelly', "npm global squirrelly \n# couldn't auto-convert command"], + ['yarn global list', 'npm ls --global'], + // version + ['yarn version', 'npm version'], + ['yarn version --major', 'npm version major'], + ['yarn version --minor', 'npm version minor'], + ['yarn version --patch', 'npm version patch'], + // init + ['yarn init', 'npm init'], + ['yarn init -y', 'npm init -y'], + ['yarn init --yes', 'npm init --yes'], + ['yarn init --private', 'npm init --private'], + ['yarn init --unknown-arg', 'npm init --unknown-arg'], + // create + ['yarn create esm --yes', 'npm init esm --yes'], + ['yarn create @scope/my-package', 'npm init @scope/my-package'], + ['yarn create react-app ./my-react-app', 'npm init react-app ./my-react-app'], + // unchanged + ['yarn start', 'npm start'], + ['yarn stop', 'npm stop'], + ['yarn test', 'npm test'], + // run + ['yarn run', 'npm run'], + ['yarn custom', 'npm run custom'], + ['yarn run custom', 'npm run custom'], + ['yarn run add', 'npm run add'], + ['yarn run install', 'npm run install'], + ['yarn run run', 'npm run run'], + ['yarn run --silent', 'npm run --silent'], + ['yarn custom -- --version', 'npm run custom -- --version'], + ['yarn run custom -- --version', 'npm run custom -- --version'], + ['yarn run custom --version', 'npm run custom --version'], + // list + ['yarn list', 'npm ls'], + ['yarn list --pattern "package"', 'npm ls package'], + ['yarn list --pattern "package|package2"', 'npm ls package package2'], + [ + 'yarn list --pattern "@scope/package|@scope/package2"', 'npm ls @scope/package @scope/package2' - ) - expect(convert('yarn list --production', 'npm')).toEqual('npm ls --production') - expect(convert('yarn list --development', 'npm')).toEqual('npm ls --development') - }) + ], + ['yarn list --depth 2', 'npm ls --depth 2'], + ['yarn list --json', 'npm ls --json'], + ['yarn list --production', 'npm ls --production'], + ['yarn list --development', 'npm ls --development'], + // link/unlink + ['yarn link', 'npm link'], + ['yarn link custom', 'npm link custom'], + ['yarn unlink', 'npm unlink'], + ['yarn unlink custom', 'npm unlink custom'], + // outdated + ['yarn outdated', 'npm outdated'], + ['yarn outdated --json', 'npm outdated --json'], + ['yarn outdated --long', 'npm outdated --long'], + ['yarn outdated lodash', 'npm outdated lodash'], + // pack + ['yarn pack', 'npm pack'], + ['yarn pack --filename foobar', 'npm pack --pack-destination foobar'], + // unsupported + ['yarn why', "npm why\n# couldn't auto-convert command"], + ['yarn upgrade-interactive', "npm upgrade-interactive\n# couldn't auto-convert command"] + ] - it('npm link/unlink', () => { - expect(convert('yarn link custom', 'npm')).toEqual('npm link custom') - expect(convert('yarn unlink custom', 'npm')).toEqual('npm unlink custom') + it.each(tests)('%s', (yarnValue, npmValue) => { + expect(convert(yarnValue, 'npm')).toEqual(npmValue) }) })