[RFC] Library Support and Boilerplate Comment Thread
As a follow up for https://github.com/angular/angular-cli/issues/1692#issuecomment-304970595.
Continue the conversion here.
There is also new JavaScript tooling that has emerged that could provide as a perfect alternative to Java based build orchestration systems (like buck, bazel, etc). https://github.com/boltpkg/bolt Something to consider :-D
On Mon, Jan 22, 2018 at 11:11 AM Mateo Tibaquirá [email protected] wrote:
@mattem https://github.com/mattem I'm interested, if you do so, add me please :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/6510#issuecomment-359531953, or mute the thread https://github.com/notifications/unsubscribe-auth/ADQBMIlpYx5RbvPrQoL0l52iDED98rLAks5tNN16gaJpZM4Nqsq5 .
@mattem i would love to know your setup and workflow with nx too, need it very much
And @TheLarkInn see you at ng europe!
@matheo @avatsaev I'll try and write something up about the workflow that we have and the tooling around it
@mattem Interested too ! We will migrate to this workflow soon.
I would love seen projects like @angular/cli/Nrwl working together with project like bolt to solve the issue of managing librairies in a common way :)
@matheo @avatsaev @jogelin we've been running the nx workspace in our app for about 4 months now. We have 11 libs and the development experience is fine (i.e. no compromises).
We are yet to graduate any of those libs to their own repro or publish to our internal npm registry, but so far so good.
@mattem I would be interested in your write up too.
@kevinkuszyk getting the libs through the CI and publishing them to private npm reg is actually the trickiest part, the part that i'm interested in.
@metodribic
But since Angular 5 I can no longer npm link projects in an Angular 5 app if they are not following APF.
You have to add preservesymlinks in .angular-cli.json config
...
"defaults": {
"styleExt": "scss",
"component": {},
"build": {
"preserveSymlinks": true
}
}
...
@avatsaev that's odd, I just checked the nx docs and I don't see any mention of graduating libs out into their own repro or publishing them separately. These were two of the criteria we used when choosing nx.
@vsavkin did I remember correctly, or has there been a change?
We went through some discussions on what to use for our front end framework and after going through the Hero tutorial, I really liked the way Angular is setup and how easy it is to build modules.
I want to separate our services and models from the components so that the services can be re-used by other projects. But, now I find out that Angular wasn't built to to have external libraries, unless you want to choose from one of the 20 hacks that people have written. That's a HARD sell to the company.
Funny that in all the pros and cons of these front end frameworks, that Angular doesn't have a HUGE asterisk next to it for this. There definitely should be. This should be priority # 1 for Angular, but after seeing this issue has been worked on for a year and half, it isn't and that's a deal breaker.
@Holzberg there are solutions that I wouldn't consider hacks and allow you to create libraries:
- ng-packagr
- angular-library-starter
- Angular Librarian (note: this is my own project)
- generator-angular2-library (this is a Yeoman generator)
And, yes, there are other ways of coaxing angular-cli to do it for you.
And If you want to have Angular Mono repo for libraries you can have a look at this: https://github.com/alan-agius4/ng-mono-repo-starter
On Tue, 23 Jan 2018 at 21:29, Matt Fehskens [email protected] wrote:
@Holzberg https://github.com/holzberg there are solutions that I wouldn't consider hacks and allow you to create libraries:
- ng-packagr https://github.com/dherges/ng-packagr
- angular-library-starter https://github.com/shlomiassaf/angular-library-starter
- Angular Librarian https://github.com/gonzofish/angular-librarian (note: this is my own project)
- generator-angular2-library https://github.com/jvandemo/generator-angular2-library (this is a Yeoman generator)
And, yes, there are other ways of coaxing angular-cli to do it for you.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/6510#issuecomment-359919986, or mute the thread https://github.com/notifications/unsubscribe-auth/AQv-Wmx8nPPZSbNeJZZ7H4_v96A9ZbjAks5tNkEigaJpZM4Nqsq5 .
@gonzofish Those libraries are all 3rd party. There is no standard way.
I tried ng-packagr and I have the library compiling and working when installed into a client app, but how about easier development? Can I link the the files to a demo Angular app so I can test things? It sucks that I have to compile every time. I took the main app component out because that's not needed and I don't want to have to keep that just to do testing.
The only other way I can think of is to create tests in the spec files, but that doesn't allow me to see the rendered result for my directives.
I tried ng-packagr and I have the library compiling and working when installed into a client app, but how about easier development?
same issue here. Cant easely develop via yarn link on sources cause linked files are not compiled by main app's webpack
About working with ng-packagr locally, just add the reference to your /dist files in the main package.json and you will be able to yarn link your library, like:
"main": "dist/bundles/coachcare-datepicker.umd.js",
"module": "dist/esm5/coachcare-datepicker.js",
"es2015": "dist/esm2015/coachcare-datepicker.js",
"typings": "dist/coachcare-datepicker.d.ts",
"metadata": "dist/coachcare-datepicker.metadata.json",
you can find your corresponding files in your dist/package.json
@matheo what about linking uncompiled files? I believe that is what @artaommahe was referencing.
I've got the same issue.. I can symlink my dist in fine, but every change requires a full rollup build to be generated which stinks for development speed
There's a talk on packaging libraries tonight at the Angular meetup in Mountain View. I hope we'll show the new ng_package bazel rule that we're moving Angular itself to use for packaging the framework, and which will work for third-party libraries as well.
@alexeagle will this talk b available later somewhere online please?
I believe talks at that meetup are recorded, yes
@dherges In ng-packagr, how do I include external libraries? For instance, I want to use crypto-js and I installed it via npm, but the project using my library errors out. I also tried install @type/crypto-js and that didn't work either.
What am I missing?
Just throwing my https://github.com/dominique-mueller/angular-package-builder in here which also does the job. Still, I'd also prefer an "official" solution for this ...