Skip to content

Commit

Permalink
feat: update supported browsers, add npm script to list browsers (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz authored May 24, 2022
1 parent 1c557f0 commit 68a2324
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
# `@edx/browserslist-config`

[![license](https://img.shields.io/npm/l/@edx/browserslist-config)](LICENSE)
[![license](https://img.shields.io/npm/l/@edx/browserslist-config)](LICENSE) [![npm](https://img.shields.io/npm/v/@edx/browserslist-config)](https://www.npmjs.com/package/@edx/browserslist-config)

Shareable [browserslist](https://github.com/browserslist/browserslist) configuration for edX. See [documentation](https://github.com/browserslist/browserslist#shareable-configs) on shareable `browserslist` configurations for more details.
Shareable [browserslist](https://github.com/browserslist/browserslist) configuration for Open edX. If our supported browsers changes in the future, this will be the primary place to update for all consumers (e.g., micro-frontends).

## What is Browserslist?

[Browserslist](https://github.com/browserslist/browserslist) is a tool to share target browsers and Node.js versions between different frontend tools (e.g., autoprefixer, babel, etc.).

See [documentation](https://github.com/browserslist/browserslist#shareable-configs) on shareable `browserslist` configurations for more details.

## Supported Browsers

### Desktop

| Browser | Version |
| ----------------------------- | ------- |
| Chrome | last 2 |
| Chrome for Android | last 2 |
| Safari | last 2 |
| Safari for iOS | last 2 |
| Edge | last 2 |
| Firefox | last 2 |
| Firefox for Android | last 2 |

### Mobile

| Browser | Version |
| ----------------------------- | ------- |
| Chrome for Android | last 3 |
| Safari for iOS | last 3 |
| Firefox for Android | last 3 |

### List all supported browsers

You can list all supported browsers by running:

```shell
$ npx browserslist "last 2 chrome versions, last 2 safari versions, last 2 edge versions, last 2 firefox versions, last 2 chromeandroid versions, last 2 firefoxandroid versions, last 2 ios versions"
npm install
npm run supported
```

Learn more by visiting the [browser support page on the edX Support Portal](https://support.edx.org/hc/en-us/articles/206211848-What-are-the-system-requirements-and-supported-browsers-on-edX-).

## Installation
## Installation and usage

Install the module.
Install the package in your repository:

```shell
$ npm install -D @edx/browserslist-config
```

## Usage

### package.json
In your `package.json` file:

```json
{
"browserslist": ["extends @edx/browserslist-config"]
}
```
```
24 changes: 15 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
module.exports = [
'last 2 chrome versions',
'last 2 safari versions',
'last 2 edge versions',
'last 2 firefox versions',
// Mobile
'last 2 chromeandroid versions',
'last 2 firefoxandroid versions',
'last 2 ios versions',
const desktop = [
'last 2 Chrome major versions',
'last 2 Firefox major versions',
'last 2 Safari major versions',
'last 2 Edge major versions',
];

const mobile = [
'last 3 ChromeAndroid major versions',
'last 3 FirefoxAndroid major versions',
'last 3 iOS major versions',
];

const supportedBrowsers = desktop.concat(mobile);

module.exports = supportedBrowsers;
51 changes: 51 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,14 @@
},
"bugs": {
"url": "https://github.com/edx/browserslist-config/issues"
},
"files": [
"index.js"
],
"scripts": {
"supported": "node -e \"var bl = require('browserslist'); console.log(bl(require('./index')).join('\\n'));\""
},
"devDependencies": {
"browserslist": "4.20.3"
}
}

0 comments on commit 68a2324

Please sign in to comment.