@@ -4,46 +4,13 @@ import {
44 Tree ,
55} from '@angular-devkit/schematics' ;
66import { updateWorkspace } from '@schematics/angular/utility/workspace' ;
7- import chalk from 'chalk' ;
87
9- import {
10- DAFF_JSON_DEFAULT ,
11- isSupportedPlatform ,
12- } from '../../../versioning/public_api' ;
8+ import { isSupportedPlatform } from '../../../versioning/public_api' ;
139import { NgAddOptions } from '../../schema' ;
1410
15- const DAFF_JSON_PATH = 'daff.json' ;
16-
1711const shouldScaffoldDaffConfig = ( options : NgAddOptions ) : boolean =>
1812 options . driver === 'magento' || options . driver === 'demo' ;
1913
20- export const createDaffJson = ( options : NgAddOptions , projectName : string ) : Rule =>
21- ( tree : Tree , context : SchematicContext ) => {
22- if ( ! shouldScaffoldDaffConfig ( options ) ) {
23- return tree ;
24- }
25-
26- if ( tree . exists ( DAFF_JSON_PATH ) ) {
27- context . logger . warn (
28- chalk . yellow ( `[WARN] daff.json already exists at the workspace root; leaving it unchanged.` ) ,
29- ) ;
30- return tree ;
31- }
32-
33- const body = {
34- ...DAFF_JSON_DEFAULT ,
35- } ;
36-
37- if ( isSupportedPlatform ( options . driver ) && options . driverVersion ) {
38- body . drivers = {
39- [ options . driver ] : options . driverVersion ,
40- } ;
41- }
42-
43- tree . create ( DAFF_JSON_PATH , JSON . stringify ( body , null , 2 ) + '\n' ) ;
44- return tree ;
45- } ;
46-
4714export const addBuildCondition = ( options : NgAddOptions , projectName_ : string ) : Rule => {
4815 if ( ! shouldScaffoldDaffConfig ( options ) ) {
4916 return ( tree : Tree ) => tree ;
0 commit comments