mockdeep / typewiz

Automatically discover and add missing types in your TypeScript code
https://medium.com/@urish/manual-typing-is-no-fun-introducing-typewiz-58e3e8813f4c
1.1k stars 46 forks source link

CLI [RFC] #53

Closed urish closed 6 years ago

urish commented 6 years ago

After trying TypeWiz on several different projects, I find it useful to have a CLI tool that will be able to perform the following tasks:

  1. instrument - in case of a custom configuration not supported by one of our plugins. One such example is rtf.js - see @zoehneto's comment explaining why it is needed.
  2. apply-types - for applying the collected types to the source code, e.g. in typewiz-webpack
  3. type-coverage - print the percentage of type coverage (can also be used to enforce specific coverage target in CI), see #48

I am thinking about renaming the core API of typewiz to typewiz-core, and then using typewiz package to the CLI, so as a user you just install typewiz and can use it (most users shouldn't care about the API part too much).

I'd love to hear user thoughts about this!

zoehneto commented 6 years ago

Sounds interesting, in terms of the interface you might want to take a look at the istanbul js frontend nyc. They also perform instrumentation and get coverage information from running the test suite. Especially nice is their mocha integration: if your code is already instrumented you just run nyc mocha some-test.js and it 'magically' gets the coverage information without any changes to the tests.

MadaraUchiha commented 6 years ago

I think that longer term we'd want some sort of UI (especially in the Webpack Plugin's case), something similar to the mobx dev tools.

All in all, a more comfortable CLI experience is something I can get behind.

urish commented 6 years ago

I prepared the ground for this by renaming the core library to typewiz-core (as part of #56), so now we have typewiz free for the CLI or whatever :)