Browse Source

:fire: Firebase Hosting

Liyas Thomas 5 years ago
parent
commit
c54b019d55
10 changed files with 88 additions and 11 deletions
  1. 5 1
      .dockerignore
  2. 5 0
      .firebaserc
  3. 5 1
      .gitignore
  4. 3 9
      .travis.yml
  5. 7 0
      database.rules.json
  6. 21 0
      firebase.json
  7. 26 0
      firestore.indexes.json
  8. 7 0
      firestore.rules
  9. 1 0
      functions/.gitignore
  10. 8 0
      functions/index.js

+ 5 - 1
.dockerignore

@@ -3,6 +3,10 @@ Dockerfile
 .github
 
 # Created by .ignore support plugin (hsz.mobi)
+
+# Firebase
+.firebase
+
 ### Node template
 # Logs
 logs
@@ -97,4 +101,4 @@ sw.*
 .postwoman
 
 # File explorer
-.directory
+.directory

+ 5 - 0
.firebaserc

@@ -0,0 +1,5 @@
+{
+  "projects": {
+    "default": "postwoman-api"
+  }
+}

+ 5 - 1
.gitignore

@@ -1,4 +1,8 @@
 # Created by .ignore support plugin (hsz.mobi)
+
+# Firebase
+.firebase
+
 ### Node template
 # Logs
 logs
@@ -93,4 +97,4 @@ sw.*
 .postwoman
 
 # File explorer
-.directory
+.directory

+ 3 - 9
.travis.yml

@@ -27,18 +27,12 @@ branches:
   - "master"
 
 install:
+ - "npm install firebase-tools"
  - "npm install"
  - "npm run generate"
 
 notifications:
   webhooks: https://www.travisbuddy.com
 
-deploy:
- provider: pages
- skip-cleanup: true
- # Refer to: https://docs.travis-ci.com/user/deployment/pages/#Setting-the-GitHub-token
- github-token: $GITHUB_ACCESS_TOKEN
- target-branch: gh-pages
- local-dir: dist
- on:
-  branch: master
+after_success:
+  - firebase deploy --token $FIREBASE_TOKEN

+ 7 - 0
database.rules.json

@@ -0,0 +1,7 @@
+{
+  /* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
+  "rules": {
+    ".read": false,
+    ".write": false
+  }
+}

+ 21 - 0
firebase.json

@@ -0,0 +1,21 @@
+{
+  "database": {
+    "rules": "database.rules.json"
+  },
+  "firestore": {
+    "rules": "firestore.rules",
+    "indexes": "firestore.indexes.json"
+  },
+  "hosting": {
+    "public": "dist",
+    "cleanUrls": true,
+    "ignore": [
+      "firebase.json",
+      "**/.*",
+      "**/node_modules/**"
+    ]
+  },
+  "storage": {
+    "rules": "storage.rules"
+  }
+}

+ 26 - 0
firestore.indexes.json

@@ -0,0 +1,26 @@
+{
+  // Example:
+  //
+  // "indexes": [
+  //   {
+  //     "collectionGroup": "widgets",
+  //     "queryScope": "COLLECTION",
+  //     "fields": [
+  //       { "fieldPath": "foo", "arrayConfig": "CONTAINS" },
+  //       { "fieldPath": "bar", "mode": "DESCENDING" }
+  //     ]
+  //   },
+  //
+  //  "fieldOverrides": [
+  //    {
+  //      "collectionGroup": "widgets",
+  //      "fieldPath": "baz",
+  //      "indexes": [
+  //        { "order": "ASCENDING", "queryScope": "COLLECTION" }
+  //      ]
+  //    },
+  //   ]
+  // ]
+  "indexes": [],
+  "fieldOverrides": []
+}

+ 7 - 0
firestore.rules

@@ -0,0 +1,7 @@
+service cloud.firestore {
+  match /databases/{database}/documents {
+    match /{document=**} {
+      allow read, write;
+    }
+  }
+}

+ 1 - 0
functions/.gitignore

@@ -0,0 +1 @@
+node_modules/

+ 8 - 0
functions/index.js

@@ -0,0 +1,8 @@
+const functions = require('firebase-functions');
+
+// // Create and Deploy Your First Cloud Functions
+// // https://firebase.google.com/docs/functions/write-firebase-functions
+//
+// exports.helloWorld = functions.https.onRequest((request, response) => {
+//  response.send("Hello from Firebase!");
+// });

Some files were not shown because too many files changed in this diff