Skip to content

Code to create emulators.yaml uses backend root not project root #8412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

inlined
Copy link
Member

@inlined inlined commented Apr 8, 2025

Quicker fix than I realized.

We may want to re-add some of the previous behavior to detect multiple environments and determine which to use as the base config. I was more focused on making breaking changes before the major release, but that was interesting/useful, esp if people only have apphosting[.environment].yaml and not a generic apphosting.yaml.

That might require more though though as we may want to consolidate backendRoot/apphosting.mybackend.yaml and /apphosting.yaml for mult-backend setups.

@inlined inlined requested review from joehan, mathu97 and annajowang April 8, 2025 06:41
@inlined
Copy link
Member Author

inlined commented Apr 8, 2025

NOTE: This PR is part of my chain for debugging cursor glitches, but if approved, I'll probably rebase onto next directly, commit there, and then re-pull it into inlined.inquirer.

@inlined inlined force-pushed the inlined.emulator-init-fix branch from d46c95f to f1292ad Compare April 8, 2025 17:06
@inlined inlined changed the base branch from inlined.inquirer to next April 8, 2025 17:06
@@ -0,0 +1 @@
fix: Prompt to create apphosting.emulator.yaml works with backends that are not at the project.root (#8412)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fix: Prompt to create apphosting.emulator.yaml works with backends that are not at the project.root (#8412)
- Fixed an issue where the prompt to create apphosting.emulator.yaml did not work with backends that are not at the project.root (#8412)

Clean up to match our usual style.

): Promise<Env[] | null> {
// Even if the app is in /project/app, the user might have their apphosting.yaml file in /project/apphosting.yaml.
// Walk up the tree to see if we find other local files so that we can put apphosting.emulator.yaml in the right place.
const basePath = dynamicDispatch.discoverBackendRoot(repoRoot) || repoRoot;
const basePath = dynamicDispatch.discoverBackendRoot(backendRoot) || backendRoot;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const basePath = dynamicDispatch.discoverBackendRoot(backendRoot) || backendRoot;
const basePath = dynamicDispatch.discoverBackendRoot(backendRoot) ?? backendRoot;

Nit: IIUC, ?? is preferred over || for undefined fallbacks

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.

4 participants