How do I switch apps from the firebase cli?

后端 未结 8 686
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-23 09:12

This seems like something which should be pretty easy to do, but for whatever reason, I\'m being defeated.

I\'m trying to use the firebase-tools CLI to interact with

8条回答
  •  忘掉有多难
    2020-12-23 09:16

    I rather use scripts. Consider a project structure like this:

    your-project
    ├── .firebaserc
    └── functions
       ├── package.json
       └── index.js
    

    Go to .firebaserc and follow the next example

    {
      "projects": {
        "default": "project-name",
        "prod": "other-name"
      }
    }
    

    Then go to package.json and add the following scripts (changeToProd, and changeToDev).

    {
      ...
      "scripts": {
        ...
        "changeToProd": "firebase use prod",
        "changeToDev": "firebase use default"
      },
      "dependencies": {
        ...
      },
      ...
    }
    

    If your IDE support npm scripts you can run them using the IDE UI, otherwise it can be run using the command console. Make sure you are inside the functions folder.

    npm run-script changeToProd
    

    You can verify your current project by running the following command from the terminal or added to the scripts as we just did

    firebase use
    

提交回复
热议问题