Skip to content

Commit 7ed1783

Browse files
committed
Merge remote-tracking branch 'upstream/release/2.0.1'
# Conflicts: # test/test.js
2 parents 6d8791e + 27d21d8 commit 7ed1783

File tree

8 files changed

+289
-28
lines changed

8 files changed

+289
-28
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
8+
- package-ecosystem: npm
9+
directory: /
10+
schedule:
11+
interval: monthly
12+
time: "23:00"
13+
timezone: Europe/London
14+
open-pull-requests-limit: 10
15+
ignore:
16+
- dependency-name: "*"
17+
update-types: ["version-update:semver-major"]

.github/workflows/ci.yml

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ on:
44
- pull_request
55
- push
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
test:
9-
runs-on: ubuntu-20.04
12+
permissions:
13+
checks: write # for coverallsapp/github-action to create new checks
14+
contents: read # for actions/checkout to fetch code
15+
runs-on: ubuntu-latest
1016
strategy:
17+
fail-fast: false
1118
matrix:
1219
name:
1320
- Node.js 0.8
@@ -30,6 +37,13 @@ jobs:
3037
- Node.js 15.x
3138
- Node.js 16.x
3239
- Node.js 17.x
40+
- Node.js 18.x
41+
- Node.js 19.x
42+
- Node.js 20.x
43+
- Node.js 21.x
44+
- Node.js 22.x
45+
- Node.js 23.x
46+
- Node.js 24.x
3347

3448
include:
3549
- name: Node.js 0.8
@@ -75,11 +89,11 @@ jobs:
7589

7690
- name: Node.js 8.x
7791
node-version: "8.17"
78-
92+
7993

8094
- name: Node.js 9.x
8195
node-version: "9.11"
82-
96+
8397

8498
- name: Node.js 10.x
8599
node-version: "10.24"
@@ -106,9 +120,30 @@ jobs:
106120

107121
- name: Node.js 17.x
108122
node-version: "17.2"
123+
124+
- name: Node.js 18.x
125+
node-version: "18"
126+
127+
- name: Node.js 19.x
128+
node-version: "19"
129+
130+
- name: Node.js 20.x
131+
node-version: "20"
132+
133+
- name: Node.js 21.x
134+
node-version: "21"
135+
136+
- name: Node.js 22.x
137+
node-version: "22"
138+
139+
- name: Node.js 23.x
140+
node-version: "23"
141+
142+
- name: Node.js 24.x
143+
node-version: "24"
109144

110145
steps:
111-
- uses: actions/checkout@v2
146+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
112147

113148
- name: Install Node.js ${{ matrix.node-version }}
114149
shell: bash -eo pipefail -l {0}
@@ -123,7 +158,12 @@ jobs:
123158
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
124159
125160
- name: Configure npm
126-
run: npm config set shrinkwrap false
161+
run: |
162+
if [[ "$(npm config get package-lock)" == "true" ]]; then
163+
npm config set package-lock false
164+
else
165+
npm config set shrinkwrap false
166+
fi
127167
128168
- name: Remove npm module(s) ${{ matrix.npm-rm }}
129169
run: npm rm --silent --save-dev ${{ matrix.npm-rm }}
@@ -171,19 +211,21 @@ jobs:
171211
run: npm run lint
172212

173213
- name: Collect code coverage
174-
uses: coverallsapp/github-action@master
214+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # master
175215
if: steps.list_env.outputs.nyc != ''
176216
with:
177217
github-token: ${{ secrets.GITHUB_TOKEN }}
178218
flag-name: run-${{ matrix.test_number }}
179219
parallel: true
180220

181221
coverage:
222+
permissions:
223+
checks: write # for coverallsapp/github-action to create new checks
182224
needs: test
183225
runs-on: ubuntu-latest
184226
steps:
185227
- name: Upload code coverage
186-
uses: coverallsapp/github-action@master
228+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # master
187229
with:
188230
github-token: ${{ secrets.github_token }}
189231
parallel-finished: true

.github/workflows/codeql.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
strategy:
36+
fail-fast: false
37+
matrix:
38+
language: ["javascript"]
39+
# CodeQL supports [ $supported-codeql-languages ]
40+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
45+
46+
# Initializes the CodeQL tools for scanning.
47+
- name: Initialize CodeQL
48+
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
49+
with:
50+
languages: ${{ matrix.language }}
51+
# If you wish to specify custom queries, you can do so here or in a config file.
52+
# By default, queries listed here will override any specified in a config file.
53+
# Prefix the list here with "+" to use these queries and those in the config file.
54+
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
59+
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65+
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
72+
with:
73+
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

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

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.0.1 / 2025-11-20
2+
==================
3+
4+
* deps: use tilde notation for dependencies
5+
* deps: update statuses to 2.0.2
6+
17
2.0.0 / 2021-12-17
28
==================
39

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,12 @@ function populateConstructorExports (exports, codes, HttpError) {
281281

282282
/**
283283
* Get a class name from a name identifier.
284+
*
285+
* @param {string} name
286+
* @returns {string}
284287
* @private
285288
*/
286289

287290
function toClassName (name) {
288-
return name.substr(-5) !== 'Error'
289-
? name + 'Error'
290-
: name
291+
return name.slice(-5) === 'Error' ? name : name + 'Error'
291292
}

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
{
22
"name": "http-errors",
33
"description": "Create HTTP error objects",
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"author": "Jonathan Ong <[email protected]> (http://jongleberry.com)",
66
"contributors": [
77
"Alan Plum <[email protected]>",
88
"Douglas Christopher Wilson <[email protected]>"
99
],
1010
"license": "MIT",
1111
"repository": "jshttp/http-errors",
12+
"funding": {
13+
"type": "opencollective",
14+
"url": "https://opencollective.com/express"
15+
},
1216
"dependencies": {
13-
"depd": "2.0.0",
14-
"inherits": "2.0.4",
15-
"setprototypeof": "1.2.0",
16-
"statuses": "2.0.1",
17-
"toidentifier": "1.0.1"
17+
"depd": "~2.0.0",
18+
"inherits": "~2.0.4",
19+
"setprototypeof": "~1.2.0",
20+
"statuses": "~2.0.2",
21+
"toidentifier": "~1.0.1"
1822
},
1923
"devDependencies": {
2024
"eslint": "7.32.0",
2125
"eslint-config-standard": "14.1.1",
22-
"eslint-plugin-import": "2.25.3",
26+
"eslint-plugin-import": "2.32.0",
2327
"eslint-plugin-markdown": "2.2.1",
2428
"eslint-plugin-node": "11.1.0",
2529
"eslint-plugin-promise": "5.2.0",
@@ -32,7 +36,7 @@
3236
},
3337
"scripts": {
3438
"lint": "eslint . && node ./scripts/lint-readme-list.js",
35-
"test": "mocha --reporter spec --bail",
39+
"test": "mocha --reporter spec",
3640
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
3741
"test-cov": "nyc --reporter=html --reporter=text npm test",
3842
"version": "node scripts/version-history.js && git add HISTORY.md"

0 commit comments

Comments
 (0)