Skip to content

Commit

Permalink
Require hosting deploy targets to be in the project's firebase.json (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmburke committed Oct 15, 2020
1 parent 8853195 commit d6afe60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- Updates Cloud Functions for Firebase templates to better support function development.
- Release Firestore emulator v1.11.9: Fixes != and not-in operators.
- Add endpoints to enable/disable background triggers in the Cloud Functions emulator.
- Fixes `TypeError` that arises when trying to deploy with Firebase Hosting targets that don't exist in the project's firebase.json (#1232).
8 changes: 8 additions & 0 deletions src/hosting/normalizedHostingConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ function filterOnly(configs: HostingConfig[], onlyString: string): HostingConfig
return configs;
}

// Strip out Hosting deploy targets from onlyTarget
onlyTargets = onlyTargets
.filter((target) => target.startsWith("hosting:"))
.map((target) => target.replace("hosting:", ""));

// Check to see that all the hosting deploy targets exist in the hosting config
onlyTargets.forEach((onlyTarget) => {
if (!configs.some((config) => config.target === onlyTarget)) {
throw new FirebaseError(`Hosting target ${bold(onlyTarget)} not detected in firebase.json`);
}
});

return configs.filter((config: HostingConfig) =>
onlyTargets.includes(config.target || config.site)
);
Expand Down

0 comments on commit d6afe60

Please sign in to comment.