Skip to content

feat: let AIO_RELOAD_ENV_ON_PRE_HOOKS take a list of hooks - #947

Open
iivvaannxx wants to merge 1 commit into
adobe:masterfrom
iivvaannxx:aio-env-hook-list
Open

iivvaannxx wants to merge 1 commit into
adobe:masterfrom
iivvaannxx:aio-env-hook-list

Conversation

@iivvaannxx

Copy link
Copy Markdown
Contributor

Summary

AIO_RELOAD_ENV_ON_PRE_HOOKS accepts a comma-separated list of hook names. reloadEnvOnPreHooks now receives the name of the hook that just ran, and one helper decides if the variable applies to it.

AIO_RELOAD_ENV_ON_PRE_HOOKS=<value>
  unset, '', 0, false           off
  pre-app-build,pre-app-deploy  reload only after the listed hooks
  anything else (1, true, ...)  reload after every pre hook, same as today
 reloadEnvOnPreHooks
-  if (variable is on) aioConfig.reload()
+  if (isEnvEnabledForHook('AIO_RELOAD_ENV_ON_PRE_HOOKS', hookName)) aioConfig.reload()

Call sites in build.js, deploy.js, run.js, undeploy.js, lib/build-actions.js and lib/deploy-actions.js pass their hook name. isEnvEnabledForHook is exported from app-helper.js so other variables can use the same list syntax.

Evidence

  • Before: the variable is all or nothing. AIO_RELOAD_ENV_ON_PRE_HOOKS=pre-app-build reloads after every pre hook.
    After: it reloads only after pre-app-build. The helper tests cover off, all, list, a mixed value, and case and spaces. Each command and lib test now also asserts the hook name passed. npm test and eslint pass.

Merge Danger

Door: two-way

Blast Radius: env var parsing

A value that contains a known hook name now selects only those hooks. Before, any value other than empty, 0 or false meant all. Someone who set the variable to a hook name by accident gets less reloading than before. 1, true and any value with no known hook name behave as before.

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant