angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Library secondary entry-point generation

Open klemenoslaj opened this issue 5 years ago • 3 comments

🚀 Feature request

Command (mark with an x)

  • [ ] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [x] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Description

Creating a secondary entry points for libraries is a manual effort with a risk of misconfiguration of unit testing environment. In order to get a proper coverage report for all the libraries, the following needs to be adjusted:

  • in test.ts the context path should be changed: const context = require.context('../', true, /\.spec\.ts$/);
  • in angular.json the sourceRoot path should be changed: "sourceRoot": "projects/lib-name", (no /src)

Describe the solution you'd like

Create a schematic that generates the secondary entry point for the given library.


I would be happy to provide a PR if this get's greenlit.

klemenoslaj avatar Oct 14 '20 07:10 klemenoslaj

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] avatar Feb 02 '22 11:02 angular-robot[bot]

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

angular-robot[bot] avatar Feb 21 '22 13:02 angular-robot[bot]

I've lost so much time because of this. It always requires manual effort to set things up with secondary entry points or am I missing something? there is ambiguity around folder structure of the library, unit tests stop working, you can't get the desired import path you want when you are consuming the library... I think nx has some generators to help develop libraries with second entry points, something like that can be added to CLI as well.

ertunga avatar Jul 16 '22 09:07 ertunga