Skip to content

Commit 14e3a71

Browse files
committedJan 29, 2025·
fix(@schematics/angular): update library schematic to use @angular-devkit/build-angular:ng-packagr
The library schematic currently relies on Karma, which requires `@angular-devkit/build-angular` to be installed. To address this, we now use the `ng-packagr` builder provided in this package. Closes #29494 (cherry picked from commit cae068b)
1 parent 3cc197c commit 14e3a71

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎packages/schematics/angular/library/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function addDependenciesToPackageJson() {
5353
},
5454
{
5555
type: NodeDependencyType.Dev,
56-
name: '@angular/build',
57-
version: latestVersions.AngularBuild,
56+
name: '@angular-devkit/build-angular',
57+
version: latestVersions.DevkitBuildAngular,
5858
},
5959
{
6060
type: NodeDependencyType.Dev,
@@ -91,7 +91,7 @@ function addLibToWorkspaceFile(
9191
prefix: options.prefix,
9292
targets: {
9393
build: {
94-
builder: Builders.BuildNgPackagr,
94+
builder: Builders.NgPackagr,
9595
defaultConfiguration: 'production',
9696
options: {
9797
project: `${projectRoot}/ng-package.json`,

‎packages/schematics/angular/library/index_spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ describe('Library Schematic', () => {
388388
const tree = await schematicRunner.runSchematic('library', defaultOptions, workspaceTree);
389389

390390
const workspace = JSON.parse(tree.readContent('/angular.json'));
391-
expect(workspace.projects.foo.architect.build.builder).toBe('@angular/build:ng-packagr');
391+
expect(workspace.projects.foo.architect.build.builder).toBe(
392+
'@angular-devkit/build-angular:ng-packagr',
393+
);
392394
});
393395

394396
describe('standalone=false', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.