Skip to content

Commit d6a8c3b

Browse files
committedMar 10, 2025·
Bail out early without a command in Yarn resolver (resolves #979)
1 parent c5f7f2c commit d6a8c3b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
 

‎packages/knip/src/binaries/package-manager/yarn.ts

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export const resolve: BinaryResolver = (_binary, args, options) => {
6161
const dir = parsed['top-level'] ? rootCwd : parsed.cwd ? join(cwd, parsed.cwd) : undefined;
6262
const [command, binary] = parsed._;
6363

64+
if (!command && !binary) return [];
65+
6466
if (command === 'run') {
6567
if (manifestScriptNames.has(binary)) return [];
6668
const bin = toBinary(binary, { optional: true });

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

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ test('getInputsFromScripts (yarn)', () => {
196196
t('yarn run program', [], pkgScripts);
197197
t('yarn program', [], pkgScripts);
198198
t('yarn node script.js', [toBinary('node'), toDeferResolveEntry('script.js')]);
199+
t('yarn --mode skip-build', []);
199200
});
200201

201202
test('getInputsFromScripts (yarn dlx)', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.