File tree Expand file tree Collapse file tree 5 files changed +13
-14
lines changed
goldens/public-api/angular/build
angular/build/src/builders/ng-packagr
schematics/angular/library Expand file tree Collapse file tree 5 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ export type ExtractI18nBuilderOptions = {
166166// @public
167167export type NgPackagrBuilderOptions = {
168168 poll? : number ;
169- project: string ;
169+ project? : string ;
170170 tsConfig? : string ;
171171 watch? : boolean ;
172172};
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export async function* execute(
3030 // Purge old build disk cache.
3131 await purgeStaleBuildCache ( context ) ;
3232
33- const root = context . workspaceRoot ;
33+ const workspaceRoot = context . workspaceRoot ;
3434 let packager ;
3535 try {
3636 packager = ( await import ( 'ng-packagr' ) ) . ngPackagr ( ) ;
@@ -47,18 +47,22 @@ export async function* execute(
4747 throw error ;
4848 }
4949
50- packager . forProject ( resolve ( root , options . project ) ) ;
51-
52- if ( options . tsConfig ) {
53- packager . withTsConfig ( resolve ( root , options . tsConfig ) ) ;
54- }
55-
5650 const projectName = context . target ?. project ;
5751 if ( ! projectName ) {
5852 throw new Error ( 'The builder requires a target.' ) ;
5953 }
6054
6155 const metadata = await context . getProjectMetadata ( projectName ) ;
56+ const ngPackagrConfig = options . project
57+ ? join ( workspaceRoot , options . project )
58+ : join ( workspaceRoot , ( metadata . root as string | undefined ) ?? '' , 'ng-package.json' ) ;
59+
60+ packager . forProject ( ngPackagrConfig ) ;
61+
62+ if ( options . tsConfig ) {
63+ packager . withTsConfig ( resolve ( workspaceRoot , options . tsConfig ) ) ;
64+ }
65+
6266 const { enabled : cacheEnabled , path : cacheDirectory } = normalizeCacheOptions (
6367 metadata ,
6468 context . workspaceRoot ,
Original file line number Diff line number Diff line change 2222 "description" : " Enable and define the file watching poll time period in milliseconds."
2323 }
2424 },
25- "additionalProperties" : false ,
26- "required" : [" project" ]
25+ "additionalProperties" : false
2726}
Original file line number Diff line number Diff line change @@ -93,9 +93,6 @@ function addLibToWorkspaceFile(
9393 build : {
9494 builder : Builders . BuildNgPackagr ,
9595 defaultConfiguration : 'production' ,
96- options : {
97- project : `${ projectRoot } /ng-package.json` ,
98- } ,
9996 configurations : {
10097 production : {
10198 tsConfig : `${ projectRoot } /tsconfig.lib.prod.json` ,
Original file line number Diff line number Diff line change @@ -361,7 +361,6 @@ describe('Library Schematic', () => {
361361 const project = config . projects . foo ;
362362 expect ( project . root ) . toEqual ( 'foo' ) ;
363363 const { options, configurations } = project . architect . build ;
364- expect ( options . project ) . toEqual ( 'foo/ng-package.json' ) ;
365364 expect ( configurations . production . tsConfig ) . toEqual ( 'foo/tsconfig.lib.prod.json' ) ;
366365
367366 const libTsConfig = getJsonFileContent ( tree , '/foo/tsconfig.lib.json' ) ;
You can’t perform that action at this time.
0 commit comments