gonzofish / angular-librarian

An Angular 2+ scaffolding setup for creating libraries
https://www.npmjs.com/package/angular-librarian
MIT License
91 stars 9 forks source link

Rollup Configuration #72

Closed litzebauer closed 7 years ago

litzebauer commented 7 years ago

Is it possible to handle Rollup external and globals better in the config? Explicitly having to call out each external dependency is cumbersome. Could the script dynamically read from package.json dependencies? Or is there a different way to handle it in Rollup?

gonzofish commented 7 years ago

As far as I know, there's really not an easier way, that I know of, to do this. If you look around at other projects, you'll see all of the libraries doing something similar; for example, here's the Material team explicitly listing their globals and then using them to generate their externals.

I'd like to do something similar to this in the rollup script, but I'm not sure if the approach will screw anything up.

It is cumbersome, I agree. But I'm not sure that there's a less cumbersome answer at the moment...

litzebauer commented 7 years ago

Hmm, I can see this becoming a problem for people not as well versed in rollup working on libraries and forgetting to modify that config.

On Mon, Sep 11, 2017, 9:48 AM Matt Fehskens notifications@github.com wrote:

As far as I know, there's really not an easier way, that I know of, to do this. If you look around at other projects, you'll see all of the libraries doing something similar; for example, here's the Material team explicitly listing their globals https://github.com/angular/material2/blob/4168fb39db770c977bb2bf36336de6b05d38ef9f/tools/package-tools/rollup-globals.ts#L16 and then using them to generate their externals https://github.com/angular/material2/blob/4168fb39db770c977bb2bf36336de6b05d38ef9f/tools/package-tools/rollup-helpers.ts#L41 .

I'd like to do something similar to this in the rollup script https://github.com/gonzofish/angular-librarian/blob/master/commands/initial/templates/tasks/rollup.js#L115, but I'm not sure if the approach will screw anything up.

It is cumbersome, I agree. But I'm not sure that there's a less cumbersome answer at the moment...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gonzofish/angular-librarian/issues/72#issuecomment-328534489, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLc631GTKqaRWYPGQgcYBLgvM3rBKgKks5shTougaJpZM4PTGiP .

gonzofish commented 7 years ago

I get what you're saying and I can add some support docs for helping mitigate common issues. But it really is a necessary part of the build process.

litzebauer commented 7 years ago

Maybe a postinstall hook that outputs a warning to update the rollup config if you are adding a 3rd party dependency.

On Mon, Sep 11, 2017, 10:08 AM Matt Fehskens notifications@github.com wrote:

I get what you're saying and I can add some support docs for helping mitigate common issues. But it really is a necessary part of the build process.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gonzofish/angular-librarian/issues/72#issuecomment-328540412, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLc68rLu1kitf94XFzGzHQDfuutaSrsks5shT7agaJpZM4PTGiP .

gonzofish commented 7 years ago

Not a bad idea...PR 😄?

litzebauer commented 7 years ago

sure

On Mon, Sep 11, 2017 at 10:41 AM Matt Fehskens notifications@github.com wrote:

Not a bad idea...PR 😄?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gonzofish/angular-librarian/issues/72#issuecomment-328550981, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLc62kakLZ0djILbyX0EVa9Pxwrs6YIks5shUacgaJpZM4PTGiP .

gonzofish commented 7 years ago

I updated the list with the huge list of defaults from ng-packagr via 95eb2bf