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

feat: config file #55

Closed zoehneto closed 6 years ago

zoehneto commented 6 years ago

Implements #31

MadaraUchiha commented 6 years ago

Very nice! I've reviewed the changes so far. Huzzah :tada:

zoehneto commented 6 years ago

@urish I have made the readFile calls asynchronous using util.promisify which breaks node 6 (see review above). If that is a problem I can add the polyfill, otherwise I would remove node 6 from .travis.yml.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+4.005%) to 90.309% when pulling 9bb3152538cc9be5d09cf5ea0436b66277ddf526 on zoehneto:config-file into d9b532c4c6e6b1b456b1043f6efddb8a66c08b4f on urish:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.7%) to 86.957% when pulling abd9aee2b8c5a5c7fb4e38e42a711631563c8d3d on zoehneto:config-file into 5b9c3d180c2a13179dc0b20df2c7707745a70dc5 on urish:master.

zoehneto commented 6 years ago

I added support for the config file to typewiz-webpack, usage:

use: [ 'ts-loader',
    {
        loader: 'typewiz-webpack',
        options: {
            typewizConfig: path.resolve(__dirname, "../typewiz.json")
        }
    }],

This only supports the instrumentation though, since typewiz-webpack doesn't apply types (it creates a json file with all gathered type information.

urish commented 6 years ago

@zoehneto I think we can drop node 6 support from the core library, and then use the polyfill just inside typewiz-node to provide a smoother experience there. WDYT?

zoehneto commented 6 years ago

According to the docs of the polyfill patching the util module from typewiz-node should work but we definitely have to test that. Do you want to do the same thing with typewiz-webpack?

zoehneto commented 6 years ago

I just implemented config support for typewiz-node (node 6 polyfill not yet included). It might be necessary to add a function to recursively search for typewiz.json in parent folders to improve mocha handling (since we can't specify a path for mocha) but I can't say since I don't use it and have no way of testing it.

urish commented 6 years ago

@zoehneto migrating to monorepo (#56) shifted some files around - basically, everything that was under src is now in packages/typewiz-core/src. If you need any help with rebasing (now or after the branch is ready), please ping here :-)

zoehneto commented 6 years ago

@urish I just did the rebase. I also changed the dependency for typewiz-node and typewiz-webpack to typewiz-core instead of typewiz.

zoehneto commented 6 years ago

@urish I just added the polyfill to typewiz-node and typewiz-webpack and updated the node version requirement for typewiz-core. That means this PR is ready for review, I'll add the documentation once that is done. Please also take a look at the open tasks in the PR description since most of those can only be performed once this PR is merged.

urish commented 6 years ago

Thanks! Two more comments and I think we are ready to go :)

urish commented 6 years ago

Lovely, thank you so much! Merge time :)

zoehneto commented 6 years ago

Thanks :) What do you want to do about the open tasks still left here (maybe put them in the original issue)?

urish commented 6 years ago

Sounds good! Will you be willing to tackle them as well?

zoehneto commented 6 years ago

Certainly Schema Store, Documentation and updating the webpack demo (once the new version is relesed). Webpack type applying with config is probably a task to be tackled as part of the cli and correcting the dependency version for typewiz-core would probably best be done by you during publish.

urish commented 6 years ago

Excellent

zoehneto commented 6 years ago

I have moved the remaining tasks to issue #31