TypeStrong / grunt-ts

A grunt task to manage your complete typescript development to production workflow
https://www.npmjs.com/package/grunt-ts
MIT License
330 stars 121 forks source link

Cannot set custom path for .tscache directory #414

Closed beebs93 closed 6 years ago

beebs93 commented 6 years ago

It would be very helpful to specify the base path for the .tscache directory in the task options (similar to ESLint Grunt task). Our build system expects such artifacts to be under a specific sub-directory under the project's root path so we have to add some work-arounds to accommodate this limitation.

nycdotnet commented 6 years ago

Sounds good. PRs certainly accepted, for example adding a tscachelocation to the options.

beebs93 commented 6 years ago

@nycdotnet Sure, or maybe something like tscacheDir to follow the naming convention of other directory related options.

It seems the cache directory is hardcoded in tasks/modules/cacheUtils.ts. Would you prefer changing all clients of cacheUtils to pass the tasks options object forward or change cacheUtils to export a class with its constructor taking a cacheDir:string param?

nycdotnet commented 6 years ago

tscacheDir works for me. Either of those strategies works for me, or honestly it looks like it's only used in three places, all of which are pure functions. Might just be worth adding an argument to each and moving the default value up to where options are meant to be defaulted.

Here's the docs for adding new features: https://github.com/TypeStrong/grunt-ts/blob/master/CONTRIBUTING.md

If you submit a PR, I will absolutely review it. Thank you for considering this contribution.

beebs93 commented 6 years ago

415 submitted.

nycdotnet commented 6 years ago

Should be available in v6.0.0-beta.17. Thanks for your contribution. You even documented it!