File tree 5 files changed +13
-14
lines changed
goldens/public-api/angular/build
angular/build/src/builders/ng-packagr
schematics/angular/library
5 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ export type ExtractI18nBuilderOptions = {
166
166
// @public
167
167
export type NgPackagrBuilderOptions = {
168
168
poll? : number ;
169
- project: string ;
169
+ project? : string ;
170
170
tsConfig? : string ;
171
171
watch? : boolean ;
172
172
};
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export async function* execute(
30
30
// Purge old build disk cache.
31
31
await purgeStaleBuildCache ( context ) ;
32
32
33
- const root = context . workspaceRoot ;
33
+ const workspaceRoot = context . workspaceRoot ;
34
34
let packager ;
35
35
try {
36
36
packager = ( await import ( 'ng-packagr' ) ) . ngPackagr ( ) ;
@@ -47,18 +47,22 @@ export async function* execute(
47
47
throw error ;
48
48
}
49
49
50
- packager . forProject ( resolve ( root , options . project ) ) ;
51
-
52
- if ( options . tsConfig ) {
53
- packager . withTsConfig ( resolve ( root , options . tsConfig ) ) ;
54
- }
55
-
56
50
const projectName = context . target ?. project ;
57
51
if ( ! projectName ) {
58
52
throw new Error ( 'The builder requires a target.' ) ;
59
53
}
60
54
61
55
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
+
62
66
const { enabled : cacheEnabled , path : cacheDirectory } = normalizeCacheOptions (
63
67
metadata ,
64
68
context . workspaceRoot ,
Original file line number Diff line number Diff line change 22
22
"description" : " Enable and define the file watching poll time period in milliseconds."
23
23
}
24
24
},
25
- "additionalProperties" : false ,
26
- "required" : [" project" ]
25
+ "additionalProperties" : false
27
26
}
Original file line number Diff line number Diff line change @@ -93,9 +93,6 @@ function addLibToWorkspaceFile(
93
93
build : {
94
94
builder : Builders . BuildNgPackagr ,
95
95
defaultConfiguration : 'production' ,
96
- options : {
97
- project : `${ projectRoot } /ng-package.json` ,
98
- } ,
99
96
configurations : {
100
97
production : {
101
98
tsConfig : `${ projectRoot } /tsconfig.lib.prod.json` ,
Original file line number Diff line number Diff line change @@ -361,7 +361,6 @@ describe('Library Schematic', () => {
361
361
const project = config . projects . foo ;
362
362
expect ( project . root ) . toEqual ( 'foo' ) ;
363
363
const { options, configurations } = project . architect . build ;
364
- expect ( options . project ) . toEqual ( 'foo/ng-package.json' ) ;
365
364
expect ( configurations . production . tsConfig ) . toEqual ( 'foo/tsconfig.lib.prod.json' ) ;
366
365
367
366
const libTsConfig = getJsonFileContent ( tree , '/foo/tsconfig.lib.json' ) ;
You can’t perform that action at this time.
0 commit comments