Angular CLI v8 Includes Architect API

Angular recently introduced the Architect API as a new feature of Angular CLI version 8. The Architect API provides tools that help schedule and coordinate tasks. The API uses functions that the company calls  "builders", which are responsible for the implementation of the tasks.

The product announcement clarifies that "... builders are functions that implement the logic and behavior for a task that can replace a command." As for how the builders operate, the post included this description:

A builder receives two arguments; an input (or options), and a context which provides communication between the CLI and the builder. The separation of concerns here is the same as with Schematics; options are given by the CLI user, context is provided by the API, and you provide the behavior.

The communication can be synchronous or asynchronous.

The Architect API relies on the angular.json workspace file. The workspace is separated into projects and each project includes one or more targets.

Angular suggests testing builders through integration testing. Without integration into a test scenario, it's difficult to emulate the context needed. Angular has listed multiple examples of sample integration and testing situations in its blog post announcement. To learn more, check out builders on Github.

 

Comments (0)