Skip to content

Commit 0838879

Browse files
committed
BREAKING: Ignore 'functions' directory in a Firebase project without 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.
1 parent dbedf74 commit 0838879

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"functions": {}
3+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"functions": {}
3+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"functions": {}
3+
}

src/config.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@ export class Config {
7676
}
7777
});
7878

79-
// Inject default functions config and source if missing.
80-
if (this.projectDir && fsutils.dirExistsSync(this.path(Config.DEFAULT_FUNCTIONS_SOURCE))) {
81-
if (Array.isArray(this.get("functions"))) {
82-
if (!this.get("functions.[0].source")) {
83-
this.set("functions.[0].source", Config.DEFAULT_FUNCTIONS_SOURCE);
84-
}
85-
} else {
86-
if (!this.get("functions.source")) {
87-
this.set("functions.source", Config.DEFAULT_FUNCTIONS_SOURCE);
79+
// Inject default functions source if missing.
80+
if (this.get("functions")) {
81+
if (this.projectDir && fsutils.dirExistsSync(this.path(Config.DEFAULT_FUNCTIONS_SOURCE))) {
82+
if (Array.isArray(this.get("functions"))) {
83+
if (!this.get("functions.[0].source")) {
84+
this.set("functions.[0].source", Config.DEFAULT_FUNCTIONS_SOURCE);
85+
}
86+
} else {
87+
if (!this.get("functions.source")) {
88+
this.set("functions.source", Config.DEFAULT_FUNCTIONS_SOURCE);
89+
}
8890
}
8991
}
9092
}

0 commit comments

Comments
 (0)