-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apps): establish firebase base for functions and local emulation
Create the initial base function and emulation bazel rules and files
- Loading branch information
1 parent
bf5983a
commit 82ecd90
Showing
11 changed files
with
2,652 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | ||
|
||
nodejs_binary( | ||
name = "serve", | ||
chdir = package_name(), | ||
data = [ | ||
# primary firebase configuration file | ||
"firebase.json", | ||
|
||
# Firebase function files | ||
"//apps/functions:functions_compiled", | ||
"//apps/functions:functions_files", | ||
], | ||
entry_point = "@npm//:node_modules/firebase-tools/lib/bin/firebase.js", | ||
templated_args = [ | ||
"--project", | ||
"angular-caretaker", | ||
"--config", | ||
# TODO: Find a way to do this without relying on the copy_to_bin that works cross platform. | ||
"$$(rlocation $(execpath :firebase.json))", | ||
"emulators:start", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"firestore": { | ||
"rules": "firestore.rules", | ||
"indexes": "firestore.indexes.json" | ||
}, | ||
"functions": { | ||
"predeploy": "bazel build //apps/functions:functions_compiled", | ||
"source": "../dist/bin/apps/functions" | ||
}, | ||
"emulators": { | ||
"functions": { | ||
"port": 5001 | ||
}, | ||
"firestore": { | ||
"port": 8080 | ||
}, | ||
"ui": { | ||
"enabled": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"indexes": [], | ||
"fieldOverrides": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
service cloud.firestore { | ||
match /databases/{database}/documents { | ||
match /{document=**} { | ||
allow read, write: if false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
load("//tools:defaults.bzl", "esbuild", "ts_library") | ||
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin") | ||
|
||
package(default_visibility = ["//visibility:private"]) | ||
|
||
copy_to_bin( | ||
name = "functions_files", | ||
srcs = [ | ||
"package.json", | ||
], | ||
visibility = ["//apps:__pkg__"], | ||
) | ||
|
||
ts_library( | ||
name = "functions", | ||
srcs = [ | ||
"index.ts", | ||
], | ||
deps = [ | ||
"@npm//firebase-functions", | ||
], | ||
) | ||
|
||
esbuild( | ||
name = "functions_compiled", | ||
entry_points = [ | ||
"index.ts", | ||
], | ||
format = "cjs", | ||
visibility = ["//apps:__pkg__"], | ||
deps = [ | ||
":functions", | ||
"@npm//firebase-functions", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import * as functions from 'firebase-functions'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "functions", | ||
"engines": { | ||
"node": "16" | ||
}, | ||
"main": "index.js", | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.