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-3/

Library Build Status Reporter

Build a simple library build status reporter that uses the Angular Architect builder system to execute an ng-packagr build and report its status.

Requirements

Your solution should implement a function that:

  1. Accepts a project path and TypeScript config path as parameters
  2. Executes a library build using the Angular Architect builder system
  3. Returns a promise that resolves to an object containing:
    • success: boolean indicating if the build succeeded
    • duration: number representing the build duration in milliseconds
    • error: optional string with error message if the build failed

The function should:

  • Use the appropriate builder options structure for ng-packagr builds
  • Track the build start and end time to calculate duration
  • Handle build errors gracefully without throwing exceptions
  • Return structured results that can be easily consumed

Test Cases

  • When provided valid project and TypeScript config paths, the build should succeed and return success: true with a duration @test
  • When provided an invalid project path, the build should fail gracefully and return success: false with an error message @test
  • The returned duration should be a positive number representing milliseconds @test

Implementation

@generates

API

export interface BuildStatusResult {
  success: boolean;
  duration: number;
  error?: string;
}

export function buildLibraryAndReport(
  projectPath: string,
  tsConfigPath: string,
  context: BuilderContext
): Promise<BuildStatusResult>;

Dependencies { .dependencies }

@angular-devkit/build-ng-packagr { .dependency }

Provides the Angular Architect builder for ng-packagr library packaging.

@angular-devkit/architect { .dependency }

Provides the BuilderContext interface for builder execution.

rxjs { .dependency }

Provides Observable utilities for handling asynchronous build operations.

Install with Tessl CLI

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

tile.json