@@ -72,16 +72,7 @@ const featureMap = new Map(featuresList.map((feature) => [feature.name, feature]
72
72
export async function init ( setup : Setup , config : any , options : any ) : Promise < any > {
73
73
const nextFeature = setup . features ?. shift ( ) ;
74
74
if ( nextFeature ) {
75
- const f = featureMap . get ( nextFeature ) ;
76
- if ( ! f ) {
77
- const availableFeatures = Object . keys ( features )
78
- . filter ( ( f ) => f !== "project" )
79
- . join ( ", " ) ;
80
- throw new FirebaseError (
81
- `${ clc . bold ( nextFeature ) } is not a valid feature. Must be one of ${ availableFeatures } ` ,
82
- ) ;
83
- }
84
-
75
+ const f = lookupFeature ( nextFeature ) ;
85
76
logger . info ( clc . bold ( `\n${ clc . white ( "===" ) } ${ capitalize ( nextFeature ) } Setup` ) ) ;
86
77
87
78
if ( f . doSetup ) {
@@ -100,3 +91,35 @@ export async function init(setup: Setup, config: any, options: any): Promise<any
100
91
return init ( setup , config , options ) ;
101
92
}
102
93
}
94
+
95
+ export async function actuate ( setup : Setup , config : any , options : any ) : Promise < any > {
96
+ const nextFeature = setup . features ?. shift ( ) ;
97
+ if ( nextFeature ) {
98
+ const f = lookupFeature ( nextFeature ) ;
99
+ logger . info ( clc . bold ( `\n${ clc . white ( "===" ) } ${ capitalize ( nextFeature ) } Setup Actuation` ) ) ;
100
+
101
+ if ( f . doSetup ) {
102
+ throw new FirebaseError (
103
+ `The feature ${ nextFeature } does not support actuate yet. Please run ${ clc . bold ( "firebase init " + nextFeature ) } instead.` ,
104
+ ) ;
105
+ } else {
106
+ if ( f . actuate ) {
107
+ await f . actuate ( setup , config , options ) ;
108
+ }
109
+ }
110
+ return actuate ( setup , config , options ) ;
111
+ }
112
+ }
113
+
114
+ function lookupFeature ( feature : string , ) : Feature {
115
+ const f = featureMap . get ( feature ) ;
116
+ if ( ! f ) {
117
+ const availableFeatures = Object . keys ( features )
118
+ . filter ( ( f ) => f !== "project" )
119
+ . join ( ", " ) ;
120
+ throw new FirebaseError (
121
+ `${ clc . bold ( feature ) } is not a valid feature. Must be one of ${ availableFeatures } ` ,
122
+ ) ;
123
+ }
124
+ return f ;
125
+ }
0 commit comments