Skip to content

Commit

Permalink
BREAKING: Ignore 'functions' directory in a Firebase project without …
Browse files Browse the repository at this point in the history
…a functions config in firebase.json

Don't assume all directory named `functions` are functions directory. Instead, expect developers to explicitly set up a "functions" config in their firebase.json.
  • Loading branch information
taeold committed Nov 28, 2023
1 parent dbedf74 commit db631ad
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ export class Config {
}
});

// Inject default functions config and source if missing.
if (this.projectDir && fsutils.dirExistsSync(this.path(Config.DEFAULT_FUNCTIONS_SOURCE))) {
if (Array.isArray(this.get("functions"))) {
if (!this.get("functions.[0].source")) {
this.set("functions.[0].source", Config.DEFAULT_FUNCTIONS_SOURCE);
}
} else {
if (!this.get("functions.source")) {
this.set("functions.source", Config.DEFAULT_FUNCTIONS_SOURCE);
// Inject default functions source if missing.
if (this.get("functions")) {
if (this.projectDir && fsutils.dirExistsSync(this.path(Config.DEFAULT_FUNCTIONS_SOURCE))) {
if (Array.isArray(this.get("functions"))) {
if (!this.get("functions.[0].source")) {
this.set("functions.[0].source", Config.DEFAULT_FUNCTIONS_SOURCE);
}
} else {
if (!this.get("functions.source")) {
this.set("functions.source", Config.DEFAULT_FUNCTIONS_SOURCE);
}
}
}
}
Expand Down

0 comments on commit db631ad

Please sign in to comment.