Skip to content

Commit b30dd32

Browse files
committed
Fancy-pants browserslist version selector
1 parent 2c552d5 commit b30dd32

File tree

4 files changed

+84
-22
lines changed

4 files changed

+84
-22
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ module.exports = {
4141
'named': 'never',
4242
'asyncArrow': 'always'
4343
}]
44+
},
45+
settings: {
46+
lintAllEsApis: true,
4447
}
4548
}

.github/workflows/test.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,47 @@ permissions:
1212

1313
jobs:
1414

15-
test:
15+
init:
16+
1617
runs-on: ubuntu-latest
18+
outputs:
19+
matrix: ${{ steps.set-matrix.outputs.matrix }}
20+
steps:
21+
22+
# A package.json file is a requirement of node-setup.
23+
- name: checkout
24+
uses: actions/checkout@v3
25+
26+
# We need a relatively modern node, but we're not picky.
27+
- name: node-setup
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: lts/*
31+
cache: npm
32+
33+
# We only really need browserslist, but meh.
34+
- name: node-init
35+
run: npm clean-install
36+
37+
# Could be a single command, but it'd be super long and crap.
38+
- name: set-matrix
39+
run: |-
40+
set -eo pipefail
41+
matrix="$(npx browserslist --json | jq -c '{
42+
os: [ "ubuntu-latest", "windows-latest" ],
43+
node: .browsers,
44+
}')"
45+
echo "matrix=$matrix" >> $GITHUB_OUTPUT
46+
echo "${matrix}"
47+
48+
test:
49+
needs: init
50+
1751
strategy:
1852
fail-fast: false
19-
matrix:
20-
node-version:
21-
- 8
22-
- 10
23-
- 12
53+
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
54+
55+
runs-on: ${{ matrix.os }}
2456
steps:
2557

2658
- name: checkout
@@ -29,10 +61,10 @@ jobs:
2961
- name: node-setup
3062
uses: actions/setup-node@v3
3163
with:
32-
node-version: ${{ matrix.node-version }}
64+
node-version: ${{ matrix.node }}
3365
cache: npm
3466

35-
- name: node-deps
67+
- name: node-init
3668
run: npm clean-install
3769

3870
- name: lint

package-lock.json

Lines changed: 34 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@
3434
"minimatch": "^3.1.2"
3535
},
3636
"devDependencies": {
37+
"browserslist": "^4.21.5",
3738
"eslint": "^6.8.0",
3839
"eslint-plugin-compat": "^4.1.4",
3940
"mocha": "^10.2.0",
4041
"q": "^1.5.1"
4142
},
4243
"engines": {
4344
"node": ">=10"
44-
}
45+
},
46+
"browserslist": [
47+
"node 8",
48+
"node 10",
49+
"node 12"
50+
]
4551
}

0 commit comments

Comments
 (0)