jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.
MIT License
1.51k stars 21 forks source link

Feature Request: Exit Code should reflect if changes are required on a new paramter like --check #72

Closed Xyaren closed 2 years ago

Xyaren commented 3 years ago

As the title says. I would like to add this to a ci "linting" pipeline, therefore setting the rturn code to something other than 0 if there should be new typings added or removed would be nice.

I would suggest something like typesync --check which behaves like --dry but alters the return code. or you paramerize the dry parameter like typesync --dry=fail

Thank you!

jeffijoe commented 3 years ago

Curious, what is the value proposition for enforcing this in CI?

I'd accept a PR for this though, not sure whether --check or --dry=fail is preferable; the former makes more sense from an API perspective but it also results in an implicit --dry. 🤔

Xyaren commented 3 years ago

This basically enforces the type definitions to be present at all times within the package.json.

Scenario: One developer forgets to "typesync" after adding a new dependency, pushes. The next developer pulls the changes, and then executes npm install & typesync. The expectation would be, that he does not have any outstanding files, that he has to commit.

Adding a step to the CI, could enforce a typesynced-package.json at all times

jlarmstrongiv commented 2 years ago

Great idea! The npm-check-updates package has a similar feature called -e, --errorLevel <n>. Being able to run typesync in a CI environment is very useful.

chelkyl commented 2 years ago

@jeffijoe We proposed a PR for the --dry=fail approach. 👍

jeffijoe commented 2 years ago

Released in 0.9 👍

jlarmstrongiv commented 2 years ago

Thank you @jeffijoe 👍