I m curious has anyone …

3 minute read

I’m curious, has anyone seen any third party schematics for Firebase ?

Responses:

The way firebase development is setup with the firebase-tools doesn’t really jive that great with how an nx repo is generally organized.

This might help https://github.com/nrwl/nx/issues/2152#issuecomment-621648054

I have ran firebase functions as a Node app in an Nx workspace and got it working quite well…

It’s a private repo that I can’t share, but at some point I will great a schematic and add it to nxpm.

running just the functions probably wouldn’t be that difficult. I’m more thinking about being able to run nx serve my-firebase-app and having it run firebase serve essentially. Also being able to set multiple configurations so you could start the firebase emulators automatically with that command too would be sweet.

"serve": { "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ { "command": "nx build functions --watch" }, { "command": "firebase serve --only functions" } ], "parallel": true } },

This is what I used to run firebase serve, it might help with getting the workflow you desire :)

yeah, that might be a good first step, just using the run-commands schematic. Ideally I’d like a full blown schematic so it would be more repeatable to have multiple firebase apps in an Nx repo, and not have to copy paste the run-commands config.

Yep, that would really help. If I have some time I’ll pull out the code I used and make it a schematic

I wonder what the best way to reach out to the firebase team is, and see if this is something on their radar at all or not. The union of people using firebase and nx is probably pretty small

Firebase will probably respond with: that’s a great opportunity for a community project. Similar to Nrwl’s response

With that being said, if you want to find out… I’d probably shoot David a message on Twitter: https://twitter.com/_davideast

I started working on a schematic for it yesterday, but I’m a little concerned that i’d be reimplementing some of the things firebase init already does, and if anything about firebase-tools were to change the schematic would break. Not something I, personally, feel like being tied to

I think there is little opportunity for re-use as firebase init is not built on Schematics (afaik). So you’d be either re-implementing it in schematics, or maybe you can look into calling firebase init but I think that can be difficult because of the virtual fs in Schematics

yeah, that was my assumption as well. just calling firebase init would be a non starter I would assume, which only leaves reimplementing something extremely similar to what is already provided by firebase init, but in a schematic instead

and that is prone to breakage obviously

Yep, that’s probably the trade-off

However, I’ve been working with Firebase functions for maybe about 1.5 years now, I don’t think there were any drastic changes

It’s picky about it’s node versions, but that’s quite a constant

it seems like the kind of schematic that would be best supported officially by the firebase team, or by an organization that at least has some access to upcoming changes that the firebase team might implement, so they can be prepared for them prior to their release

but it’s also something I just really want personally, so I have a hankering to just hack it together :slightly_smiling_face:

Yeah man, just go make it :slightly_smiling_face:

Also, if you start with what you just need, and don’t try to be feature complete at front, there is little surface that can get outdated

As I imagine you’re not using everything firebase init has to offer?

I’m currently just using hosting, functions and firestore

leaving hosting behind wouldn’t be that big of a deal though if I wanted to drop something

Also, this might be helpful https://github.com/angular/angularfire/tree/master/src/schematics

I could also just use GCP I suppose

and not deal with the firebase project at all

thanks for all the info

Updated: