Skip to content

Commit

Permalink
Merge pull request #19 from sduduzog/prepare-release
Browse files Browse the repository at this point in the history
Prepare release. Fix introduced build step and exposed supabase types
  • Loading branch information
sduduzog authored Mar 13, 2022
2 parents 1e14912 + db51d71 commit 271db1b
Show file tree
Hide file tree
Showing 11 changed files with 377 additions and 70 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/npm-publish-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish beta to NPM

on:
workflow_dispatch:
release:
types: [prereleased]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish to NPM
on:
workflow_dispatch:
release:
types: [published]
types: [released]

jobs:
publish-npm:
Expand All @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
node-version: 14
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: npm publish
Expand Down
Empty file added .npmignore
Empty file.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.17.3
v14
5 changes: 0 additions & 5 deletions build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
declaration: true,
entries: [
{ input: "src/module" },
{ input: "src/composables" },
{ input: "src/templates/", outDir: "dist/templates/", format: "esm" },
],
externals: [
"vue",
"@supabase/supabase-js",
Expand Down
29 changes: 18 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-supabase",
"version": "2.2.1",
"version": "2.3.0",
"description": "A supa simple Nuxt Module for Supabase",
"keywords": [
"vue",
Expand All @@ -17,26 +17,33 @@
},
"license": "MIT",
"author": "Scott Robertson",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/module.cjs",
"import": "./dist/module.mjs"
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
},
"./composables": {
"require": "./dist/composables.cjs",
"default": "./dist/composables.mjs"
},
"./templates/*": "./dist/templates/*",
"./composables": "./dist/composables.mjs",
"./package.json": "./package.json"
},
"main": "./dist/module.cjs",
"module": "./dist/module.mjs",
"types": "./dist/module.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "unbuild"
"build": "unbuild",
"prepack": "npm run build"
},
"dependencies": {
"@nuxt/kit-edge": "^3.0.0-27313139.1c88580",
"@nuxt/kit": "npm:@nuxt/kit-edge@latest",
"@vue/composition-api": "^1.0.4",
"express": "^4.17.1",
"vue-supabase": "^2.2.3"
"vue-supabase": "^2.2.4"
},
"devDependencies": {
"@types/express": "^4.17.13",
Expand All @@ -49,4 +56,4 @@
"typescript": "^4.5.4",
"unbuild": "^0.6.7"
}
}
}
18 changes: 18 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import nuxtModule from "./module";
import {
SupabaseClient as _SupabaseClient,
SupabaseClientOptions as _SupabaseClientOptions,
SupabaseRealtimePayload as _SupabaseRealtimePayload,
Subscription as _Subscription,
User as _User,
Session as _Session,
} from "vue-supabase";

export type SupabaseClient = _SupabaseClient;
export type SupabaseClientOptions = _SupabaseClientOptions;
export type SupabaseRealtimePayload = _SupabaseRealtimePayload<unknown>;
export type Subscription = _Subscription;
export type User = _User;
export type Session = _Session;

export default nuxtModule;
10 changes: 5 additions & 5 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
defineNuxtModule,
addServerMiddleware,
addPluginTemplate,
} from "@nuxt/kit-edge";
} from "@nuxt/kit";
import { authHandler } from "./server";
import { ModuleOptions } from "./types";
import { SupabaseClient } from "vue-supabase";
Expand All @@ -30,20 +30,20 @@ declare module "vuex" {
}

const nuxtModule = defineNuxtModule<ModuleOptions>({
name: "nuxt-supabase",
configKey: "supabase",
meta: {
name: "nuxt-supabase",
configKey: "supabase",
},
setup(resolvedOptions, nuxtApp) {
addServerMiddleware({
path: "/api/auth",
handler: authHandler(resolvedOptions),
});

addPluginTemplate({
src: path.resolve(__dirname, "templates/cookie.client.mjs"),
filename: "supabase-cookie.js",
options: resolvedOptions,
});

addPluginTemplate({
src: path.resolve(__dirname, "templates/plugin.mjs"),
filename: "supabase.js",
Expand Down
2 changes: 1 addition & 1 deletion src/templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createVueSupabase } from "vue-supabase";
const supabase = createVueSupabase({
supabaseUrl: "<%= options.supabaseUrl %>",
supabaseKey: "<%= options.supabaseKey %>",
supabaseOptions: "<%= options.supabaseOptions %>",
supabaseOptions: <%= serialize(options.supabaseOptions) %>,
});

Vue.use(supabase);
Expand Down
15 changes: 5 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"rootDir": "src",
"rootDir": ".",
"sourceMap": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"types": [
"node",
"express"
],
"outDir": "dist",
"types": ["node", "express"]
},
"exclude": [
"node_modules",
"dist"
]
}
"exclude": ["node_modules", "dist"]
}
Loading

0 comments on commit 271db1b

Please sign in to comment.