angular / angular/angular-cli

Library secondary entry-point generation

Open
#19,070 3 comments 9 reactions 0 assignees View on GitHub
area: @schematics/angular feature feature: insufficient votes
Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
14h 23m
Merged PRs (30d)
162

Description

# 🚀 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.

Contributor guide

Open the contributing guide

Research direction

Start with the generate command and inspect the existing library schematic structure. Review test.ts and angular.json, especially the context path and sourceRoot settings described in the issue. Done means a schematic can generate a library secondary entry point with the needed testing and coverage configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
build-system, cli, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.