vscode-firebase-explorer
vscode-firebase-explorer copied to clipboard
Deploying a site to Firebase Hosting using the IDE
I think this extension has great promise, so I propose an addition to the current Firebase Hosting functionality: a button that allows for easy deployment of an open folder to Firebase Hosting. The new functionality would:
- Check if the user is signed in and launch a sign-in flow if it isn't
- Check if the currently opened folder has been initialized with Firebase Hosting
- Use the Firebase Hosting REST API to upload the files
- Show the result with a link to the deployed site when finished (or error)
What do you think, @jsayol? Is this outside the scope of the project, or is it a worthwhile feature?
Thanks @TheCraftKid, that's a great idea :)
This is something I've wanted to add to the extension and I thought about it a few days ago, but I couldn't come up with a good way to integrate it.
Options
There's several options when it comes to implementing this, and they all have some trade-offs.
As a global command
It would add a command named "Deploy current project to Firebase Hosting", which would be triggered from the command palette. Some issues:
- The command is quite hidden. Users would either need to know it's there or would need to stumble upon it by chance. I don't think many people would end up using it this way.
- What happens if there's more than one open workspace folders? Could probably show a quickpick to select which one to deploy.
- What happens if the open/selected folder hasn't been initialized as a Firebase project? That is, if there's no
.firebaserc
andfirebase.json
files. The easiest option here is to simply show an error saying to initialize it using the CLI. Another option would be to replicate the wholefirebase init
functionality (the extension doesn't depend onfirebase-tools
), but I'd rather not.
As a right-click context menu on a folder
When right-clicking on a folder in the open workspace, it would show an entry saying "Deploy this folder to Firebase Hosting". Some issues:
- Allowing to deploy any random folder is a bad idea. When creating a new release with the files int hat folder, all the files currently deployed would be removed from the Hosting site. (It is technically possible to maintain the currently-deployed files and just add new ones, but it would complicate things.)
- To which project should this be deployed? Should we go up the path until we find an initialized Firebase project? should we ask the user to choose one of their projects?
As a right-click context menu anywhere on the list of files
Similar to the previous one, but it would only work if the root of the workspace folder is an initialized Firebase project (it has .firebaserc
and firebase.json
files). It would deploy the public folder specified in firebase.json
to the default project specified in .firebaserc
. It would basically do the same as running firebase deploy --only hosting
from that folder.
Other considerations
- If the project has more that one Hosting site (available to paying plans), should we deploy to the default one like the CLI does, or should we ask the user to choose one?