Command-Line Interface for Firebase that provides deployment, testing, and management functionality for Firebase projects.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Firebase CLI target management for configuring deployment targets and resource mappings in complex project setups.
Manage deployment targets and resource mappings.
/**
* Display current deployment target configuration
* @param options - Configuration options
* @returns Promise resolving when target display completes
*/
function target(options?: Options): Promise<void>;
/**
* Apply a deployment target configuration
* @param type - Target type (hosting, storage, database, etc.)
* @param target - Target name
* @param resource - Resource identifier
* @param options - Configuration options
* @returns Promise resolving when target is applied
*/
function targetApply(
type: string,
target: string,
resource: string,
options?: Options
): Promise<void>;
/**
* Clear deployment target configuration
* @param type - Target type to clear
* @param target - Target name to clear
* @param options - Configuration options
* @returns Promise resolving when target is cleared
*/
function targetClear(
type: string,
target: string,
options?: Options
): Promise<void>;
/**
* Remove a deployment target configuration
* @param type - Target type
* @param target - Target name
* @param resource - Resource identifier
* @param options - Configuration options
* @returns Promise resolving when target is removed
*/
function targetRemove(
type: string,
target: string,
resource: string,
options?: Options
): Promise<void>;import * as client from "firebase-tools";
// Display current target configuration
await client.target({
project: "my-project"
});
// Apply hosting target configuration
await client.target.apply("hosting", "production", "my-site-prod", {
project: "my-project"
});
await client.target.apply("hosting", "staging", "my-site-staging", {
project: "my-project"
});
// Apply storage target configuration
await client.target.apply("storage", "production", "my-bucket-prod", {
project: "my-project"
});
// Clear a target
await client.target.clear("hosting", "staging", {
project: "my-project"
});
// Remove a specific resource from target
await client.target.remove("hosting", "production", "my-site-prod", {
project: "my-project"
});# Display current targets
firebase target
# Apply hosting targets
firebase target:apply hosting production my-site-prod
firebase target:apply hosting staging my-site-staging
# Apply storage targets
firebase target:apply storage production my-bucket-prod
firebase target:apply storage staging my-bucket-staging
# Apply database targets
firebase target:apply database production my-db-prod
firebase target:apply database staging my-db-staging
# Clear targets
firebase target:clear hosting staging
firebase target:clear storage production
# Remove specific resources
firebase target:remove hosting production my-site-prod
firebase target:remove storage staging my-bucket-stagingSupported target types include:
Targets are stored in .firebaserc file:
{
"projects": {
"default": "my-project"
},
"targets": {
"my-project": {
"hosting": {
"production": ["my-site-prod"],
"staging": ["my-site-staging"]
},
"storage": {
"production": ["my-bucket-prod"],
"staging": ["my-bucket-staging"]
}
}
}
}Use targets in deployment commands:
# Deploy to specific hosting target
firebase deploy --only hosting:production
# Deploy to multiple targets
firebase deploy --only hosting:staging,storage:staging
# Deploy functions to specific target
firebase deploy --only functions --project=staging// Configure production environment
await client.target.apply("hosting", "prod", "my-app-prod", { project: "my-project" });
await client.target.apply("storage", "prod", "my-storage-prod", { project: "my-project" });
// Configure staging environment
await client.target.apply("hosting", "staging", "my-app-staging", { project: "my-project" });
await client.target.apply("storage", "staging", "my-storage-staging", { project: "my-project" });// Configure multiple hosting sites
await client.target.apply("hosting", "blog", "my-blog-site", { project: "my-project" });
await client.target.apply("hosting", "docs", "my-docs-site", { project: "my-project" });
await client.target.apply("hosting", "admin", "my-admin-site", { project: "my-project" });.firebaserc file--only flag to deploy to specific environments