From 43d797c829333db78258ba2614b5b2ebbe389aa5 Mon Sep 17 00:00:00 2001 From: ozaki <29860391+OzakIOne@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:50:12 +0100 Subject: [PATCH 1/2] fix: -- argument --- src/npmToPnpm.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/npmToPnpm.ts b/src/npmToPnpm.ts index dc062c1..53ec848 100644 --- a/src/npmToPnpm.ts +++ b/src/npmToPnpm.ts @@ -123,6 +123,11 @@ const npmToPnpmTable = { export function npmToPnpm (_m: string, command: string): string { let args = parse((command || '').trim()) + const index = args.findIndex(a => a === '--') + if (index >= 0) { + args.splice(index, 1) + } + if (args[0] in npmToPnpmTable) { const converter = npmToPnpmTable[args[0] as keyof typeof npmToPnpmTable] From cb2f7dfd953b5eefb2d1f9ed9f9401639f333a6e Mon Sep 17 00:00:00 2001 From: ozakione <29860391+OzakIOne@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:45:27 +0100 Subject: [PATCH 2/2] fix: tests --- test/index.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/index.spec.ts b/test/index.spec.ts index 3a2fe10..3463e53 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -168,10 +168,10 @@ describe('NPM tests', () => { [ 'npm run test -- --version', 'yarn run test --version', - 'pnpm 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 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'], @@ -180,7 +180,7 @@ describe('NPM tests', () => { ['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'], + ['npm exec custom -- --version', 'yarn custom --version', 'pnpm exec custom --version', 'bunx custom --version'], // test ['npm test', 'yarn test', 'pnpm test', 'bun run test'], ['npm t', 'yarn test', 'pnpm test', 'bun run test'], @@ -188,10 +188,10 @@ describe('NPM tests', () => { [ 'npm test -- --version', 'yarn test --version', - 'pnpm test -- --version', + 'pnpm test --version', 'bun run test --version', ], - ['npm test -- -v', 'yarn test -v', 'pnpm test -- -v', 'bun run test -v'], + ['npm test -- -v', 'yarn test -v', 'pnpm test -v', 'bun run test -v'], // unchanged ['npm start', 'yarn start', 'pnpm start', 'bun start'], ['npm stop', 'yarn stop', "npm stop\n# couldn't auto-convert command", 'bun stop'],