CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-angular-devkit--build-ng-packagr

Angular Build Architect builder for ng-packagr library packaging (deprecated)

89

1.00x
Overview
Eval results
Files

task.mdevals/scenario-7/

Library Build Status Reporter

Build a custom Angular Architect builder that reports detailed build status and project metadata during library compilation.

Overview

You need to create an Angular Architect builder that wraps a library build process and provides enhanced status reporting throughout the build lifecycle. The builder should leverage the build context to access workspace metadata, report build progress, and schedule cleanup operations.

Requirements

Your builder must:

  1. Accept configuration options including a project path and an optional message prefix for status reports
  2. Access and log project metadata (project name and root directory) from the workspace
  3. Report the build lifecycle through multiple status updates:
    • Initial "starting" status with project information
    • Progress updates showing build phase (0/3, 1/3, 2/3, 3/3)
    • Final "completed" status
  4. Schedule a cleanup operation that runs after the build completes
  5. Return a successful build result with project metadata included

Implementation Details

The builder should:

  • Be registered and exported following Angular Architect builder patterns
  • Use the build context to retrieve project information
  • Report status messages at appropriate points in the build process
  • Use progress reporting to show incremental build phases
  • Register teardown logic for cleanup
  • Return build results that include both success status and project name

Test Cases

Basic Build Flow { .test }

  • Given a valid project name "test-lib" and message prefix "BUILD", the builder should complete successfully and return output containing the project name @test

Status Reporting { .test }

  • The builder should report at least 3 distinct status messages during execution, including "starting" and "completed" phases @test

Progress Updates { .test }

  • The builder should report progress values of 1, 2, and 3 out of 3 total steps during the build @test

Teardown Registration { .test }

  • The builder should register a cleanup function that executes after the build completes @test

Implementation Files

@generates

API

import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
import { JsonObject } from '@angular-devkit/core';

/**
 * Builder options schema
 */
export interface StatusReporterOptions extends JsonObject {
  project: string;
  messagePrefix?: string;
}

/**
 * Execute the status reporter builder
 */
export function executeStatusReporter(
  options: StatusReporterOptions,
  context: BuilderContext
): Promise<BuilderOutput>;

/**
 * Default export - the registered builder
 */
export default createBuilder(executeStatusReporter);

Dependencies { .dependencies }

@angular-devkit/architect { .dependency }

Provides the Angular Architect builder infrastructure, including BuilderContext for accessing workspace metadata, reporting progress, and managing build lifecycle.

Install with Tessl CLI

npx tessl i tessl/npm-angular-devkit--build-ng-packagr

tile.json