diff --git a/README.md b/README.md index 3cff6313..d3d14f25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Nuxt-Fire +# 🔥 Nuxt-Fire -> Easily intergrate Firebase into your Nuxt 2 project. +> ## Easily intergrate Firebase into your Nuxt 2 project. ## Demo @@ -8,9 +8,14 @@ ## Requirements -Make sure to have Nuxt 2+ installed: +Make sure you have Nuxt and Firebase installed in your project. -- Nuxt.js >= 2.x +```json +"dependencies": { + "nuxt": "^2.3.1", + "firebase": "^5.5.8" +} +``` ## Install @@ -79,13 +84,13 @@ You can access the various Firebase products with **\$foo** in almost any contex Firebase products supported by nuxt-fire so far: -| Firebase Product | Shortcut | -| ----------------- | --------------- | -| Authentication | \$fireAuth | -| RealTime Database | \$fireDb | -| Firestore | \$fireStore | -| Storage | \$fireStorage | -| Functions | \$fireFunctions | +| Firebase Product | Shortcut | +| ----------------- | ------------- | +| Authentication | \$fireAuth | +| RealTime Database | \$fireDb | +| Firestore | \$fireStore | +| Storage | \$fireStorage | +| Functions | \$fireFunc | See [Firebase's official docs](https://firebase.google.com/docs/) for more usage information. diff --git a/package-lock.json b/package-lock.json index b138b479..171a9d0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nuxt-fire", - "version": "0.0.1", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d13b5a2d..75a8f281 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-fire", - "version": "0.0.3", + "version": "1.0.0", "license": "MIT", "description": "Intergrate Firebase into your Nuxt project.", "main": "index.js", diff --git a/plugin.js b/plugin.js index 065681d3..ae0bb08c 100644 --- a/plugin.js +++ b/plugin.js @@ -5,7 +5,7 @@ import 'firebase/database' import 'firebase/storage' import 'firebase/auth' -export default function({ app }, inject) { +export default (ctx, inject) => { const options = <%= serialize(options) %> @@ -18,32 +18,30 @@ export default function({ app }, inject) { } } - let _fireStore, _fireFunc, _fireStorage, _fireAuth, _fireDb - if (!options.useOnly || options.useOnly.includes('firestore')) { firebase.firestore().settings({ timestampsInSnapshots: true }) - _fireStore = firebase.firestore() - inject('fireStore', _fireStore) + const fireStore = firebase.firestore() + inject('fireStore', fireStore) } if (!options.useOnly || options.useOnly.includes('realtimeDb')) { - _fireDb = firebase.database() - inject('fireDb', _fireDb) + const fireDb = firebase.database() + inject('fireDb', fireDb) } if (!options.useOnly || options.useOnly.includes('functions')) { - _fireFunc = firebase.functions() - inject('fireFunc', _fireFunc) + const fireFunc = firebase.functions() + inject('fireFunc', fireFunc) } if (!options.useOnly || options.useOnly.includes('storage')) { - _fireStorage = firebase.storage() - inject('fireStorage', _fireStorage) + const fireStorage = firebase.storage() + inject('fireStorage', fireStorage) } if (!options.useOnly || options.useOnly.includes('auth')) { - const _fireAuth = firebase.auth() - inject('fireAuth', _fireAuth) + const fireAuth = firebase.auth() + inject('fireAuth', fireAuth) } }