Skip to content

Commit

Permalink
Fancy-pants browserslist version selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzrlk committed Apr 25, 2023
1 parent 2c552d5 commit 0e75010
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ module.exports = {
'named': 'never',
'asyncArrow': 'always'
}]
},
settings: {
lintAllEsApis: true,
}
}
50 changes: 42 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,49 @@ permissions:

jobs:

test:
init:

runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:

# A package.json file is a requirement of node-setup.
- name: checkout
uses: actions/checkout@v3

# We need a relatively modern node, but we're not picky.
- name: node-setup
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: npm

# We only really need browserslist, but meh.
- name: node-init
run: npm clean-install

# Could be a single command, but it'd be super long and crap.
- name: set-matrix
run: |-
set -eo pipefail
matrix="$(npx browserslist --json | jq -c '{
os: [ "ubuntu-latest", "windows-latest" ],
node: .browsers,
}')"
#echo "matrix=$matrix" >> $GITHUB_OUTPUT
# see https://github.com/actions/runner/issues/2245
echo "::set-output name=matrix::$matrix"
echo "${matrix}"
test:
needs: init

strategy:
fail-fast: false
matrix:
node-version:
- 8
- 10
- 12
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}

runs-on: ${{ matrix.os }}
steps:

- name: checkout
Expand All @@ -29,10 +63,10 @@ jobs:
- name: node-setup
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node }}
cache: npm

- name: node-deps
- name: node-init
run: npm clean-install

- name: lint
Expand Down
47 changes: 34 additions & 13 deletions package-lock.json

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

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@
"minimatch": "^3.1.2"
},
"devDependencies": {
"browserslist": "^4.21.5",
"eslint": "^6.8.0",
"eslint-plugin-compat": "^4.1.4",
"mocha": "^10.2.0",
"q": "^1.5.1"
},
"engines": {
"node": ">=10"
}
},
"browserslist": [
"node 8",
"node 10",
"node 12"
]
}

0 comments on commit 0e75010

Please sign in to comment.