simondotm / nx-firebase

Firebase plugin for Nx Monorepos
https://www.npmjs.com/package/@simondotm/nx-firebase
MIT License
175 stars 31 forks source link

Having trouble creating a functions project #131

Closed DieTapete closed 10 months ago

DieTapete commented 11 months ago

Hi there, first of all thanks for creating this plugin! I have already set up firebase manually in my current nx project (let's call it nx-project) but now i want to add a functions project. Somehow i can't get it to work though.

I tried initiating a firebase project like this nx g @simondotm/nx-firebase:app firebase-app, which worked fine. Although I don't know if that is neccessary in my case. But when I then tried adding a functions project I get different error messages depending on what i tried: nx g @simondotm/nx-firebase:function fb_functions --app=nx-project => Cannot read properties of undefined (reading 'options') nx g @simondotm/nx-firebase:function fb_functions --app=firebase-app => The "path" argument must be of type string. Received null

Hope you can help me out here. I'm using nx 16.6.0 and nx-firebase 2.0.0-beta.1

lucastnr commented 11 months ago

Are you 100% sure that this firebase app was generated in the same version as the functions app?

DieTapete commented 11 months ago

I haven't updated any dependencies in between if that's what you're asking. However for now I helped myself by not using this plugin and integrating functions manually.

simondotm commented 10 months ago

ok thanks for reporting this, I'm hoping to get time to take a look at this over next couple of weeks.

its true that this plugin is really only adding value around scaffolding firebase function & app via the generators, and if anyone wants to just setup their Nx workspace manually using esbuild etc. its perfectly valid to do that.

for my own workflow uses, the real benefit from the plugin is in the sync generator to help manage the various configs when renaming or refactoring.

simondotm commented 10 months ago

@DieTapete I'm unfortunately not able to reproduce this. I created a 16.6.0 nx workspace and generated a firebase-app project, followed by:

simon@m1 testnx % npx nx g @simondotm/nx-firebase:function fb_functions --app=nx-project                                   

>  NX  Generating @simondotm/nx-firebase:function

 >  NX   A firebase application project called 'nx-project' was not found in this workspace.

   Pass --verbose to see the stacktrace.

simon@m1 testnx % npx nx g @simondotm/nx-firebase:function fb_functions --app=firebase-app

>  NX  Generating @simondotm/nx-firebase:function

UPDATE package.json
CREATE packages/fb-functions/src/assets/.gitkeep
CREATE packages/fb-functions/src/main.ts
CREATE packages/fb-functions/tsconfig.app.json
CREATE packages/fb-functions/tsconfig.json
CREATE packages/fb-functions/project.json
CREATE .eslintrc.json
CREATE .eslintignore
UPDATE nx.json
UPDATE .vscode/extensions.json
CREATE packages/fb-functions/.eslintrc.json
CREATE packages/fb-functions/jest.config.ts
CREATE packages/fb-functions/tsconfig.spec.json
CREATE packages/fb-functions/package.json
CREATE packages/fb-functions/readme.md
UPDATE packages/firebase-app/project.json
UPDATE firebase.json

I also made a PR with an update of the plugin to Nx 16.6.0 also, and all tests & e2e checks are passing. https://github.com/simondotm/nx-firebase/pull/135