-
Notifications
You must be signed in to change notification settings - Fork 28
feat: Add @wordpress/browserslist-config
package
#69
Changes from 1 commit
29a1916
b690cb3
398fae0
0dfaed0
87ca228
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 2.0.0 | ||
|
||
- Transfer to @wordpress npm orginization | ||
- Published as @wordpress/browserslist-config | ||
|
||
# 1.1.0 | ||
|
||
- Add browserslist tests | ||
- Refactor per coding standards | ||
|
||
# 1.0.1 | ||
|
||
- Update installation documentation. | ||
|
||
# 1.0.0 | ||
|
||
- Initial release. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# @wordpress/browserslist-config | ||
|
||
[WordPress Browserslist](https://make.wordpress.org/design/handbook/design-guide/browser-support/) shareable config for [Browserslist](https://www.npmjs.com/package/browserslist). | ||
|
||
## Installation | ||
|
||
Install the module | ||
|
||
```shell | ||
$ npm install @wordpress/browserslist-config | ||
``` | ||
|
||
## Usage | ||
|
||
Add this to your `package.json` file: | ||
|
||
```json | ||
"browserslist": [ | ||
"extends @wordpress/browserslist-config" | ||
] | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// browserslist-config/index.js | ||
module.exports = [ | ||
'> 1%', | ||
'ie >= 11', | ||
'last 1 Android versions', | ||
'last 1 ChromeAndroid versions', | ||
'last 2 Chrome versions', | ||
'last 2 Firefox versions', | ||
'last 2 Safari versions', | ||
'last 2 iOS versions', | ||
'last 2 Edge versions', | ||
'last 2 Opera versions', | ||
]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@wordpress/browserslist-config", | ||
"version": "2.0.0", | ||
"description": "WordPress Browserslist Shared Config", | ||
"author": "WordPress", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"browserslist", | ||
"browserslist-config" | ||
], | ||
"homepage": "https://github.com/WordPress/packages/tree/master/packages/browserslist-config/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/packages.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/packages/issues" | ||
}, | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"devDependencies": { | ||
"browserslist": "^2.11.3" | ||
}, | ||
"peerDependencies": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary since it is already listed as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I added it to I opened an issue a while ago here asking that These are the two ESLint errors thrown when
I'm going to remove it from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed it 0dfaed0, will add the |
||
"browserslist": "^2.11.3" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const browserslist = require( 'browserslist' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the whole file should follow WordPress spacing rules. |
||
const config = require( '../' ); | ||
|
||
beforeEach(() => { | ||
jest.resetModules(); | ||
}); | ||
|
||
it( 'should export an array', () => { | ||
expect( Array.isArray( config ) ).toBe( true ); | ||
}); | ||
|
||
it( 'should not contain invalid queries', () => { | ||
jest.doMock( '@wordpress/browserslist-config', () => require( '../index' ), { virtual: true }); | ||
|
||
const result = browserslist(['extends @wordpress/browserslist-config']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spacing should be fixed to match coding styles. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to skip this change, for now, we need to get ESLint setup The blocker to this is getting the changes from https://make.wordpress.org/core/2017/09/07/proposal-for-js-standards-revision-removing-array-function-whitespace-exceptions/ merged. In me hacking in ESLint to run over this PR both the following return no ESLint errors: And this does: I'm not sure why |
||
expect( result ).toBeTruthy(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orginization
->organization
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @atimmer 👍 Fixed in 398fae0