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

Scripts interpreter (getDependenciesFromScripts) interprets urls as dependencies #318

Closed
beaussan opened this issue Oct 26, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@beaussan
Copy link
Contributor

Currently, scripts that contains urls are interpreted as http: unlisted dependancies, but it shouldn't be.

Repro here :https://stackblitz.com/edit/stackblitz-starters-qj4jkx?file=package.json

Simplest package json for repro :

{
  "scripts": {
    "generate": "npx swagger-typescript-api -p http://localhost:3030/swagger.v1.json -o ./some-folder/generated --axios --single-http-client --name TestApi.ts --type-prefix Test",
  },
  "devDependencies": {
    "knip": "^2.38.1"
  }
}

Output :

Unlisted dependencies (1)
http:  package.json
Unlisted binaries (1)
swagger-typescript-api  package.json

Expected output :

Unlisted binaries (1)
swagger-typescript-api  package.json

I may have some time next week to look into it

@beaussan beaussan added the bug Something isn't working label Oct 26, 2023
@webpro
Copy link
Collaborator

webpro commented Oct 27, 2023

This is slightly confusing, as npx also has a --package (or -p) argument. Technically, one could argue that you should use the separator:

npx swagger-typescript-api -- -p http://localhost:3030/swagger.v1.json

This is also in the npx docs:

The double-hyphen character is recommended to explicitly tell npm to stop parsing command line options and switches.

Still, url's are invalid dependencies (except for e.g. Deno), so that's something Knip can take into account here too.

@webpro
Copy link
Collaborator

webpro commented Oct 27, 2023

🚀 This issue has been resolved in v2.38.2. See Release 2.38.2 for release notes.

@webpro webpro closed this as completed in 1ffd290 Oct 27, 2023
@beaussan
Copy link
Contributor Author

Thanks a lot @webpro ! You are awesome ❤️

@webpro
Copy link
Collaborator

webpro commented Oct 27, 2023

Thanks Nicolas, keep 'em coming :)

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