firebase-tools
firebase-tools copied to clipboard
`firebase target:apply firestore` does not currently work
firebase target:apply firestore does not currently work.
However firebase target:remove firestore does currently work.
This is a request to get firebase target:apply firestore working.
At the moment we have to add firestore targets to .firebaserc manually.
This is a script we are using as a workaround, for anyone having the same issue:
import { writeFileSync, readFileSync } from "node:fs"
import { join } from "node:path"
const FB_PROJECT = ""
const DATABASE_ID = ""
const TARGET = ""
const firebasercPath = join(process.cwd(), ".firebaserc")
const firebaserc = JSON.parse(readFileSync(firebasercPath, "utf8"))
firebaserc.targets[FB_PROJECT].firestore[TARGET] ||= []
firebaserc.targets[FB_PROJECT].firestore[TARGET].push(DATABASE_ID)
writeFileSync(firebasercPath, JSON.stringify(firebaserc, null, 2), "utf8")