Skip to content

Pin the Heroku build's NodeJS version to what the app requires - #674

Merged
tricknotes merged 1 commit into
mainfrom
heroku-generator-node-engines
Sep 7, 2026
Merged

Pin the Heroku build's NodeJS version to what the app requires#674
tricknotes merged 1 commit into
mainfrom
heroku-generator-node-engines

Conversation

@tricknotes

@tricknotes tricknotes commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to #670, which documented this requirement. This makes the generator satisfy it.

Why

The package.json generated for Heroku carried only cacheDirectories. Heroku's NodeJS buildpack reads that file — the project root's, not the Ember application's — to decide which NodeJS to build with, and falls back to the current LTS release when it names no engines.node.

The requirement belongs to the Ember application: the ember-cli >= 6.8 blueprint needs NodeJS >= 20.19.0 (ember-new-output v7.0.0). Nothing carried that up to the file Heroku actually consults, so rake ember:compile could run on a NodeJS the application rejects.

What changed

  • EmberCli::PathSet#package_json — the Ember application's package.json.
  • EmberCli::App#node_engine — its engines.node, or nil when the file is missing or unreadable. The callers ask in order to describe the application to a build host, and a project without a readable package.json is still deployable, so it answers nil rather than raising.
  • HerokuGenerator reads engines.node from each configured application and writes the one they agree on into the generated package.json.

Applications that disagree are reported through say_status and left unpinned rather than resolved: one build serves all of them, and picking a single answer would pin the build to a version the others reject.

Verification

$ bin/rspec spec/lib spec/generators
148 examples, 1 failure

The one failure is EmberCli::App#test exits with exit status of 0, which fails on main in this container too — ember test reports Launcher Chrome not found, unrelated to this change.

New coverage:

  • App#node_engine — declared, absent engines, missing file, malformed JSON.
  • The generator's engines key — applications agreeing, none declaring, applications disagreeing.

Also confirmed end-to-end against the installed dummy application: EmberCli["my-app"].node_engine returns ">= 20.19.0".

Rebased onto #673

This branch was rebased after #673 merged. Besides the CHANGELOG.md conflict, the generator spec's instance_double(EmberCli::App, …) still stubbed yarn_enabled?, which #673 removed — three examples failed until it was updated to yarn?. Git could not see that one.

🤖 Generated with Claude Code

https://claude.ai/code/session_014rAfkAVGVifbaEoTVeT66u

@tricknotes
tricknotes force-pushed the heroku-generator-node-engines branch from 3c49549 to bd634c5 Compare September 7, 2026 12:21
@tricknotes
tricknotes marked this pull request as ready for review September 7, 2026 12:24
The `package.json` generated for Heroku carried only `cacheDirectories`.
Heroku's NodeJS buildpack reads that file — the project root's, not the Ember
application's — to decide which NodeJS to build with,
and falls back to the current LTS release when it names no `engines.node`.

The requirement belongs to the Ember application:
the `ember-cli >= 6.8` blueprint needs NodeJS `>= 20.19.0`,
and nothing carried that up to the file Heroku actually consults,
so `rake ember:compile` could run on a NodeJS the application rejects.

Read `engines.node` from each configured application and write the one they
agree on. Applications that disagree are reported and left unpinned rather
than resolved: one build serves all of them, and picking a single answer would
pin the build to a version the others reject.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rAfkAVGVifbaEoTVeT66u
@tricknotes
tricknotes force-pushed the heroku-generator-node-engines branch from bd634c5 to b582714 Compare September 7, 2026 12:29
@tricknotes
tricknotes merged commit 8b1de2b into main Sep 7, 2026
12 checks passed
@tricknotes
tricknotes deleted the heroku-generator-node-engines branch September 7, 2026 12:32
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