T M
T M

Reputation: 530

Cloud Functions for Firebase: Project structure multiple self-contained functions

I am trying to create a project structure similar to the following:

--firebase-admin-project
  --firebase.json
  --functions
    --anonymous-login
      --node_modules
      --index.js
      --package.json
    --auth-login
      --node_modules
      --index.js
      --package.json

The intention is to do "firebase deploy --only functions" in either the anonymous-login or auth-login folders but the deployment fails.

Currently, "firebase init functions" creates new index.js and package.json files in the functions folder, which is not what I want.

Also, we want to avoid using require to pull all functions into one index.js file.

Upvotes: 4

Views: 2431

Answers (2)

Doug Stevenson
Doug Stevenson

Reputation: 317467

When you run firebase deploy, it will deploy every function in your project and all files under the functions directory. There is currently no way to select anything less than the entire thing.

Update: There is a new feature in the CLI that allows for individual functions and groups of functions to be deployed independently. The documentation for that is in the partial deploys section of the docs.

Upvotes: 2

Arun Shankar
Arun Shankar

Reputation: 2295

firebase deploy --only functions:<any function>

Firebase has started allowing developers to deploy specific functions as well

Upvotes: 4

Related Questions