Packaging Angular libraries
If copying 19.672 files from a GoPro doesn’t take 3 hours…
…then I’d likely not be writing these lines. On 14th of August 2016, a guy called Ritesh Kumar opened a GitHub issue named “[Feature] Create boilerplate for library” on the Angular CLI project. Discussions went all the way through November, December, into 2017. In March 2017, the feature was announced “to be there for 2.0”. In the beginning of April, myself got involved in the discussion, other people were “waiting for a ‘official/angular-cli’ way to do a library”, just for both of us to discover the Angular Package Format a few day laters during ng-conf 2017. With the discussion being picked up again, a foolish guy said that he had “scrambled together” some things not willing to publish on its own but very much willing to contribute. As I perfectly accepted the Angular team’s stance on being “not yet open to contributions” and started copying over about 19.672 JPEG files from a GoPro Hero 4 Black — well, it successfully copied 12.045 of them in just about 3 hours — today’s friday evening had an end product in
ng-packagr being published on the npm registry and yarn, too!
While this is one of the longest paragraphs I‘ve ever written,
ng-packagr reads a single entry file pointing to the public API of a TypeScript library, compiles it, and outputs the library in Angular Package Format, doing all sorts of transformations and build steps along the way. That’s it. The tool is not tested, at-most half-documented with a volatile design doc attached, and it’s published as ‘alpha.0’.
If the tool suits your needs, use it! I’d be happy. Just as I believe that a community effort will lead to way better results than one individual can ever achieve. If you find any issues or want to add missing features, don't hesitate to open issues or start pull requests. It’s very welcome and things can change quickly within — let’s say… — about 12.000 and a few seconds!