Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to monitor changes like "nodemon" for Firebase command line?

Is there any way to get the Firebase command line to simply refresh the server as I am applying changes to code similar to what nodemon does for nodeJS? I'm working with Polymer for web.

like image 991
TheeBen Avatar asked Mar 27 '17 17:03

TheeBen


3 Answers

adding to @grigson, you can also use the exec flag to run a package.json script eg:

nodemon -e ts --exec "npm run serve"

where serve is the command in your functions package.json (ie.

{
  "name": "functions",
  "scripts": {
     ...
     "serve": "npm run build && firebase serve --only functions",
     ...
}

By running this, nodemon will also run build before serve. The -e flag tells nodemon to watch for changes in files with a .ts extension.

like image 170
M.Lewis Avatar answered Sep 30 '22 17:09

M.Lewis


I'm using nodemon with firebase cloud function, as [email protected] (current)

firebase serve --only functions detects changes only in index.js

this can be handled with nodemon --exec flag

nodemon --exec firebase serve --only functions

like image 39
grigson Avatar answered Sep 30 '22 18:09

grigson


This is not currently a feature of the Firebase CLI, but it sounds like something that would be useful. Please file a feature request.

like image 33
Frank van Puffelen Avatar answered Sep 30 '22 18:09

Frank van Puffelen