Skip to content

Build and test all projects in the correct sequence following dependencies. #13722

Closed
@klemenoslaj

Description

@klemenoslaj

🚀 Feature request

Command (mark with an x)

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

Description

Angular CLI nowadays supports multiple projects per single workspace. This was an important improvement, however, I am still missing a smarter build command that would build all the projects in a correct sequence. And the same is applicable to test command.

What does the correct sequence mean
Usually in a bigger monorepo workspaces developed packages can have dependencies on one another, which means that simple alphabetical order of build/test will not work.

Example

Libraries & dependencies
├── Library 1
│   ├── Library 3
├── Library 2
│   ├── Library 3
├── Library3

In the example above current sequence of ng test would be Library 1 - Library 2 - Library 3, but the correct sequence would be Library 3 - Library 1 - Library 2

Describe the solution you'd like

Every project in a workspace already contains package.json (obviously). We could use peerDependencies to declare the dependencies between projects of the workspace. Then build and test commands would be able to detect the dependencies and build the libraries in the correct sequence.

I have written myself a node executable that does exactly that. Follows the dependency tree and builds the libraries in the correct sequence.
If that is something you see as a valuable addition to Angular CLI I would be more than happy to contribute.

Describe alternatives you've considered

Currently, the only alternative is to write ng build commands in an npm script, which is practically unmaintainable in bigger workspaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions