View all files | ||||
A module for turning Baseline thresholds into browserslist configurations.
You can install bl2bl with npm:
To update your browserslist config, run the following command:
bl2bl uses @mdn/browser-compat-data as a data source and will install the latest version of @mdn/browser-compat-data on install. However, is strongly recommended that you update @mdn/browser-compat-data regularly, or every time you run npx bl2bl, especially if you are targeting Baseline Widely available. You can automate this by adding a command to your package.json scripts array which updates @mdn/browser-compat-data before running npx bl2bl:
Make sure to configure bl2bl before use.
If you don't add a bl2bl property to your package.json file, the following defaults will apply:
This property determines which browsers your target and can take two value types: a string reading widely available or an integer representing the Baseline year required in the format YYYY.
Using widely available will select the last version of each of the Baseline core browser set released exactly 30 months before the time of execution.
Using a year in the format YYYY will select the last version of each of the Baseline core browser set released in the specified year. This may change in future releases to select earlier version of browsers which support the full Baseline feature set that calendar year.
If you pass an invalid string, or an integer below 2016 or above the previous calendar year, bl2bl will throw an error and not process any changes.
bl2bl defaults to storing browserslist configurations in the projects package.json file. If you want to store your browserslist configuration using the .browserslistrc file format, set this property to true.
There are many browsers that depend on another browser's engine and therefore support an identical feature set. For example, Opera 115 implements Blink 129 and therefore has the same web platform feature support as Chrome 129. Setting downstreamBrowsers to true will select minimum browser versions from other vendors that correspond to the minimum versions of the core browser set browsers you have selected.
TODO: include an example here
By default, bl2bl will save your previous browserlist configuration in a file called .browserslistrc_backup when you run npx bl2bl, in case you need to roll back to a previous configuration. If you don't want to create this backup, set savePrevious to false.