@@ -2,7 +2,7 @@ import { readFileSync } from 'fs';
22import { join } from 'path' ;
33import { Rule , SchematicsException , Tree , chain } from '@angular-devkit/schematics' ;
44import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript' ;
5- import { addRootImport , addRootProvider } from '@schematics/angular/utility' ;
5+ import { addRootProvider } from '@schematics/angular/utility' ;
66import { findNode } from '@schematics/angular/utility/ast-utils' ;
77import { InsertChange , ReplaceChange , applyToUpdateRecorder } from '@schematics/angular/utility/change' ;
88import { overwriteIfExists } from './common' ;
@@ -186,7 +186,7 @@ export function featureToRules(features: FEATURES[], projectName: string) {
186186 switch ( feature ) {
187187 case FEATURES . AppCheck :
188188 // TODO make this smarter in Angular Universal
189- return addRootImport ( projectName , ( { code, external} ) => {
189+ return addRootProvider ( projectName , ( { code, external} ) => {
190190 external ( 'initializeAppCheck' , '@angular/fire/app-check' ) ;
191191 external ( 'ReCaptchaEnterpriseProvider' , '@angular/fire/app-check' ) ;
192192 return code `${ external ( 'provideAppCheck' , '@angular/fire/app-check' ) } (() => {
@@ -197,7 +197,7 @@ export function featureToRules(features: FEATURES[], projectName: string) {
197197 } ) ;
198198 case FEATURES . Analytics :
199199 return chain ( [
200- addRootImport ( projectName , ( { code, external} ) => {
200+ addRootProvider ( projectName , ( { code, external} ) => {
201201 external ( 'getAnalytics' , '@angular/fire/analytics' ) ;
202202 return code `${ external ( 'provideAnalytics' , '@angular/fire/analytics' ) } (() => getAnalytics())` ;
203203 } ) ,
@@ -212,44 +212,44 @@ export function featureToRules(features: FEATURES[], projectName: string) {
212212 ] : [ ] ) ,
213213 ] )
214214 case FEATURES . Authentication :
215- return addRootImport ( projectName , ( { code, external} ) => {
215+ return addRootProvider ( projectName , ( { code, external} ) => {
216216 external ( 'getAuth' , '@angular/fire/auth' ) ;
217217 return code `${ external ( 'provideAuth' , '@angular/fire/auth' ) } (() => getAuth())` ;
218218 } ) ;
219219 case FEATURES . Database :
220- return addRootImport ( projectName , ( { code, external} ) => {
220+ return addRootProvider ( projectName , ( { code, external} ) => {
221221 external ( 'getDatabase' , '@angular/fire/database' ) ;
222222 return code `${ external ( 'provideDatabase' , '@angular/fire/database' ) } (() => getDatabase())` ;
223223 } ) ;
224224 case FEATURES . Firestore :
225- return addRootImport ( projectName , ( { code, external} ) => {
225+ return addRootProvider ( projectName , ( { code, external} ) => {
226226 external ( 'getFirestore' , '@angular/fire/firestore' ) ;
227227 return code `${ external ( 'provideFirestore' , '@angular/fire/firestore' ) } (() => getFirestore())` ;
228228 } ) ;
229229 case FEATURES . Functions :
230- return addRootImport ( projectName , ( { code, external} ) => {
230+ return addRootProvider ( projectName , ( { code, external} ) => {
231231 external ( 'getFunctions' , '@angular/fire/functions' ) ;
232232 return code `${ external ( 'provideFunctions' , '@angular/fire/functions' ) } (() => getFunctions())` ;
233233 } ) ;
234234 case FEATURES . Messaging :
235235 // TODO add the service worker
236- return addRootImport ( projectName , ( { code, external} ) => {
236+ return addRootProvider ( projectName , ( { code, external} ) => {
237237 external ( 'getMessaging' , '@angular/fire/messaging' ) ;
238238 return code `${ external ( 'provideMessaging' , '@angular/fire/messaging' ) } (() => getMessaging())` ;
239239 } ) ;
240240 case FEATURES . Performance :
241- return addRootImport ( projectName , ( { code, external} ) => {
241+ return addRootProvider ( projectName , ( { code, external} ) => {
242242 external ( 'getPerformance' , '@angular/fire/performance' ) ;
243243 return code `${ external ( 'providePerformance' , '@angular/fire/performance' ) } (() => getPerformance())` ;
244244 } ) ;
245245 case FEATURES . Storage :
246- return addRootImport ( projectName , ( { code, external} ) => {
246+ return addRootProvider ( projectName , ( { code, external} ) => {
247247 external ( 'getStorage' , '@angular/fire/storage' ) ;
248248 return code `${ external ( 'provideStorage' , '@angular/fire/storage' ) } (() => getStorage())` ;
249249 } ) ;
250250 case FEATURES . RemoteConfig :
251251 // TODO consider downloading the defaults
252- return addRootImport ( projectName , ( { code, external} ) => {
252+ return addRootProvider ( projectName , ( { code, external} ) => {
253253 external ( 'getRemoteConfig' , '@angular/fire/remote-config' ) ;
254254 return code `${ external ( 'provideRemoteConfig' , '@angular/fire/remote-config' ) } (() => getRemoteConfig())` ;
255255 } ) ;
0 commit comments