olov / ng-annotate

Add, remove and rebuild AngularJS dependency injection annotations
MIT License
2.03k stars 150 forks source link

Add support for multiple input files as a pattern matching path #147

Closed Kiougar closed 9 years ago

Kiougar commented 9 years ago

I think it would be great to add support for multiple files by specifying a source folder with pattern matching and a destination folder for the output files.

eg: ng-annotate --source /static/js/*.js --dest /dist/static/js/

We could use the glob node package to match the files.

I can help developing it or I can provide a pull request if you like but I would need help/guidance.

omsmith commented 9 years ago

I could see supporting multiple files, but wouldn't be a huge fan of globbing logic within ng-annotate. That's what shells are for.

Could always do something with find, such as,

find static/js -iname '*.js' -exec sh -c 'ng-annotate {} > /dist/statis/js/{}' \;

Kiougar commented 9 years ago

Thanks for the shell solution (was wondering how I could do it with the current ng-annotate release) but I wanted an OS independent one. I suggested glob as an example solution which is OS independent. (The basic idea of supporting multiple files via a pattern matching came from the jshint static/js/*.js command).

Let alone the glob, how would you propose supporting multiple files be done?

olov commented 9 years ago

For now ng-annotate stays ~small by not including such features. It's a slippery slope because as soon as your proposed feature would be implemented, another request for implementing file system watching would come. Then caching, then bundling, then.. If a shell one-liner doesn't' cut it then there are plenty of cross platform build tools you can choose from (see README). For that reason => closing.

Kiougar commented 9 years ago

Ok, understood. Thanks for replying. :)