Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request > generate non-publishable libraries #9

Closed
pascalbe-dev opened this issue Jun 29, 2020 · 4 comments · Fixed by #14
Closed

Feature Request > generate non-publishable libraries #9

pascalbe-dev opened this issue Jun 29, 2020 · 4 comments · Fixed by #14

Comments

@pascalbe-dev
Copy link

When I use the nx-ddd-plugin to scaffold a domain library + a feature library, the libraries are always added as publishable libraries (with extra package.json + build target in angular.json, etc.) without the option to make it non publishable (if I didn't miss something).

This has the following drawbacks:

  1. a lot of boilerplate --> often you do not need a library to be publishable and this adds a lot of boilerplate code within the library folder and the angular.json
  2. This nx Issue makes the build target fail for the publishable feature library. Currently we are manually removing the build target from the angular.json to make nx affected:build work. This ofc is an annoying workaround.

Reproduction steps

  • create an angular nx workspace
  • add the nx-dd-plugin
  • generate a domain library
  • generate a feature library depending on the previously generated domain library
  • build everything

--> Errors appear (like within the previously noted nx github issue)

Further notes:

The option to have a publishable lib should at least be avoidable by providing a flag.
By looking at the source code, I recognized, that you call the nrwl angular lib schematic without any kind of publishable flag. Since publishable is defaulted to false within the nrwl angular lib schematic, I'm quite confused about the nx-ddd-plugin creating publishable libs.

@manfredsteyer
Copy link
Contributor

Hi Pascal,

yes, you are right. It currently always creates publishable libs. In the future, when the issue is solved you are pointing to, there will be a difference b/w publishable and buildable libs. Then, we can move to buildable libs by default. Also, we can provide a way to opt-out of it.

I'd love to work with you on this. Feel free to send a PR.

@pascalbe-dev
Copy link
Author

Sounds good. I'd be glad to support here.
My suggestion would be to add one more option for now to skip building a lib, which would default to false. This allows to opt out of building and resolve the current issue on nx side for now.
When nx makes the distinction b/w buildable and publishable, we could add another option to make libs publishable. This could default to false aswell.

In the end, incremental builds would work by default, but we also have the option to

  • avoid the extra build target or
  • make libs publishable --> we could also make a distinction b/w different lib types (--> should a feature lib be publishable? or should only an api lib be publishable?)

I'll have a look into it and will prepare a PR.

@manfredsteyer
Copy link
Contributor

Sounds great.

What do you think about --type internal|publishable|buildable defaulting to publishable?

@pascalbe-dev
Copy link
Author

Sure, that would work aswell. I'm just wondering if publishable would really be the most common use case and should be default. I would expect buildable to be most commonly used when its ready from nx side.
Both defaults would be fine for though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants