Skip to content

Commit 2d5c0b5

Browse files
committedFeb 4, 2024
Add silent and shell-mode boolean flags to pnpm resolver (resolves #491)
1 parent d81a00f commit 2d5c0b5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎packages/knip/src/binaries/resolvers/pnpm.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ const commands = [
5757
];
5858

5959
export const resolve: Resolver = (_binary, args, { manifestScriptNames }) => {
60-
const parsed = parseArgs(args, { alias: { recursive: 'r' }, boolean: ['recursive'] });
60+
const parsed = parseArgs(args, {
61+
boolean: ['recursive', 'silent', 'shell-mode'],
62+
alias: { recursive: 'r', silent: 's', 'shell-mode': 'c' },
63+
});
6164
const [command, binary] = parsed._;
6265
if (manifestScriptNames.has(command) || commands.includes(command)) return [];
6366
if (command === 'exec') return [toBinary(binary)];

‎packages/knip/test/util/get-references-from-scripts.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ test('getReferencesFromScripts (pnpm)', () => {
149149
t('pnpm dlx pkg', []);
150150
t('pnpm --package=pkg-a dlx pkg', []);
151151
t('pnpm --recursive --parallel test -- --sequence.seed=1700316221712', []);
152+
t('pnpm program script.js', [], pkgScripts);
153+
t('pnpm --silent program script.js', [], pkgScripts);
154+
t('pnpm --silent run program script.js', [], pkgScripts);
152155
});
153156

154157
test('getReferencesFromScripts (yarn)', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.