File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
packages/build-info/src/frameworks Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,25 @@ beforeEach((ctx) => {
11
11
test ( 'should detect Angular' , async ( { fs } ) => {
12
12
const cwd = mockFileSystem ( {
13
13
'package.json' : JSON . stringify ( { dependencies : { '@angular/cli' : '17.0.0' } } ) ,
14
- 'angular.json' : '' ,
14
+ 'angular.json' : JSON . stringify ( {
15
+ projects : {
16
+ demo : {
17
+ architect : {
18
+ build : {
19
+ options : {
20
+ outputPath : 'dist/demo' ,
21
+ } ,
22
+ } ,
23
+ } ,
24
+ } ,
25
+ } ,
26
+ } ) ,
15
27
} )
16
28
const detected = await new Project ( fs , cwd ) . detectFrameworks ( )
17
29
expect ( detected ?. [ 0 ] . id ) . toBe ( 'angular' )
18
30
expect ( detected ?. [ 0 ] . name ) . toBe ( 'Angular' )
19
31
expect ( detected ?. [ 0 ] . build . command ) . toBe ( 'ng build --prod' )
20
- expect ( detected ?. [ 0 ] . build . directory ) . toBe ( '' )
32
+ expect ( detected ?. [ 0 ] . build . directory ) . toBe ( 'dist/demo/browser ' )
21
33
expect ( detected ?. [ 0 ] . dev ?. command ) . toBe ( 'ng serve' )
22
34
expect ( detected ?. [ 0 ] . plugins ) . toEqual ( [ '@netlify/angular-runtime' ] )
23
35
} )
Original file line number Diff line number Diff line change @@ -32,7 +32,15 @@ export class Angular extends BaseFramework implements Framework {
32
32
if ( this . detected ) {
33
33
if ( this . version && gte ( this . version , '17.0.0-rc' ) ) {
34
34
this . plugins . push ( '@netlify/angular-runtime' )
35
- this . build . directory = '' // will be overwritten by the plugin
35
+ const angularJson = await this . project . fs . gracefullyReadFile ( 'angular.json' )
36
+ if ( angularJson ) {
37
+ const { projects, defaultProject } = JSON . parse ( angularJson )
38
+ const project = projects [ defaultProject ?? Object . keys ( projects ) [ 0 ] ]
39
+ const outputPath = project ?. architect ?. build ?. options ?. outputPath
40
+ if ( outputPath ) {
41
+ this . build . directory = `${ outputPath } /browser`
42
+ }
43
+ }
36
44
}
37
45
return this as DetectedFramework
38
46
}
You can’t perform that action at this time.
0 commit comments