Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/install-npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Install NPM
description: >
Installs the NPM version required by the `engines.npm` directive in
package.json, which is required for the project to build correctly.

runs:
using: composite
steps:
- name: Install NPM
shell: bash
run: |
npmVersion="$(node -p 'require(`${process.env.GITHUB_WORKSPACE}/package.json`).engines.npm')"
echo "Installing npm@${npmVersion}"
npm install -g "npm@${npmVersion}"
3 changes: 3 additions & 0 deletions .github/workflows/test-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
node-version: ">=24.18.1 <25"
cache: "npm"

- name: Install NPM version specified in package.json
uses: ./.github/actions/install-npm

- name: Install dependencies
run: npm ci --no-audit

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ const fetch = fetchWithDebug(

const res = await fetch(new URL("https://example.com"));
```

## Node & NPM

This project requires npm `>=12.0.2 <13` (enforced via `check-node-version` on
`npm install` and `npm ci`).

The check is skipped during `npm publish` and `npm pack`, because
`semantic-release` bundles its own npm (`@semantic-release/npm` depends on
`npm@^11.6.2`) and runs the publish with that version rather than the one
installed in CI.
177 changes: 177 additions & 0 deletions package-lock.json

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

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
},
"author": "Nordic Semiconductor ASA | nordicsemi.no",
"scripts": {
"test": "node --no-warnings --experimental-transform-types --test \"./*.spec.ts\""
"test": "node --no-warnings --experimental-transform-types --test \"./*.spec.ts\"",
"prepare": "case \"$npm_command\" in install|ci) check-node-version --package ;; esac"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepare script breaks Windows

Medium Severity

The new prepare script uses POSIX case/esac syntax. On Windows, npm runs lifecycle scripts with cmd.exe by default, which does not understand that syntax, so npm install and npm ci fail when prepare runs.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7ab1f8f. Configure here.

},
"license": "BSD-3-Clause",
"type": "module",
"main": "export.ts",
"devDependencies": {
"@bifravst/prettier-config": "1.1.17",
"check-node-version": "4.2.1",
"nock": "14.0.17",
"prettier": "3.9.6"
},
Expand All @@ -33,5 +35,8 @@
"@semantic-release/release-notes-generator",
"@sebbo2002/semantic-release-jsr"
]
},
"engines": {
"npm": ">=12.0.2 <13"
}
}