Skip to content

Expose supabase types & introduce pretter and eslint #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
parserOptions: {
ecmaVersion: 2017,
sourceType: "module",
},
env: {
es6: true,
},
extends: ["prettier"],
plugins: ["prettier"],
rules: {
"prettier/prettier": ["error"],
},
};
4 changes: 4 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
trailingComma: "es5",
arrowParens: "avoid",
};
36 changes: 24 additions & 12 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import { SupabaseClient } from '@supabase/supabase-js'
import {
SupabaseClient,
SupabaseClientOptions,
Session,
User,
useSupabase,
useSupabaseAuth,
useSupabaseStorage,
} from "vue-supabase";

declare module 'vue/types/vue' {
interface Vue {
$supabase: SupabaseClient
}
}

declare module '@nuxt/types' {
declare module "@nuxt/types" {
interface Context {
$supabase: SupabaseClient
$supabase: SupabaseClient;
}
}

declare module 'vuex' {
interface Store<S> {
$supabase: SupabaseClient
declare module "vuex" {
interface Store {
$supabase: SupabaseClient;
}
}

export {
SupabaseClient,
SupabaseClientOptions,
Session,
User,
useSupabase,
useSupabaseAuth,
useSupabaseStorage,
};
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const path = require('path')
const path = require("path");

export default function (options) {
this.addPlugin({
src: path.resolve(__dirname, 'plugin.js'),
fileName: 'supabase.js',
src: path.resolve(__dirname, "plugin.js"),
fileName: "supabase.js",
options,
})
});
}

module.exports.meta = require('./package.json')
module.exports.meta = require("./package.json");
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-supabase",
"version": "2.1.0",
"version": "2.2.0",
"description": "A supa simple Nuxt Module for Supabase",
"main": "index.js",
"author": "Scott Robertson",
Expand All @@ -25,8 +25,13 @@
},
"homepage": "https://github.com/scottrobertson/nuxt-supabase#readme",
"dependencies": {
"@supabase/supabase-js": "^1.21.1",
"@vue/composition-api": "^1.0.4",
"vue-supabase": "^2.2.1"
"vue-supabase": "^2.2.3"
},
"devDependencies": {
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.4.1"
}
}
18 changes: 10 additions & 8 deletions plugin.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Vue from 'vue'
import VueSupabase from 'vue-supabase'
import Vue from "vue";
import { createVueSupabase } from "vue-supabase";
const supabase = createVueSupabase({
supabaseUrl: "<%= options.supabaseUrl %>",
supabaseKey: "<%= options.supabaseKey %>",
});

Vue.use(VueSupabase, {
supabaseUrl: '<%= options.supabaseUrl %>',
supabaseKey: '<%= options.supabaseKey %>'
})
Vue.use(supabase);

// Inject Supabase into Nuxt Context
export default (ctx, inject) => {
inject('supabase', Vue.supabase)
}
ctx.$supabase = supabase;
inject("supabase", supabase);
};
Loading