Skip to content

feat(@schematics/angular): remove Browserslist configuration files from projects #23897

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

Merged
merged 2 commits into from
Sep 14, 2022

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Sep 12, 2022

The Browserslist configuration file is redundant as we set the defaults directly in @angular-devkit/build-angular.

browserslist.defaults = [
'last 1 Chrome version',
'last 1 Firefox version',
'last 2 Edge major versions',
'last 2 Safari major versions',
'last 2 iOS major versions',
'Firefox ESR',
];

With this commit, we remove the .browserlistrc configuration file from the schematics application template and through a migration in existing projects when the Browserslist query result matches the default.

Users needing a finer grain support should still create a .browserlistrc in the root directory of the project.

@alan-agius4 alan-agius4 added the target: major This PR is targeted for the next major release label Sep 12, 2022
This migrations are no longer needed as multiple versions update is not allowed.
@alan-agius4 alan-agius4 force-pushed the browserlist-config-removal branch from 1d0ea00 to 819774c Compare September 12, 2022 07:11
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 12, 2022
@alan-agius4 alan-agius4 requested a review from clydin September 12, 2022 07:27
@alan-agius4 alan-agius4 marked this pull request as ready for review September 12, 2022 07:27
Copy link
Member

@clydin clydin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple comments.
Typo in the commit message also:
through a migration in exists projects (exists --> existing)

const defaultSupportedBrowsers = new Set(browserslist(DEFAULT_BROWSERS));

for (const path of visit(tree.root)) {
const { defaults: browsersListConfig } = browserslist.parseConfig(tree.readText(path));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are any other keys for custom sections, we should probably keep the file.
We could optionally cleanup the defaults section of the file but that might be more complex than needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can at least delete the config if contains the default browsers and old unsupported browsers that generate es5 output.

…om projects

The Browserslist configuration file is redundant as we set the defaults directly in @angular-devkit/build-angular. https://github.com/angular/angular-cli/blob/8da926966e9f414ceecf60b89acd475ce1b55fc5/packages/angular_devkit/build_angular/src/utils/supported-browsers.ts#L12-L19

With this commit, we remove the `.browserlistrc` configuration file from the schematics application template and through a migration in existing projects when the Browserslist query result matches the default.

Users needing a finer grain support should still create a `.browserlistrc` in the root directory of the project.
@alan-agius4 alan-agius4 force-pushed the browserlist-config-removal branch from 819774c to 6bbfbfe Compare September 14, 2022 07:48
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 14, 2022
@dgp1130 dgp1130 merged commit 9beb878 into angular:main Sep 14, 2022
@alan-agius4 alan-agius4 deleted the browserlist-config-removal branch September 14, 2022 17:45
@alan-agius4 alan-agius4 added this to the v15 Feature Freeze milestone Sep 23, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants