Skip to content

Commit 7180d4f

Browse files
authored
Merge branch 'master' into zb/152
2 parents c0daad2 + b7d5d77 commit 7180d4f

File tree

11 files changed

+515
-154
lines changed

11 files changed

+515
-154
lines changed

.eslintrc.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
root: true
2-
extends: standard
2+
extends:
3+
- standard
4+
- plugin:markdown/recommended
5+
plugins:
6+
- markdown
7+
overrides:
8+
- files: '**/*.md'
9+
processor: 'markdown/markdown'

.github/workflows/ci.yml

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: ci
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
name:
13+
- Node.js 0.8
14+
- Node.js 0.10
15+
- Node.js 0.12
16+
- io.js 1.x
17+
- io.js 2.x
18+
- io.js 3.x
19+
- Node.js 4.x
20+
- Node.js 5.x
21+
- Node.js 6.x
22+
- Node.js 7.x
23+
- Node.js 8.x
24+
- Node.js 9.x
25+
- Node.js 10.x
26+
- Node.js 11.x
27+
- Node.js 12.x
28+
- Node.js 13.x
29+
- Node.js 14.x
30+
- Node.js 15.x
31+
- Node.js 16.x
32+
- Node.js 17.x
33+
- Node.js 18.x
34+
- Node.js 19.x
35+
- Node.js 20.x
36+
- Node.js 21.x
37+
- Node.js 22.x
38+
- Node.js 23.x
39+
40+
include:
41+
- name: Node.js 0.8
42+
node-version: "0.8"
43+
44+
npm-rm: nyc
45+
46+
- name: Node.js 0.10
47+
node-version: "0.10"
48+
49+
50+
- name: Node.js 0.12
51+
node-version: "0.12"
52+
53+
54+
- name: io.js 1.x
55+
node-version: "1.8"
56+
57+
58+
- name: io.js 2.x
59+
node-version: "2.5"
60+
61+
62+
- name: io.js 3.x
63+
node-version: "3.3"
64+
65+
66+
- name: Node.js 4.x
67+
node-version: "4"
68+
69+
70+
- name: Node.js 5.x
71+
node-version: "5"
72+
73+
74+
- name: Node.js 6.x
75+
node-version: "6"
76+
77+
78+
- name: Node.js 7.x
79+
node-version: "7"
80+
81+
82+
- name: Node.js 8.x
83+
node-version: "8"
84+
85+
86+
- name: Node.js 9.x
87+
node-version: "9"
88+
89+
90+
- name: Node.js 10.x
91+
node-version: "10"
92+
93+
94+
- name: Node.js 11.x
95+
node-version: "11"
96+
97+
98+
- name: Node.js 12.x
99+
node-version: "12"
100+
101+
- name: Node.js 13.x
102+
node-version: "13"
103+
104+
- name: Node.js 14.x
105+
node-version: "14"
106+
107+
- name: Node.js 15.x
108+
node-version: "15"
109+
110+
- name: Node.js 16.x
111+
node-version: "16"
112+
113+
- name: Node.js 17.x
114+
node-version: "17"
115+
116+
- name: Node.js 18.x
117+
node-version: "18"
118+
119+
- name: Node.js 19.x
120+
node-version: "19"
121+
122+
- name: Node.js 20.x
123+
node-version: "20"
124+
125+
- name: Node.js 21.x
126+
node-version: "21"
127+
128+
- name: Node.js 22.x
129+
node-version: "22"
130+
131+
- name: Node.js 23.x
132+
node-version: "23"
133+
134+
steps:
135+
- uses: actions/checkout@v4
136+
137+
- name: Install Node.js ${{ matrix.node-version }}
138+
shell: bash -eo pipefail -l {0}
139+
run: |
140+
nvm install --default ${{ matrix.node-version }}
141+
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
142+
nvm install --alias=npm 0.10
143+
nvm use ${{ matrix.node-version }}
144+
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
145+
npm config set strict-ssl false
146+
fi
147+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
148+
149+
- name: Configure npm
150+
run: |
151+
if [[ "$(npm config get package-lock)" == "true" ]]; then
152+
npm config set package-lock false
153+
else
154+
npm config set shrinkwrap false
155+
fi
156+
157+
- name: Remove npm module(s) ${{ matrix.npm-rm }}
158+
run: npm rm --silent --save-dev ${{ matrix.npm-rm }}
159+
if: matrix.npm-rm != ''
160+
161+
- name: Install npm module(s) ${{ matrix.npm-i }}
162+
run: npm install --save-dev ${{ matrix.npm-i }}
163+
if: matrix.npm-i != ''
164+
165+
- name: Setup Node.js version-specific dependencies
166+
shell: bash
167+
run: |
168+
# eslint for linting
169+
# - remove on Node.js < 10
170+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
171+
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
172+
grep -E '^eslint(-|$)' | \
173+
sort -r | \
174+
xargs -n1 npm rm --silent --save-dev
175+
fi
176+
177+
- name: Install Node.js dependencies
178+
run: npm install
179+
180+
- name: List environment
181+
id: list_env
182+
shell: bash
183+
run: |
184+
echo "node@$(node -v)"
185+
echo "npm@$(npm -v)"
186+
npm -s ls ||:
187+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
188+
189+
- name: Run tests
190+
shell: bash
191+
run: |
192+
if npm -ps ls nyc | grep -q nyc; then
193+
npm run test-ci
194+
else
195+
npm test
196+
fi
197+
198+
- name: Lint code
199+
if: steps.list_env.outputs.eslint != ''
200+
run: npm run lint
201+
202+
- name: Collect code coverage
203+
uses: coverallsapp/github-action@master
204+
if: steps.list_env.outputs.nyc != ''
205+
with:
206+
github-token: ${{ secrets.GITHUB_TOKEN }}
207+
flag-name: run-${{ matrix.test_number }}
208+
parallel: true
209+
210+
coverage:
211+
needs: test
212+
runs-on: ubuntu-latest
213+
steps:
214+
- name: Upload code coverage
215+
uses: coverallsapp/github-action@master
216+
with:
217+
github-token: ${{ secrets.github_token }}
218+
parallel-finished: true

