simondotm / nx-firebase

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

Cannot find module '@nrwl/workspace/src/utilities/assets' #7

Closed maxfriedmann closed 3 years ago

maxfriedmann commented 3 years ago

This plugin looks very promising. I followed the quick steps and ran into

> nx run functions:build 
Cannot find module '@nrwl/workspace/src/utilities/assets'
Require stack:
- {PROJECT_ROOT}/node_modules/@simondotm/nxfirebase/src/executors/build/build.js
- {PROJECT_ROOT}/node_modules/@nrwl/tao/src/shared/workspace.js
- {PROJECT_ROOT}/node_modules/@nrwl/tao/src/commands/run.js
- {PROJECT_ROOT}/node_modules/@nrwl/tao/index.js
- {PROJECT_ROOT}/node_modules/@nrwl/cli/lib/run-cli.js

Am using nx 12.0.8 and v0.2.2 of your plugin.

I figured out that your plugin at least needs nx 12.3.x, so after upgrading all worked fine. Maybe its worth mentioning the Nx version or maybe there's a way to disallow using it before nx version 12.3?

I also had to add import "firebase-admin"; to your example "Hello Logs" function, otherwise the npm package did not get written into the functions package.json which results in an error during the function load: Detailed stack trace: Error: Cannot find module 'firebase-admin'

simondotm commented 3 years ago

Hi Max, thanks for reporting this, I built the plugin against 12.1.1 but the Nx team are moving fast with releases! A minimum Nx version check sounds like a good idea. The firebase admin dep is interesting though, as my e2e test deployed fine without it, so I'll look into that.

simondotm commented 3 years ago

v0.2.3 now released against Nx version 12.3.4 I've updated the template index.ts to import firebase-admin as a dependency which fixes the deployment issue. I've also added peer dependencies to the package which will hopefully advertise Nx version compatibility for the plugin.

simondotm commented 3 years ago

@maxfriedmann - Please note project has now been renamed to @simondotm/nx-firebase, see here for the new 0.3.0 release.