Skip to content

recommend apphosting for webframeworks on init hosting#9887

Open
leoortizz wants to merge 4 commits intojh-remove-wffrom
leoortizz_remove-wfinit
Open

recommend apphosting for webframeworks on init hosting#9887
leoortizz wants to merge 4 commits intojh-remove-wffrom
leoortizz_remove-wfinit

Conversation

@leoortizz
Copy link
Member

When running firebase init hosting, run framework detection. If a Node.js webframework is found, terminate the flow with an error directing users to run firebase init apphosting instead. Skip Flutter as it's not Node.js.

Based on the following comments from #9843:

Description

Scenarios Tested

firebase init hosting in a webframework project

Sample Commands

firebase init hosting

When running `firebase init hosting`, run framework detection. If a Node.js webframework is found, terminate the flow with an error directing users to run
`firebase init apphosting` instead.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @leoortizz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the firebase init hosting command by introducing intelligent web framework detection. Its primary goal is to guide users who are working with Node.js web frameworks, which often require server-side rendering capabilities, towards the more suitable firebase init apphosting command. This prevents potential misconfigurations and ensures users are directed to the correct Firebase service for their project type, improving the initial setup experience.

Highlights

  • Web Framework Detection: The firebase init hosting command now includes logic to detect common Node.js web frameworks in the project directory.
  • App Hosting Recommendation: If a Node.js web framework (excluding Flutter) is detected, the firebase init hosting process will terminate and recommend the user to run firebase init apphosting instead, as traditional Firebase Hosting is primarily for static sites.
  • Concurrent Detection: Framework detection runs concurrently with other initialization steps to minimize impact on user experience.
  • Unit Tests: New unit tests have been added to verify the correct behavior of framework detection, ensuring the recommendation is given when appropriate and the flow continues normally when no such framework is found.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/init/features/hosting/index.spec.ts
    • Added import for the frameworks module to enable testing of framework detection.
    • Introduced stubs for frameworks.discover in existing tests to isolate them from the new detection logic.
    • Added a new test case to confirm that firebase init hosting correctly recommends firebase init apphosting and throws an error when a Node.js framework is detected.
    • Added a new test case to ensure the firebase init hosting flow proceeds normally when no web framework is detected.
  • src/init/features/hosting/index.ts
    • Imported discover and WebFrameworks from the frameworks module.
    • Implemented concurrent execution of framework detection using discover at the start of the askQuestions function.
    • Added conditional logic to check the result of the framework discovery.
    • If a non-Flutter web framework is identified, the command now logs informative messages to the console and throws a FirebaseError, prompting the user to use firebase init apphosting.
Activity
  • The author, leoortizz, initiated this pull request to implement a feature based on community feedback and discussions from a previous pull request (Removing webframeworks questions from init hosting #9843).
  • The changes introduce new logic for detecting web frameworks during the firebase init hosting process.
  • New unit tests have been added to validate the framework detection and recommendation behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the logic to guide users with web frameworks towards App Hosting during firebase init hosting. The changes are well-contained and include tests for the new behavior. I have a couple of suggestions to improve the robustness of the implementation and enhance test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant