Skip to content

Commit 841c7f5

Browse files
authored
chore: remove node < 18 (#219)
1 parent c7ace2c commit 841c7f5

File tree

2 files changed

+54
-207
lines changed

2 files changed

+54
-207
lines changed

.github/workflows/ci.yml

+53-206
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: ci
22

33
on:
4-
pull_request:
4+
push:
55
branches:
6-
- master
6+
- v2
77
paths-ignore:
88
- '*.md'
9-
push:
9+
pull_request:
10+
branches:
11+
- v2
1012
paths-ignore:
1113
- '*.md'
1214

@@ -31,209 +33,55 @@ jobs:
3133
node-version: 'lts/*'
3234

3335
- name: Install dependencies
34-
run: npm install --ignore-scripts --only=dev
36+
run: npm install --ignore-scripts --include=dev
3537

3638
- name: Run lint
3739
run: npm run lint
3840

3941
test:
40-
runs-on: ubuntu-latest
4142
strategy:
4243
fail-fast: false
4344
matrix:
44-
name:
45-
- Node.js 0.8
46-
- Node.js 0.10
47-
- Node.js 0.12
48-
- io.js 1.x
49-
- io.js 2.x
50-
- io.js 3.x
51-
- Node.js 4.x
52-
- Node.js 5.x
53-
- Node.js 6.x
54-
- Node.js 7.x
55-
- Node.js 8.x
56-
- Node.js 9.x
57-
- Node.js 10.x
58-
- Node.js 11.x
59-
- Node.js 12.x
60-
- Node.js 13.x
61-
- Node.js 14.x
62-
- Node.js 15.x
63-
- Node.js 16.x
64-
- Node.js 17.x
65-
- Node.js 18.x
66-
- Node.js 19.x
67-
- Node.js 20.x
68-
- Node.js 21.x
69-
- Node.js 22.x
70-
- Node.js 23.x
71-
72-
include:
73-
- name: Node.js 0.8
74-
node-version: "0.8"
75-
76-
npm-rm: nyc
77-
78-
- name: Node.js 0.10
79-
node-version: "0.10"
80-
81-
82-
- name: Node.js 0.12
83-
node-version: "0.12"
84-
85-
86-
- name: io.js 1.x
87-
node-version: "1.8"
88-
89-
90-
- name: io.js 2.x
91-
node-version: "2.5"
92-
93-
94-
- name: io.js 3.x
95-
node-version: "3.3"
96-
97-
98-
- name: Node.js 4.x
99-
node-version: "4"
100-
101-
102-
- name: Node.js 5.x
103-
node-version: "5"
104-
105-
106-
- name: Node.js 6.x
107-
node-version: "6"
108-
109-
110-
- name: Node.js 7.x
111-
node-version: "7"
112-
113-
114-
- name: Node.js 8.x
115-
node-version: "8"
116-
117-
118-
- name: Node.js 9.x
119-
node-version: "9"
120-
121-
122-
- name: Node.js 10.x
123-
node-version: "10"
124-
125-
126-
- name: Node.js 11.x
127-
node-version: "11"
128-
129-
130-
- name: Node.js 12.x
131-
node-version: "12"
132-
133-
- name: Node.js 13.x
134-
node-version: "13"
45+
os: [ubuntu-latest, windows-latest]
46+
node-version: [18, 19, 20, 21, 22, 23]
47+
# Node.js release schedule: https://nodejs.org/en/about/releases/
13548

136-
- name: Node.js 14.x
137-
node-version: "14"
138-
139-
- name: Node.js 15.x
140-
node-version: "15"
141-
142-
- name: Node.js 16.x
143-
node-version: "16"
144-
145-
- name: Node.js 17.x
146-
node-version: "17"
147-
148-
- name: Node.js 18.x
149-
node-version: "18"
150-
151-
- name: Node.js 19.x
152-
node-version: "19"
153-
154-
- name: Node.js 20.x
155-
node-version: "20"
156-
157-
- name: Node.js 21.x
158-
node-version: "21"
159-
160-
- name: Node.js 22.x
161-
node-version: "22"
162-
163-
- name: Node.js 23.x
164-
node-version: "23"
49+
name: Node.js ${{ matrix.node-version }} - ${{matrix.os}}
16550

51+
runs-on: ${{ matrix.os }}
16652
steps:
167-
- uses: actions/checkout@v4
168-
169-
- name: Install Node.js ${{ matrix.node-version }}
170-
shell: bash -eo pipefail -l {0}
171-
run: |
172-
nvm install --default ${{ matrix.node-version }}
173-
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
174-
nvm install --alias=npm 0.10
175-
nvm use ${{ matrix.node-version }}
176-
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
177-
npm config set strict-ssl false
178-
fi
179-
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
180-
181-
- name: Configure npm
182-
run: |
183-
if [[ "$(npm config get package-lock)" == "true" ]]; then
184-
npm config set package-lock false
185-
else
186-
npm config set shrinkwrap false
187-
fi
188-
189-
- name: Remove npm module(s) ${{ matrix.npm-rm }}
190-
run: npm rm --silent --save-dev ${{ matrix.npm-rm }}
191-
if: matrix.npm-rm != ''
53+
- uses: actions/checkout@v4
54+
with:
55+
persist-credentials: false
19256

193-
- name: Install npm module(s) ${{ matrix.npm-i }}
194-
run: npm install --save-dev ${{ matrix.npm-i }}
195-
if: matrix.npm-i != ''
57+
- name: Setup Node.js ${{ matrix.node-version }}
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: ${{ matrix.node-version }}
19661

197-
- name: Setup Node.js version-specific dependencies
198-
shell: bash
199-
run: |
200-
# eslint for linting
201-
# - remove on Node.js < 10
202-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
203-
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
204-
grep -E '^eslint(-|$)' | \
205-
sort -r | \
206-
xargs -n1 npm rm --silent --save-dev
207-
fi
62+
- name: Configure npm loglevel
63+
run: |
64+
npm config set loglevel error
65+
shell: bash
20866

209-
- name: Install Node.js dependencies
210-
run: npm install
67+
- name: Install dependencies
68+
run: npm install
21169

212-
- name: List environment
213-
id: list_env
214-
shell: bash
215-
run: |
216-
echo "node@$(node -v)"
217-
echo "npm@$(npm -v)"
218-
npm -s ls ||:
219-
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
70+
- name: Output Node and NPM versions
71+
run: |
72+
echo "Node.js version: $(node -v)"
73+
echo "NPM version: $(npm -v)"
22074
221-
- name: Run tests
222-
shell: bash
223-
run: |
224-
if npm -ps ls nyc | grep -q nyc; then
225-
npm run test-ci
226-
else
227-
npm test
228-
fi
75+
- name: Run tests
76+
shell: bash
77+
run: npm run test-ci
22978

230-
- name: Upload code coverage
231-
if: steps.list_env.outputs.nyc != ''
232-
uses: actions/upload-artifact@v4
233-
with:
234-
name: coverage-node-${{ matrix.node-version }}
235-
path: ./coverage/lcov.info
236-
retention-days: 1
79+
- name: Upload code coverage
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
83+
path: ./coverage/lcov.info
84+
retention-days: 1
23785

23886
coverage:
23987
needs: test
@@ -242,24 +90,23 @@ jobs:
24290
contents: read
24391
checks: write
24492
steps:
245-
- uses: actions/checkout@v4
93+
- uses: actions/checkout@v4
24694

247-
- name: Install lcov
248-
shell: bash
249-
run: sudo apt-get -y install lcov
95+
- name: Install lcov
96+
shell: bash
97+
run: sudo apt-get -y install lcov
25098

251-
- name: Collect coverage reports
252-
uses: actions/download-artifact@v4
253-
with:
254-
path: ./coverage
255-
pattern: coverage-node-*
99+
- name: Collect coverage reports
100+
uses: actions/download-artifact@v4
101+
with:
102+
path: ./coverage
103+
pattern: coverage-node-*
256104

257-
- name: Merge coverage reports
258-
shell: bash
259-
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
105+
- name: Merge coverage reports
106+
shell: bash
107+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
260108

261-
- name: Upload coverage report
262-
uses: coverallsapp/github-action@v2
263-
with:
264-
github-token: ${{ secrets.GITHUB_TOKEN }}
265-
file: ./lcov.info
109+
- name: Upload coverage report
110+
uses: coverallsapp/github-action@v2
111+
with:
112+
file: ./lcov.info

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"index.js"
3838
],
3939
"engines": {
40-
"node": ">= 0.8.0"
40+
"node": ">= 18"
4141
},
4242
"scripts": {
4343
"lint": "eslint .",

0 commit comments

Comments
 (0)