File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
packages/schematics/angular/migrations/update-8 Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,21 @@ function updateBrowserlist(): Rule {
112112
113113 const browserslistPath = join ( normalize ( project . root ) , 'browserslist' ) ;
114114 if ( typeof project . sourceRoot === 'string' ) {
115+ // Move the CLI 7 style browserlist to root if it's there.
115116 const srcBrowsersList = join ( normalize ( project . sourceRoot ) , 'browserslist' ) ;
116- if ( tree . exists ( srcBrowsersList ) ) {
117- tree . rename ( srcBrowsersList , browserslistPath ) ;
117+ if ( tree . exists ( srcBrowsersList ) && ! tree . exists ( browserslistPath ) ) {
118+ // TODO: use rename instead.
119+ // This is a hacky workaround. We should be able to just rename it.
120+ // On unit tests the rename works fine but on real projects it fails with
121+ // ERROR! browserslist does not exist..
122+ // This seems to happen because we are both renaming and then commiting an update.
123+ // But it's fine if we read/create/delete. There's a bug somewhere.
124+ // tree.rename(srcBrowsersList, browserslistPath);
125+ const content = tree . read ( srcBrowsersList ) ;
126+ if ( content ) {
127+ tree . create ( browserslistPath , content ) ;
128+ tree . delete ( srcBrowsersList ) ;
129+ }
118130 }
119131 }
120132
You can’t perform that action at this time.
0 commit comments