Angular Build Architect builder for ng-packagr library packaging (deprecated)
89
Create a custom Angular Architect builder that implements watch mode for building an Angular library with automatic file change detection and incremental rebuilds.
You need to build a system that monitors a library project and automatically rebuilds it whenever source files change. The builder should integrate with the Angular CLI's Architect build system and support continuous development workflows.
Create a builder that accepts the following configuration options:
project path pointing to the library's configuration filetsConfig path for TypeScript configuration overrideswatch boolean flag to enable/disable watch modepoll number (in milliseconds) for file watching in environments where native file watchers don't work reliablyWhen watch mode is enabled, the builder should:
Each build cycle (initial and subsequent) should:
@generates
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
import { Observable } from 'rxjs';
/**
* Configuration options for the watch mode builder
*/
export interface WatchBuilderOptions {
/** Path to the library configuration file (required) */
project: string;
/** Path to TypeScript configuration (optional) */
tsConfig?: string;
/** Enable watch mode for automatic rebuilds (required) */
watch: boolean;
/** File watching poll interval in milliseconds (optional) */
poll?: number;
}
/**
* Executes the watch mode builder
*
* @param options - Builder configuration options
* @param context - Angular Architect builder context
* @returns Observable stream of build results
*/
export function execute(
options: WatchBuilderOptions,
context: BuilderContext
): Observable<BuilderOutput>;watch is true and files are modified, the builder automatically triggers a rebuild and returns multiple build results. @testwatch is false, the builder performs a single build and completes without monitoring for file changes. @testProvides Angular Build Architect builder for ng-packagr library packaging with watch mode support.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-angular-devkit--build-ng-packagrdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10