Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,21 @@ function updateBrowserlist(): Rule {

const browserslistPath = join(normalize(project.root), 'browserslist');
if (typeof project.sourceRoot === 'string') {
// Move the CLI 7 style browserlist to root if it's there.
const srcBrowsersList = join(normalize(project.sourceRoot), 'browserslist');
if (tree.exists(srcBrowsersList)) {
tree.rename(srcBrowsersList, browserslistPath);
if (tree.exists(srcBrowsersList) && !tree.exists(browserslistPath)) {
// TODO: use rename instead.
// This is a hacky workaround. We should be able to just rename it.
// On unit tests the rename works fine but on real projects it fails with
// ERROR! browserslist does not exist..
// This seems to happen because we are both renaming and then commiting an update.
// But it's fine if we read/create/delete. There's a bug somewhere.
// tree.rename(srcBrowsersList, browserslistPath);
const content = tree.read(srcBrowsersList);
if (content) {
tree.create(browserslistPath, content);
tree.delete(srcBrowsersList);
}
}
}

Expand Down