.github/workflows/codeql.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["master"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["master"]
20+
schedule:
21+
- cron: "0 0 * * 1"
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
42+
with:
43+
languages: javascript
44+
# If you wish to specify custom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
48+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
49+
# If this step fails, then you should remove it and run the build manually (see below)
50+
# - name: Autobuild
51+
# uses: github/codeql-action/autobuild@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
52+
53+
# ℹ️ Command-line programs to run using the OS shell.
54+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
55+
56+
# If the Autobuild fails above, remove it and uncomment the following three lines.
57+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
58+
59+
# - run: |
60+
# echo "Run, Build Application using script"
61+
# ./location_of_script_within_repo/buildscript.sh
62+
63+
- name: Perform CodeQL Analysis
64+
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
65+
with:
66+
category: "/language:javascript"

.github/workflows/scorecard.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
7+
on:
8+
# For Branch-Protection check. Only the default branch is supported. See
9+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
10+
branch_protection_rule:
11+
# To guarantee Maintained check is occasionally updated. See
12+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
13+
schedule:
14+
- cron: '16 21 * * 1'
15+
push:
16+
branches: [ "master" ]
17+
18+
# Declare default permissions as read only.
19+
permissions: read-all
20+
21+
jobs:
22+
analysis:
23+
name: Scorecard analysis
24+
runs-on: ubuntu-latest
25+
permissions:
26+
# Needed to upload the results to code-scanning dashboard.
27+
security-events: write
28+
# Needed to publish results and get a badge (see publish_results below).
29+
id-token: write
30+
31+
steps:
32+
- name: "Checkout code"
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
34+
with:
35+
persist-credentials: false
36+
37+
- name: "Run analysis"
38+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
39+
with:
40+
results_file: results.sarif
41+
results_format: sarif
42+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
43+
# - you want to enable the Branch-Protection check on a *public* repository, or
44+
# - you are installing Scorecard on a *private* repository
45+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
46+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
47+
48+
# Public repositories:
49+
# - Publish results to OpenSSF REST API for easy access by consumers
50+
# - Allows the repository to include the Scorecard badge.
51+
# - See https://github.com/ossf/scorecard-action#publishing-results.
52+
# For private repositories:
53+
# - `publish_results` will always be set to `false`, regardless
54+
# of the value entered here.
55+
publish_results: true
56+
57+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
58+
# format to the repository Actions tab.
59+
- name: "Upload artifact"
60+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
61+
with:
62+
name: SARIF file
63+
path: results.sarif
64+
retention-days: 5
65+
66+
# Upload the results to GitHub's code scanning dashboard.
67+
- name: "Upload to code-scanning"
68+
uses: github/codeql-action/upload-sarif@2f93e4319b2f04a2efc38fa7f78bd681bc3f7b2f # v2.23.2
69+
with:
70+
sarif_file: results.sarif

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.nyc_output/
12
coverage
23
node_modules
34
npm-debug.log
5+
package-lock.json

0 commit comments

Comments
 (0)