j-d-carmichael / boats

Beautiful Open Api Template System
MIT License
57 stars 8 forks source link

Multiple TypeScript `-f` helpers cause errors #69

Closed gabormagyar closed 2 years ago

gabormagyar commented 2 years ago

Describe the bug If more than one typescript nunjucks helpers are added via the -f CLI option the ts-node module is registered twice and causes the second file to be compiled twice. This obviously doesn't work.

The offending piece of code is https://github.com/j-d-carmichael/boats/blob/main/src/Template.ts#L295

require('ts-node').register(); is called for each *.ts file, when it should not be called more than once.

To Reproduce boats ... -f a.ts -f b.ts b.ts will get double compiled and produces confusing errors

Expected behavior No error

Additional context This issue would be fixed if the following issue is fixed in ts-node: https://github.com/TypeStrong/ts-node/issues/1690 https://github.com/TypeStrong/ts-node/issues/409

j-d-carmichael commented 2 years ago

Thanks for reporting - we'll get it looked at asap

j-d-carmichael commented 2 years ago

https://github.com/j-d-carmichael/boats/releases/tag/2.31.0 should resolve this issue @gabormagyar

gabormagyar commented 2 years ago

Works perfectly, thanks again for the quick fixes!