Skip to content

Commit af8d815

Browse files
Merge pull request #13 from sduduzog/expose-supabase-types
Expose supabase types & introduce pretter and eslint
2 parents 5facc58 + 5a2fbea commit af8d815

File tree

7 files changed

+771
-114
lines changed

7 files changed

+771
-114
lines changed

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
parserOptions: {
3+
ecmaVersion: 2017,
4+
sourceType: "module",
5+
},
6+
env: {
7+
es6: true,
8+
},
9+
extends: ["prettier"],
10+
plugins: ["prettier"],
11+
rules: {
12+
"prettier/prettier": ["error"],
13+
},
14+
};

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
trailingComma: "es5",
3+
arrowParens: "avoid",
4+
};

index.d.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1-
import { SupabaseClient } from '@supabase/supabase-js'
1+
import {
2+
SupabaseClient,
3+
SupabaseClientOptions,
4+
Session,
5+
User,
6+
useSupabase,
7+
useSupabaseAuth,
8+
useSupabaseStorage,
9+
} from "vue-supabase";
210

3-
declare module 'vue/types/vue' {
4-
interface Vue {
5-
$supabase: SupabaseClient
6-
}
7-
}
8-
9-
declare module '@nuxt/types' {
11+
declare module "@nuxt/types" {
1012
interface Context {
11-
$supabase: SupabaseClient
13+
$supabase: SupabaseClient;
1214
}
1315
}
1416

15-
declare module 'vuex' {
16-
interface Store<S> {
17-
$supabase: SupabaseClient
17+
declare module "vuex" {
18+
interface Store {
19+
$supabase: SupabaseClient;
1820
}
1921
}
22+
23+
export {
24+
SupabaseClient,
25+
SupabaseClientOptions,
26+
Session,
27+
User,
28+
useSupabase,
29+
useSupabaseAuth,
30+
useSupabaseStorage,
31+
};

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const path = require('path')
1+
const path = require("path");
22

33
export default function (options) {
44
this.addPlugin({
5-
src: path.resolve(__dirname, 'plugin.js'),
6-
fileName: 'supabase.js',
5+
src: path.resolve(__dirname, "plugin.js"),
6+
fileName: "supabase.js",
77
options,
8-
})
8+
});
99
}
1010

11-
module.exports.meta = require('./package.json')
11+
module.exports.meta = require("./package.json");

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuxt-supabase",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A supa simple Nuxt Module for Supabase",
55
"main": "index.js",
66
"author": "Scott Robertson",
@@ -25,8 +25,13 @@
2525
},
2626
"homepage": "https://github.com/scottrobertson/nuxt-supabase#readme",
2727
"dependencies": {
28-
"@supabase/supabase-js": "^1.21.1",
2928
"@vue/composition-api": "^1.0.4",
30-
"vue-supabase": "^2.2.1"
29+
"vue-supabase": "^2.2.3"
30+
},
31+
"devDependencies": {
32+
"eslint": "^8.1.0",
33+
"eslint-config-prettier": "^8.3.0",
34+
"eslint-plugin-prettier": "^4.0.0",
35+
"prettier": "^2.4.1"
3136
}
3237
}

plugin.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import Vue from 'vue'
2-
import VueSupabase from 'vue-supabase'
1+
import Vue from "vue";
2+
import { createVueSupabase } from "vue-supabase";
3+
const supabase = createVueSupabase({
4+
supabaseUrl: "<%= options.supabaseUrl %>",
5+
supabaseKey: "<%= options.supabaseKey %>",
6+
});
37

4-
Vue.use(VueSupabase, {
5-
supabaseUrl: '<%= options.supabaseUrl %>',
6-
supabaseKey: '<%= options.supabaseKey %>'
7-
})
8+
Vue.use(supabase);
89

910
// Inject Supabase into Nuxt Context
1011
export default (ctx, inject) => {
11-
inject('supabase', Vue.supabase)
12-
}
12+
ctx.$supabase = supabase;
13+
inject("supabase", supabase);
14+
};

0 commit comments

Comments
 (0)