diff --git a/src/deploy/lifecycleHooks.ts b/src/deploy/lifecycleHooks.ts index 0c08e09a8cb..d87d0b8d102 100644 --- a/src/deploy/lifecycleHooks.ts +++ b/src/deploy/lifecycleHooks.ts @@ -139,9 +139,20 @@ function getReleventConfigs(target: string, options: Options) { return individualOnly.replace(`${target}:`, ""); }); - return targetConfigs.filter((config: any) => { + // If config specifies a target, only include it if it's in the only list + targetConfigs = targetConfigs.filter((config) => { return !config.target || onlyTargets.includes(config.target); }); + // If config specifies a codebase, only include it if it's in the only list + targetConfigs = targetConfigs.filter((config) => { + if (!config.codebase) return true; + + return onlyTargets.some( + (individualOnly) => + individualOnly.indexOf(":") === -1 || + config.codebase === individualOnly.split(":")[0] + ); + }); } export function lifecycleHooks(