Skip to content

feat: keep config of addons missing from composer (dev-only addons)#6541

Merged
gharlan merged 1 commit into
6.xfrom
addon-dev-only-lifecycle
Jun 1, 2026
Merged

feat: keep config of addons missing from composer (dev-only addons)#6541
gharlan merged 1 commit into
6.xfrom
addon-dev-only-lifecycle

Conversation

@gharlan
Copy link
Copy Markdown
Member

@gharlan gharlan commented Jun 1, 2026

Enables installing an addon as a composer require-dev dependency (so it only exists in local/dev installs) that cleanly survives a --no-dev production deploy: the addon's code is intentionally absent there, but its entry stays in the committed addons.json.

Today that scenario breaks: boot crashes on the missing addon, and even where it doesn't, the entry is silently dropped again on the next addon operation.

Changes

  • getAddonOrder() filters out addons that aren't currently available, so boot no longer throws Required addon "…" does not exist when addons.json lists an addon whose code is missing. The persisted order is left untouched, so it returns unchanged once the addon is available again.
  • saveConfig() now preserves config entries of addons that are configured but not currently loaded, instead of rebuilding the config solely from the loaded addons (which silently dropped a missing dev-only addon on every install/activate/…).
  • synchronizeWithFileSystem() only removes an addon that vanished from composer when running a dev install (a real composer remove); under --no-dev the entry is kept untouched. When a still-installed addon is removed, its name-reachable leftovers (assets, cache, config) are cleaned up and a warning is logged — its own uninstall hook can no longer run because its code is gone, so e.g. database changes must be undone by uninstalling before removing it via composer.
  • Dev mode is read from the install data set that actually contains redaxo/core, not InstalledVersions::getRootPackage() — the latter can be shadowed by a dependency that ships a scoped vendor with its own autoloader (e.g. rector returns rector/rector-src / dev=false).
  • The addons.json config is now always sorted (ksort centralised in saveAddonsData()), so the committed file stays stable across writers.

Supports addons installed as composer require-dev (present only locally) that
survive a `--no-dev` production deploy, where their code is intentionally absent
but their entry remains in the committed addons.json.

- getAddonOrder() filters out addons that are currently unavailable, so boot no
  longer crashes with "Required addon ... does not exist" when addons.json lists
  an addon whose code is missing. The stored order is left untouched.
- saveConfig() preserves config entries of addons that are configured but not
  currently loaded, instead of rebuilding the config solely from loaded addons
  (which silently dropped a missing dev-only addon on every install/activate).
- synchronizeWithFileSystem() only cleans up addons that vanished from composer
  when running a dev install (i.e. a real `composer remove`); under `--no-dev`
  the entry is kept untouched. When a still-installed addon is removed, its
  name-reachable leftovers (assets, cache, config) are cleaned up and a warning
  is logged, since its own uninstall hook can no longer run (its code is gone).
- Dev mode is read from the install data set that actually contains redaxo/core,
  not InstalledVersions::getRootPackage(), which a dependency's scoped vendor
  (e.g. rector) can shadow.
- The addons.json config is now always sorted (ksort centralised in
  saveAddonsData) so the committed file stays stable.
@gharlan gharlan added this to the REDAXO 6.0 milestone Jun 1, 2026
@rex-bot rex-bot added the feature Additional functionality label Jun 1, 2026
@gharlan gharlan merged commit ef7c111 into 6.x Jun 1, 2026
16 checks passed
@gharlan gharlan deleted the addon-dev-only-lifecycle branch June 1, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Additional functionality

Development

Successfully merging this pull request may close these issues.

2 participants