Skip to content

Commit 1cc64ff

Browse files
authored
Use modern JS features, ship TS defs (#175)
1 parent e206fd5 commit 1cc64ff

21 files changed

+5680
-1369
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 17 additions & 244 deletions
Original file line numberDiff line numberDiff line change
@@ -1,253 +1,26 @@
11
name: ci
22

33
on:
4-
- pull_request
5-
- push
4+
- pull_request
5+
- push
66

77
jobs:
88
test:
9-
runs-on: ubuntu-20.04
9+
name: Node.js ${{ matrix.node-version }}
10+
runs-on: ubuntu-latest
1011
strategy:
1112
matrix:
12-
name:
13-
- Node.js 0.6
14-
- Node.js 0.8
15-
- Node.js 0.10
16-
- Node.js 0.12
17-
- io.js 1.x
18-
- io.js 2.x
19-
- io.js 3.x
20-
- Node.js 4.x
21-
- Node.js 5.x
22-
- Node.js 6.x
23-
- Node.js 7.x
24-
- Node.js 8.x
25-
- Node.js 9.x
26-
- Node.js 10.x
27-
- Node.js 11.x
28-
- Node.js 12.x
29-
- Node.js 13.x
30-
- Node.js 14.x
31-
- Node.js 15.x
32-
- Node.js 16.x
33-
- Node.js 17.x
34-
- Node.js 18.x
35-
- Node.js 19.x
36-
- Node.js 20.x
37-
- Node.js 21.x
38-
39-
include:
40-
- name: Node.js 0.6
41-
node-version: "0.6"
42-
43-
npm-rm: beautify-benchmark benchmark nyc top-sites
44-
45-
- name: Node.js 0.8
46-
node-version: "0.8"
47-
48-
npm-rm: beautify-benchmark benchmark nyc top-sites
49-
50-
- name: Node.js 0.10
51-
node-version: "0.10"
52-
53-
npm-rm: beautify-benchmark benchmark top-sites
54-
55-
- name: Node.js 0.12
56-
node-version: "0.12"
57-
58-
npm-rm: beautify-benchmark benchmark top-sites
59-
60-
- name: io.js 1.x
61-
node-version: "1.8"
62-
63-
npm-rm: beautify-benchmark benchmark top-sites
64-
65-
- name: io.js 2.x
66-
node-version: "2.5"
67-
68-
npm-rm: beautify-benchmark benchmark top-sites
69-
70-
- name: io.js 3.x
71-
node-version: "3.3"
72-
73-
npm-rm: beautify-benchmark benchmark top-sites
74-
75-
- name: Node.js 4.x
76-
node-version: "4.9"
77-
78-
npm-rm: beautify-benchmark benchmark top-sites
79-
80-
- name: Node.js 5.x
81-
node-version: "5.12"
82-
83-
npm-rm: beautify-benchmark benchmark top-sites
84-
85-
- name: Node.js 6.x
86-
node-version: "6.17"
87-
88-
npm-rm: beautify-benchmark benchmark top-sites
89-
90-
- name: Node.js 7.x
91-
node-version: "7.10"
92-
93-
npm-rm: beautify-benchmark benchmark top-sites
94-
95-
- name: Node.js 8.x
96-
node-version: "8.17"
97-
98-
npm-rm: beautify-benchmark benchmark top-sites
99-
100-
- name: Node.js 9.x
101-
node-version: "9.11"
102-
103-
npm-rm: beautify-benchmark benchmark top-sites
104-
105-
- name: Node.js 10.x
106-
node-version: "10.24"
107-
108-
npm-rm: beautify-benchmark benchmark top-sites
109-
110-
- name: Node.js 11.x
111-
node-version: "11.15"
112-
113-
npm-rm: beautify-benchmark benchmark top-sites
114-
115-
- name: Node.js 12.x
116-
node-version: "12.22"
117-
118-
npm-rm: beautify-benchmark benchmark top-sites
119-
120-
- name: Node.js 13.x
121-
node-version: "13.14"
122-
123-
npm-rm: beautify-benchmark benchmark top-sites
124-
125-
- name: Node.js 14.x
126-
node-version: "14.21"
127-
npm-rm: beautify-benchmark benchmark top-sites
128-
129-
- name: Node.js 15.x
130-
node-version: "15.14"
131-
npm-rm: beautify-benchmark benchmark top-sites
132-
133-
- name: Node.js 16.x
134-
node-version: "16.20"
135-
npm-rm: beautify-benchmark benchmark top-sites
136-
137-
- name: Node.js 17.x
138-
node-version: "17.9"
139-
npm-rm: beautify-benchmark benchmark top-sites
140-
141-
- name: Node.js 18.x
142-
node-version: "18.18"
143-
npm-rm: beautify-benchmark benchmark top-sites
144-
145-
- name: Node.js 19.x
146-
node-version: "19.9"
147-
npm-rm: beautify-benchmark benchmark top-sites
148-
149-
- name: Node.js 20.x
150-
node-version: "20.9"
151-
npm-rm: beautify-benchmark benchmark top-sites
152-
153-
- name: Node.js 21.x
154-
node-version: "21.1"
155-
156-
steps:
157-
- uses: actions/checkout@v3
158-
159-
- name: Install Node.js ${{ matrix.node-version }}
160-
shell: bash -eo pipefail -l {0}
161-
run: |
162-
if [[ "${{ matrix.node-version }}" == 0.6* ]]; then
163-
sudo sh -c 'echo "deb http://us.archive.ubuntu.com/ubuntu/ bionic universe" >> /etc/apt/sources.list'
164-
sudo sh -c 'echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list'
165-
sudo apt-get update
166-
sudo apt-get install g++-4.8 gcc-4.8 libssl1.0-dev python2 python-is-python2
167-
export CC=/usr/bin/gcc-4.8
168-
export CXX=/usr/bin/g++-4.8
169-
fi
170-
nvm install --default ${{ matrix.node-version }}
171-
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
172-
nvm install --alias=npm 0.10
173-
nvm use ${{ matrix.node-version }}
174-
if [[ "$(npm -v)" == 1.1.* ]]; then
175-
nvm exec npm npm install -g [email protected]
176-
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
177-
else
178-
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
179-
fi
180-
npm config set strict-ssl false
181-
fi
182-
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
183-
184-
- name: Configure npm
185-
run: |
186-
if [[ "$(npm config get package-lock)" == "true" ]]; then
187-
npm config set package-lock false
188-
else
189-
npm config set shrinkwrap false
190-
fi
191-
192-
- name: Remove npm module(s) ${{ matrix.npm-rm }}
193-
run: npm rm --silent --save-dev ${{ matrix.npm-rm }}
194-
if: matrix.npm-rm != ''
195-
196-
- name: Install npm module(s) ${{ matrix.npm-i }}
197-
run: npm install --save-dev ${{ matrix.npm-i }}
198-
if: matrix.npm-i != ''
199-
200-
- name: Setup Node.js version-specific dependencies
201-
shell: bash
202-
run: |
203-
# eslint for linting
204-
# - remove on Node.js < 12
205-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
206-
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
207-
grep -E '^eslint(-|$)' | \
208-
sort -r | \
209-
xargs -n1 npm rm --silent --save-dev
210-
fi
211-
212-
- name: Install Node.js dependencies
213-
run: npm install
214-
215-
- name: List environment
216-
id: list_env
217-
shell: bash
218-
run: |
219-
echo "node@$(node -v)"
220-
echo "npm@$(npm -v)"
221-
npm -s ls ||:
222-
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
223-
224-
- name: Run tests
225-
shell: bash
226-
run: |
227-
if npm -ps ls nyc | grep -q nyc; then
228-
npm run test-ci
229-
else
230-
npm test
231-
fi
232-
233-
- name: Lint code
234-
if: steps.list_env.outputs.eslint != ''
235-
run: npm run lint
236-
237-
- name: Collect code coverage
238-
uses: coverallsapp/github-action@master
239-
if: steps.list_env.outputs.nyc != ''
240-
with:
241-
github-token: ${{ secrets.GITHUB_TOKEN }}
242-
flag-name: run-${{ matrix.test_number }}
243-
parallel: true
244-
245-
coverage:
246-
needs: test
247-
runs-on: ubuntu-latest
13+
node-version:
14+
- "18"
15+
- "20"
16+
- "22"
24817
steps:
249-
- name: Upload code coverage
250-
uses: coverallsapp/github-action@master
251-
with:
252-
github-token: ${{ secrets.github_token }}
253-
parallel-finished: true
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: npm ci
23+
- run: npm test
24+
- uses: codecov/codecov-action@v4
25+
with:
26+
name: Node.js ${{ matrix.node-version }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
coverage/
33
node_modules/
44
npm-debug.log
5-
package-lock.json
5+
dist/
6+
*.tsbuildinfo

0 commit comments

Comments
 (0)