TypeStrong / dts-bundle

Export TypeScript .d.ts files as an external module definition
MIT License
308 stars 57 forks source link

removeSource option deletes .d.ts files within node modules #53

Open cleavera opened 7 years ago

cleavera commented 7 years ago

When using the removeSource option. If your bundle references a .d.ts file inside node_modules it deletes this file.

I would expect it to ignore anything outside the project when cleaning up the definitions files

tolemac commented 7 years ago

It should be fixed at https://github.com/TypeStrong/dts-bundle/blob/master/lib/index.ts#L379

Could you build a regexpr to decide if you have to revome the file?

You could add other regexpr to the conditional, for example:

if (p !== outFile && dtsExp.test(p) && fs.statSync(p).isFile() && canRemoveExp.test())
cleavera commented 7 years ago

Just to confirm are you talking about a user configurable regular expression or a built in regex?

tolemac commented 7 years ago

I thought in a built in regexp at the moment... A regexp that exclude node_modules folder.