diff --git a/README.md b/README.md index f75728c..a1515c6 100644 --- a/README.md +++ b/README.md @@ -76,11 +76,6 @@ Since v3.1.0, the sub-command `tag` identifies the version inside the commit mes The above command reads from the latest three commits (by default, change with the `-n` flag.) -## Important note for Node.js 18 +## Node.js -When running the CLI commands on Node.js 18, you may need to add the `--no-experimental-fetch` flag to the `NODE_OPTIONS` environment variable. This flag is required to disable the experimental fetch feature introduced in Node.js 18. - -To execute the CLI commands with the `--no-experimental-fetch` flag, use the following syntax: - -```shell -% NODE_OPTIONS=--no-experimental-fetch npx @eqworks/release \ No newline at end of file +Current Node.js releases can run the CLI directly. Commit classification loads a local WebAssembly model from disk, so `NODE_OPTIONS=--no-experimental-fetch` is not required. That flag is invalid on Node.js 22 and later. diff --git a/lib/utils.js b/lib/utils.js index 97870b6..021fd61 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -3,6 +3,14 @@ const { execSync } = require('child_process') const { Octokit } = require('@octokit/core') const chalk = require('chalk') + +/* global WebAssembly */ +// fasttext.js streams its wasm with fetch() when WebAssembly.instantiateStreaming +// exists. Node 22+ fetch rejects a filesystem path and aborts the process. +// Dropping streaming makes Emscripten read the wasm file from disk. +if (typeof WebAssembly !== 'undefined' && typeof WebAssembly.instantiateStreaming === 'function') { + delete WebAssembly.instantiateStreaming +} const FastText = require('fasttext.js') const { GITHUB_TOKEN } = process.env diff --git a/package.json b/package.json index b284ece..028667e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eqworks/release", - "version": "3.5.3", + "version": "3.5.4", "main": "index.js", "license": "MIT", "source": "index.js",