Skip to content

Add support for Nuxt Bridge #15

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 14 commits into from
Mar 10, 2022
Merged

Conversation

Strift
Copy link
Contributor

@Strift Strift commented Dec 18, 2021

Hello,

I'm a big fan of using Supabase and Nuxt! I saw there was an open issue for Nuxt 3 Support: #14, so I'm opening a PR to try and help.

I'm fairly new to Open-Source, so I hope both the code and the explanations will be good enough for this project. Let me know if I should rewrite anything. Also, I'm still learning TypeScript, so I hope my code isn't too much trouble! 😬

What this PR brings:

  • Package code rewritten in TypeScript
  • Package bundling made with unbuild
  • Exporting all composables available in vue-supabase
  • The module adds a server middleware to set auth cookie
  • The modules allows to commit a mutation or dispatch an action when the auth state changes (DX inspired by the Firebase module)
  • Easy SSR implementation with the nuxtServerInit action

This package requires vue-supabase to be updated. I think it's only minor changes, you can see them detailed in this PR.

The code is largely inspired by the awesome nuxt3-supabase package by @wobsoriano. So big props to him. 👏

Things left to do

  • Documentation update
  • Typing declarations? (I'm not too sure how to achieve this properly, it doesn't seem to work locally.)

Testing the code
I did not add tests to the package but I did some local testing. You can test it in this demo: https://github.com/Strift/nuxt-supabase-bridge-example

Et voilà! I hope this will help. Looking forward to have your feedback.
If there are alternatives or constraints I haven't taken into consideration, please let me know. I'll be happy to update the PR as needed.

Thanks for your time!
Cheers,

@Strift Strift mentioned this pull request Dec 21, 2021
Copy link
Collaborator

@sduduzog sduduzog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottrobertson Approving to get it moving, I'll tweak the version code in a follow up PR

"main": "./dist/module.cjs",
"module": "./dist/module.mjs",
"types": "./dist/module.d.ts",
"scripts": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the prepare script to prepare build i.e "prepare": "npm run build",

Similar to how vue-supbase is setup, without this it's impossible to test the PR by installing it as a package, see screenshot. Also there's sometimes unexpected behavior when using yarn to install the package, as typescript files are not always built during the installation process

image

@sduduzog sduduzog merged commit 1e14912 into supabase-community:main Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants