11import { SchematicContext , SchematicsException , Tree } from '@angular-devkit/schematics' ;
22import { NodePackageInstallTask , RunSchematicTask } from '@angular-devkit/schematics/tasks' ;
3- import { JsonParseMode , parseJson } from '@angular-devkit/core' ;
43import { listProjects , projectPrompt , projectTypePrompt } from './utils' ;
54import { Workspace } from './interfaces' ;
65import { DeployOptions , NgAddNormalizedOptions } from './ng-add-common' ;
@@ -19,12 +18,13 @@ function getWorkspace(
1918 }
2019 const content = configBuffer . toString ( ) ;
2120
21+ const { parse } = ( require ( 'jsonc-parser' ) as typeof import ( 'jsonc-parser' ) ) ;
22+
2223 let workspace : Workspace ;
2324 try {
24- workspace = ( parseJson (
25+ workspace = parse (
2526 content ,
26- JsonParseMode . Loose
27- ) as { } ) as Workspace ;
27+ ) as Workspace ;
2828 } catch ( e ) {
2929 throw new SchematicsException ( `Could not parse angular.json: ` + e . message ) ;
3030 }
@@ -103,14 +103,14 @@ export const ngAdd = (options: DeployOptions) => (
103103 context : SchematicContext
104104) => {
105105
106+ addFirebaseHostingDependencies ( host , context ) ;
107+
106108 const { project} = getProject ( options , host ) ;
107109
108110 return projectTypePrompt ( project ) . then (
109111 ( { universalProject } : { universalProject : boolean } ) => {
110112 if ( universalProject ) {
111113 addFirebaseFunctionsDependencies ( host , context ) ;
112- } else {
113- addFirebaseHostingDependencies ( host , context ) ;
114114 }
115115 const projectOptions : DeployOptions & { isUniversalProject : boolean } = {
116116 ...options ,
0 commit comments