Closed Schmale97 closed 10 months ago
Hi @Schmale97 , thanks for your PR. It's great to have submissions & experiementations, and I can see how such solutions might be useful for customising a specific workflow/workspace, but for a generic plugin like this one, I'm not sure it adds value over what we already have:
firebase
target in v2 plugin app generator, which provides much of the functionality of your cli
executor, so you can already just run npx nx my-project:firebase <firebase cli options>
killports
target that forcefully cleans up the emulator processes The copy-local-files
executor you have is an interesting workaround, but I believe we can achieve the same outcome by modifying the .nxignore
files with exclusion rules and add local secret files to the build executor assets
array - I just havent had time to investigate this better.
For your custom NX_REACT_APP_STORAGE_EMULATOR
type env vars, I can see why you took that approach. For me, I have added an environment.dev.ts
file to my FE project (Angular in my case), and set the appropriate emulator client app vars from that. eg.
providers: [
{
provide: AUTH_EMULATOR,
useValue: environment.localEmulation ? ['http://localhost:9099'] : undefined,
},
{
provide: FIRESTORE_EMULATOR,
useValue: environment.localEmulation ? ['localhost', 8080] : undefined,
},
{
provide: DATABASE_EMULATOR, // i.e., Realtime Database
useValue: environment.localEmulation ? ['localhost', 9000] : undefined,
},
{
provide: FUNCTIONS_EMULATOR,
useValue: environment.localEmulation ? ['http://localhost', 5001] : undefined,
},
],
I'm going to close this PR for now, but I welcome & will review future contributions.
This is a PR with some suggestions for some executors to improve firebase's cli within nx. I have these changes currently as a workspace plugin that I have been playing around with and noticed a few issues pop-up which I think these executors help to fix ( #92 and #40 ). I have copied the local plugin into these repo quickly to gauge interest in including these in this plugin.
There are 3 executors:
cli: the way to interact with the firebase cli-tool - has been written to be similar to the firebase-tools when using in the terminal but with some tweaks to improve how it can be used in the project.json
kill-emulator: kills all the process running on the ports defined in the defined firebase.*.json
copy-local-files: used for handling .gitignored env files, namely .env.local and .secret.local
My project stucture is:
The project.json I have in the functions folder is
and the project json I have for the firebase folder is:
I have shared these jsons just to demonstrate how I am using the executors in the pr.
Again, this is just what I have found to be useful so far and am still working through a few things:
Let me know what you think