Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@schematics/angular): workaround bug in recorder/update #14252

Merged
merged 1 commit into from
Apr 23, 2019
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