最終更新:2023-06-23 (金) 14:45:48 (254d)  

Cloud Functions for Firebase/開発

https://firebase.google.com/docs/functions/get-started?hl=ja

コマンド

TypeScript

package.json

  • {
      "name": "functions",
      "scripts": {
        "build": "tsc",
        "build:watch": "tsc --watch",
        "serve": "npm run build && firebase emulators:start --only functions",
        "shell": "npm run build && firebase functions:shell",
        "start": "npm run shell",
        "deploy": "firebase deploy --only functions",
        "logs": "firebase functions:log"
      },
      "engines": {
        "node": "18"
      },
      "main": "lib/index.js",
      "dependencies": {
        "firebase-admin": "^11.8.0",
        "firebase-functions": "^4.3.1"
      },
      "devDependencies": {
        "typescript": "^4.9.0",
        "firebase-functions-test": "^3.1.0"
      },
      "private": true
    }

Cloud Functions/エミュレータ

デプロイ

  • firebase deployの実行時に、プロジェクトの index.ts が index.js にトランスパイルされます。

関連