Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script parser doesn't account for optional "run" when running scripts #560

Open
jgoux opened this issue Mar 20, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@jgoux
Copy link
Contributor

jgoux commented Mar 20, 2024

It seems like the script parser doesn't detect scripts when omitting the run keyword for package managers like pnpm and yarn.

In the following Github Action example, the start:server script is reported as an unlisted binary:

- name: Run dev API in the background background
        run: |
          pnpm -F @snaplet/seed start:server &
          npx --yes wait-on -d 5000 -i 2000 -t 20000 http://localhost:3000 --log --verbose

This is fixable by explicitly using run like this: pnpm -F @snaplet/seed run start:server &.

But it would be cool if the script parser works without it. 😄

@jgoux jgoux added the bug Something isn't working label Mar 20, 2024
@webpro
Copy link
Owner

webpro commented Mar 20, 2024

This issue is specific to monorepos. Knip should not match start:server in the current workspace, but in -F this one. Unfortunately this isn't trivial given how Knip currently handles this.

In general Knip should handle either pnpm start:server or pnpm run start:server fine, but does not work as expected when using the -F argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants