Skip to content

fix(packaging): declare engines.node on published packages — Node 16 installs then fails on global fetch - #973

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
Larslllllll:fix/publish-engines-node
Aug 19, 2026
Merged

fix(packaging): declare engines.node on published packages — Node 16 installs then fails on global fetch#973
ralyodio merged 1 commit into
profullstack:masterfrom
Larslllllll:fix/publish-engines-node

Conversation

@Larslllllll

Copy link
Copy Markdown
Contributor

Follow-up to #972, as offered there.

Problem

The three published packages declare no engines field:

package engines
@profullstack/sh1pt (none)
@profullstack/sh1pt-core (none)
@profullstack/sh1pt-policy (none)

The CLI relies on global fetch, which Node only exposes from v18:

  • packages/cli/src/commands/login.ts/api/v1/cli/pair, /api/v1/cli/claim
  • packages/cli/src/commands/build.ts — HEAD/GET probes
  • packages/cli/src/cloud-vault.tsauthedFetch
  • packages/core/src/setup-helpers.ts — OAuth token exchange

Without engines, npm and pnpm cannot warn. A user on Node 16 gets a clean install and then
ReferenceError: fetch is not defined on first run — an error that points at nothing actionable.

Fix

Declare "engines": { "node": ">=20" } on the three published packages.

Why >=20 rather than >=18 or >=22:

  • >=18 is the bare functional floor (global fetch) but Node 18 is out of maintenance.
  • >=20 is the oldest maintained LTS with global fetch, and matches the ES2022 output target.
  • mise.toml pins Node 22 and the workflows run 22 (threatcrush-scan uses 20), so every
    environment the project already builds and tests in satisfies >=20.

Happy to change it to >=22 so the declared floor matches mise.toml exactly — one-line edit,
just say which you prefer.

Scope

Three package.json files, additive only. The private root package is untouched. No source,
dependency, or build changes. Existing key order and formatting preserved.

`@profullstack/sh1pt`, `-core` and `-policy` publish to npm without an `engines` field, but
the CLI depends on global `fetch` (login.ts, build.ts, cloud-vault.ts, core/setup-helpers.ts),
which Node only exposes from v18. A user on Node 16 installs cleanly and then hits
`ReferenceError: fetch is not defined` at first run instead of an install-time engine warning.

Declares `"engines": { "node": ">=20" }` — Node 20 is the oldest maintained LTS that has
global fetch and covers the ES2022 output target. mise.toml pins 22 and CI runs 22 (threatcrush
uses 20), so >=20 is satisfied by every environment the project already builds and tests in.
Tighten to >=22 if you prefer the declared floor to match mise exactly.

Only the three published packages are touched; the private root is unchanged.
@ralyodio
ralyodio merged commit f53e590 into profullstack:master Aug 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants