Files
webstudio/packages/cli/templates/defaults/package.json
Oleg Isonen e4983b0d1d fix: Report unsupported Node versions (#6058)
Closes #6057

## Outcome

Generated projects now reject Node.js versions older than 22.12 before
React Router, Remix, or Vite evaluates SDK components. Users see the
package-manager engine error with the current and required versions
instead of the indirect `sanitize-html` / `htmlparser2`
`ERR_REQUIRE_ESM` stack trace.

## Root cause

`sanitize-html@2.17.6` synchronously loads the ESM-only
`htmlparser2@12`. That dependency combination relies on synchronous
`require(ESM)` support, which Node.js enabled by default in 22.12.
Generated projects incorrectly declared the broader `>=22` range,
allowing an unsupported runtime to reach SSR evaluation.

## Implementation

- Set the CLI and all generated base templates to `engines.node:
>=22.12.0`.
- Add npm `devEngines.runtime` with `onFail: error`, which runs before
install, CI, and run commands.
- Enable `engine-strict` in generated npm configuration so pnpm also
rejects an unsupported runtime.
- Regenerate every tracked CLI fixture package manifest.
- Update CLI documentation and the release-smoke manifest contract.
- Remove the earlier sanitizer-bundling workaround from the branch;
sanitizer code and packaging are unchanged from `main`.

## Checklist

- [x] Declare the exact Node.js compatibility floor
- [x] Fail before generated development, build, and start commands
- [x] Cover the generated engine contract with a fail/pass regression
- [x] Regenerate and inspect all affected fixtures
- [x] Review documentation impact and update the CLI guide
- [x] Keep sanitizer behavior and SDK packaging unchanged

## Verification

- Regression demonstrated failing before the template metadata change
and passing afterward
- `pnpm --filter webstudio test` — 946 passed
- `pnpm --filter webstudio typecheck`
- `pnpm --filter webstudio build`
- `pnpm fixtures`
- `pnpm lint`
- `pnpm exec oxfmt --check` on changed source, template, fixture, and
documentation files
- `git diff --check`

Agent evaluations were not run because they require separate approval.
2026-08-09 01:53:31 +02:00

47 lines
1.3 KiB
JSON

{
"type": "module",
"private": true,
"sideEffects": false,
"scripts": {
"build": "remix vite:build",
"dev": "remix vite:dev",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@shikijs/langs": "4.4.1",
"@shikijs/themes": "4.4.1",
"@remix-run/node": "2.16.5",
"@remix-run/react": "2.16.5",
"@remix-run/server-runtime": "2.16.5",
"@webstudio-is/image": "0.0.0-webstudio-version",
"@webstudio-is/react-sdk": "0.0.0-webstudio-version",
"@webstudio-is/sdk": "0.0.0-webstudio-version",
"@webstudio-is/sdk-components-react": "0.0.0-webstudio-version",
"@webstudio-is/sdk-components-animation": "0.0.0-webstudio-version",
"@webstudio-is/sdk-components-react-radix": "0.0.0-webstudio-version",
"@webstudio-is/sdk-components-react-remix": "0.0.0-webstudio-version",
"@webstudio-is/wsauth": "0.0.0-webstudio-version",
"isbot": "^5.1.25",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"shiki": "4.4.1"
},
"devDependencies": {
"@remix-run/dev": "2.16.5",
"@types/react": "^18.2.70",
"@types/react-dom": "^18.2.25",
"typescript": "7.0.2",
"vite": "^6.3.4"
},
"engines": {
"node": ">=22.12.0"
},
"devEngines": {
"runtime": {
"name": "node",
"version": ">=22.12.0",
"onFail": "error"
}
}
}