1
1
import { SchematicContext , SchematicsException , Tree } from '@angular-devkit/schematics' ;
2
2
import { NodePackageInstallTask , RunSchematicTask } from '@angular-devkit/schematics/tasks' ;
3
- import { JsonParseMode , parseJson } from '@angular-devkit/core' ;
4
3
import { listProjects , projectPrompt , projectTypePrompt } from './utils' ;
5
4
import { Workspace } from './interfaces' ;
6
5
import { DeployOptions , NgAddNormalizedOptions } from './ng-add-common' ;
@@ -19,12 +18,13 @@ function getWorkspace(
19
18
}
20
19
const content = configBuffer . toString ( ) ;
21
20
21
+ const { parse } = ( require ( 'jsonc-parser' ) as typeof import ( 'jsonc-parser' ) ) ;
22
+
22
23
let workspace : Workspace ;
23
24
try {
24
- workspace = ( parseJson (
25
+ workspace = parse (
25
26
content ,
26
- JsonParseMode . Loose
27
- ) as { } ) as Workspace ;
27
+ ) as Workspace ;
28
28
} catch ( e ) {
29
29
throw new SchematicsException ( `Could not parse angular.json: ` + e . message ) ;
30
30
}
@@ -103,14 +103,14 @@ export const ngAdd = (options: DeployOptions) => (
103
103
context : SchematicContext
104
104
) => {
105
105
106
+ addFirebaseHostingDependencies ( host , context ) ;
107
+
106
108
const { project} = getProject ( options , host ) ;
107
109
108
110
return projectTypePrompt ( project ) . then (
109
111
( { universalProject } : { universalProject : boolean } ) => {
110
112
if ( universalProject ) {
111
113
addFirebaseFunctionsDependencies ( host , context ) ;
112
- } else {
113
- addFirebaseHostingDependencies ( host , context ) ;
114
114
}
115
115
const projectOptions : DeployOptions & { isUniversalProject : boolean } = {
116
116
...options ,
0 commit comments