@@ -29,9 +29,17 @@ updateConfig();
29
29
30
30
export function fixFormatter ( ) {
31
31
const formatPath = path . join ( process . cwd ( ) , '/../..' , '@nrwl/schematics/src/command-line/format.js' ) ;
32
- // console.log('formatPath:', formatPath);
33
32
let formatContent = fs . readFileSync ( formatPath , 'UTF-8' ) ;
34
- const patchLine = ` patterns.push("xplat\/**\/*.ts", "!apps/**/platforms/{android,ios}/**/*.ts");` ;
33
+
34
+ // Old patch line, globs should've been wrapped in quotes.
35
+ const oldPatchLine = ` patterns.push("xplat\/**\/*.ts", "!apps/**/platforms/{android,ios}/**/*.ts");` ;
36
+ const patchLine = ` patterns.push("\"xplat\/**\/*.ts\"", "\"!apps/**/platforms/{android,ios}/**/*.ts\"");` ;
37
+ if ( formatContent . indexOf ( oldPatchLine ) !== - 1 ) {
38
+ console . log ( 'Old patch for nx format have been applied, replace with new patch' ) ;
39
+ fs . writeFileSync ( formatPath , formatContent . replace ( oldPatchLine , patchLine ) ) ;
40
+ return ;
41
+ }
42
+
35
43
if ( formatContent . indexOf ( patchLine ) !== - 1 ) {
36
44
console . log ( `Patch for nx format have already been applied` ) ;
37
45
return ;
@@ -45,6 +53,7 @@ export function fixFormatter() {
45
53
const newFormatContent = formatContent . replace ( patchRegExp , `$1\n${ patchLine } \n$2` ) ;
46
54
if ( formatContent !== newFormatContent ) {
47
55
fs . writeFileSync ( formatPath , newFormatContent ) ;
56
+ console . log ( 'Patch for nx format have been applied' ) ;
48
57
} else {
49
58
throw new Error ( `Apply couldn't patch for nx format` ) ;
50
59
}
0 commit comments