firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 943 forks source link

`firebase target:apply firestore` does not currently work #7623

Open bigjimhere opened 2 months ago

bigjimhere commented 2 months ago

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.

bigjimhere commented 1 month ago

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")