Skip to content

Commit ea749d8

Browse files
committed
chore: add firebase emulator
1 parent 072fc49 commit ea749d8

13 files changed

+239
-0
lines changed

playground/.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "vue-fire-store"
4+
}
5+
}

playground/database.rules.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rules": {
3+
".read": "auth != null",
4+
".write": "auth != null"
5+
}
6+
}

playground/firebase.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"database": {
3+
"rules": "database.rules.json"
4+
},
5+
"firestore": {
6+
"rules": "firestore.rules",
7+
"indexes": "firestore.indexes.json"
8+
},
9+
"functions": [
10+
{
11+
"source": "functions",
12+
"codebase": "default",
13+
"ignore": [
14+
"node_modules",
15+
".git",
16+
"firebase-debug.log",
17+
"firebase-debug.*.log"
18+
],
19+
"predeploy": [
20+
"npm --prefix \"$RESOURCE_DIR\" run lint",
21+
"npm --prefix \"$RESOURCE_DIR\" run build"
22+
]
23+
}
24+
],
25+
"hosting": {
26+
"public": "dist",
27+
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
28+
"rewrites": [
29+
{
30+
"source": "**",
31+
"destination": "/index.html"
32+
}
33+
]
34+
},
35+
"storage": {
36+
"rules": "storage.rules"
37+
},
38+
"emulators": {
39+
"auth": {
40+
"port": 9099
41+
},
42+
"functions": {
43+
"port": 5001
44+
},
45+
"firestore": {
46+
"port": 8080
47+
},
48+
"database": {
49+
"port": 8081
50+
},
51+
"storage": {
52+
"port": 9199
53+
},
54+
"ui": {
55+
"enabled": true
56+
},
57+
"singleProjectMode": true
58+
},
59+
"remoteconfig": {
60+
"template": "remoteconfig.template.json"
61+
}
62+
}

playground/firestore.indexes.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"indexes": [
3+
{
4+
"collectionGroup": "todos",
5+
"queryScope": "COLLECTION",
6+
"fields": [
7+
{
8+
"fieldPath": "finished",
9+
"order": "ASCENDING"
10+
},
11+
{
12+
"fieldPath": "created",
13+
"order": "ASCENDING"
14+
}
15+
]
16+
}
17+
],
18+
"fieldOverrides": []
19+
}

playground/firestore.rules

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
service cloud.firestore {
2+
match /databases/{database}/documents {
3+
match /todos/{todoId} {
4+
allow read, write;
5+
}
6+
match /demo-todos/{todoId} {
7+
allow read, write;
8+
}
9+
match /vuexfireItems1/{id} {
10+
allow read, write;
11+
}
12+
match /vuexfireItems2/{id} {
13+
allow read, write;
14+
}
15+
match /configs/jORwjIykFo2NmkdzTkhU {
16+
allow read, write;
17+
}
18+
match /empty/{emptyId} {
19+
allow read;
20+
}
21+
match /none/{noneId} {
22+
allow read;
23+
}
24+
match /comentedTodos/{id} {
25+
allow read, write;
26+
}
27+
match /configs/jORwjIykFo2NmkdzTkhU {
28+
allow read, write;
29+
}
30+
match /bug-reports/{issue}/demo-files/{id} {
31+
allow read, write;
32+
}
33+
match /bug-reports/{issue}/demo/{id} {
34+
allow read, write;
35+
}
36+
match /{document=**} {
37+
allow read;
38+
allow write: if false;
39+
}
40+
}
41+
}

playground/functions/.eslintrc.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
node: true,
6+
},
7+
extends: [
8+
'eslint:recommended',
9+
'plugin:import/errors',
10+
'plugin:import/warnings',
11+
'plugin:import/typescript',
12+
'google',
13+
'plugin:@typescript-eslint/recommended',
14+
],
15+
parser: '@typescript-eslint/parser',
16+
parserOptions: {
17+
project: ['tsconfig.json', 'tsconfig.dev.json'],
18+
sourceType: 'module',
19+
},
20+
ignorePatterns: [
21+
'/lib/**/*', // Ignore built files.
22+
],
23+
plugins: ['@typescript-eslint', 'import'],
24+
rules: {
25+
quotes: ['error', 'double'],
26+
'import/no-unresolved': 0,
27+
},
28+
}

playground/functions/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Compiled JavaScript files
2+
lib/**/*.js
3+
lib/**/*.js.map
4+
5+
# TypeScript v1 declaration files
6+
typings/
7+
8+
# Node.js dependency directory
9+
node_modules/

playground/functions/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "functions",
3+
"scripts": {
4+
"lint": "eslint --ext .js,.ts .",
5+
"build": "tsc",
6+
"build:watch": "tsc --watch",
7+
"serve": "npm run build && firebase emulators:start --only functions",
8+
"shell": "npm run build && firebase functions:shell",
9+
"start": "npm run shell",
10+
"deploy": "firebase deploy --only functions",
11+
"logs": "firebase functions:log"
12+
},
13+
"engines": {
14+
"node": "16"
15+
},
16+
"main": "lib/index.js",
17+
"dependencies": {
18+
"firebase-admin": "^10.0.2",
19+
"firebase-functions": "^3.18.0"
20+
},
21+
"devDependencies": {
22+
"@typescript-eslint/eslint-plugin": "^5.12.0",
23+
"@typescript-eslint/parser": "^5.12.0",
24+
"eslint": "^8.9.0",
25+
"eslint-config-google": "^0.14.0",
26+
"eslint-plugin-import": "^2.25.4",
27+
"firebase-functions-test": "^0.2.0",
28+
"typescript": "^4.5.4"
29+
},
30+
"private": true
31+
}

playground/functions/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as functions from 'firebase-functions'
2+
3+
// // Start writing Firebase Functions
4+
// // https://firebase.google.com/docs/functions/typescript
5+
//
6+
// export const helloWorld = functions.https.onRequest((request, response) => {
7+
// functions.logger.info("Hello logs!", {structuredData: true});
8+
// response.send("Hello from Firebase!");
9+
// });
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"include": [
3+
".eslintrc.js"
4+
]
5+
}

0 commit comments

Comments
 (0)