File tree Expand file tree Collapse file tree 5 files changed +70
-9
lines changed
libs/nx-angular-mf/src/builders Expand file tree Collapse file tree 5 files changed +70
-9
lines changed Original file line number Diff line number Diff line change 7
7
"tags" : [],
8
8
"targets" : {
9
9
"build" : {
10
- "executor" : " @angular-devkit/build-angular:application" ,
10
+ "dependsOn" : [" ^build" ],
11
+ "executor" : " ./dist/libs/nx-angular-mf:build" ,
11
12
"outputs" : [" {options.outputPath}" ],
12
13
"options" : {
13
14
"outputPath" : " dist/apps/mf1-application" ,
49
50
"defaultConfiguration" : " production"
50
51
},
51
52
"serve" : {
52
- "executor" : " @angular-devkit/build-angular:dev-server" ,
53
+ "dependsOn" : [" ^build" ],
54
+ "executor" : " ./dist/libs/nx-angular-mf:serve" ,
53
55
"configurations" : {
54
56
"production" : {
55
57
"buildTarget" : " mf1-application:build:production"
Original file line number Diff line number Diff line change 7
7
"tags" : [],
8
8
"targets" : {
9
9
"build" : {
10
- "executor" : " @angular-devkit/build-angular:application" ,
10
+ "dependsOn" : [" ^build" ],
11
+ "executor" : " ./dist/libs/nx-angular-mf:build" ,
11
12
"outputs" : [" {options.outputPath}" ],
12
13
"options" : {
13
14
"outputPath" : " dist/apps/mf2-application" ,
49
50
"defaultConfiguration" : " production"
50
51
},
51
52
"serve" : {
52
- "executor" : " @angular-devkit/build-angular:dev-server" ,
53
+ "dependsOn" : [" ^build" ],
54
+ "executor" : " ./dist/libs/nx-angular-mf:serve" ,
53
55
"configurations" : {
54
56
"production" : {
55
57
"buildTarget" : " mf2-application:build:production"
Original file line number Diff line number Diff line change 1
1
import { BuilderContext , createBuilder } from '@angular-devkit/architect' ;
2
+ import { buildApplication } from '@angular-devkit/build-angular' ;
2
3
3
4
import { BuildExecutorSchema } from './schema' ;
4
5
6
+
5
7
export async function * runBuilder (
6
8
options : BuildExecutorSchema ,
7
9
context : BuilderContext
8
10
) {
9
11
context . logger . info ( 'Run build mf' ) ;
10
- yield {
11
- success : true ,
12
+
13
+ const { mf : defaultOptionsMfe , ...defaultOptions } = options ;
14
+
15
+ const extensions = {
16
+ codePlugins : [ ] ,
17
+ indexHtmlTransformer : ( input ) => {
18
+ return input ;
19
+ } ,
12
20
} ;
21
+
22
+ yield * buildApplication ( defaultOptions as any , context , extensions ) ;
13
23
}
14
24
15
25
export default createBuilder ( runBuilder ) ;
Original file line number Diff line number Diff line change 1
1
export type SchemaMf = {
2
- mf ?: { } ;
2
+ mf ?: Record < string , unknown > ;
3
3
} ;
Original file line number Diff line number Diff line change 1
1
import { BuilderContext , createBuilder } from '@angular-devkit/architect' ;
2
+ import { normalizeOptions } from '@angular-devkit/build-angular/src/builders/dev-server/options' ;
3
+ import {
4
+ serveWithVite ,
5
+ buildApplicationInternal ,
6
+ } from '@angular/build/private' ;
7
+
2
8
3
9
import { ServeExecutorSchema } from './schema' ;
4
10
11
+
12
+ function getBuilderAction ( ) {
13
+ return async function * ( options , context , extensions ) {
14
+
15
+ for await ( const result of buildApplicationInternal (
16
+ options ,
17
+ context ,
18
+ extensions
19
+ ) ) {
20
+ yield result ;
21
+ }
22
+ } ;
23
+ }
24
+
5
25
export async function * runBuilder (
6
26
options : ServeExecutorSchema ,
7
27
context : BuilderContext
8
28
) {
9
29
context . logger . info ( 'Run serve mf' ) ;
10
- yield {
11
- success : true ,
30
+
31
+
32
+ const normalizeOuterOptions = await normalizeOptions (
33
+ context ,
34
+ context . target . project ,
35
+ options as any
36
+ ) ;
37
+
38
+ const extensions = {
39
+ middleware : [ ] ,
40
+ buildPlugins : [ ] ,
12
41
} ;
42
+
43
+ const transforms = {
44
+ indexHtml : async ( input : string ) => {
45
+ return input
46
+ } ,
47
+ } ;
48
+
49
+ const runServer = serveWithVite (
50
+ normalizeOuterOptions ,
51
+ '@angular-devkit/build-angular:application' ,
52
+ getBuilderAction ( ) ,
53
+ context ,
54
+ transforms ,
55
+ extensions
56
+ ) ;
57
+ for await ( const output of runServer ) {
58
+ yield output ;
59
+ }
13
60
}
14
61
15
62
export default createBuilder ( runBuilder ) ;
You can’t perform that action at this time.
0 commit comments