Skip to content

feat(nuxt,vue): Introduce Nuxt SDK - #4541

Merged
wobsoriano merged 25 commits into
mainfrom
rob/eco-225-add-nuxt-package
Nov 15, 2024
Merged

feat(nuxt,vue): Introduce Nuxt SDK#4541
wobsoriano merged 25 commits into
mainfrom
rob/eco-225-add-nuxt-package

Conversation

@wobsoriano

@wobsoriano wobsoriano commented Nov 12, 2024

Copy link
Copy Markdown
Member

Description

This PR is a continuation of our effort to port vue-clerk to our JavaScript monorepo, following up on PR #4461. The key change is extracting the Nuxt module into its own package instead of keeping it as a submodule under vue-clerk/nuxt.

Nuxt is a metaframework built on top of Vue and Nitro - it's what Next.js is to React.

Implementation

The module can be easily integrated into any Nuxt project:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@clerk/nuxt'],
})

Features

E2E tests and documentation to follow in a separate PR.

Resolves ECO-225

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated (to follow)

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot

changeset-bot Bot commented Nov 12, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 86262db

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/nuxt Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wobsoriano wobsoriano changed the title feat(nuxt,vue): Add Nuxt package feat(nuxt,vue): Introduce Nuxt SDK Nov 12, 2024
@wobsoriano
wobsoriano marked this pull request as ready for review November 12, 2024 23:25
}

nuxtApp.vueApp.use(clerkPlugin, {
...(useRuntimeConfig().public.clerk ?? {}),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the client-side useRuntimeConfig composable in Nuxt.

It returns the available runtime config variables.

import { useRuntimeConfig } from '#imports';

export function clerkClient(event: H3Event) {
const runtimeConfig = useRuntimeConfig(event);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the server-side useRuntimeConfig and requires an H3Event to be passed in so that it can properly parse environment variables in different runtimes

@LekoArts LekoArts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left some comments 👍 Also, aren't we missing a README? 😅

Comment thread packages/nuxt/package.json
Comment thread packages/nuxt/src/module.ts
Comment thread packages/vue/src/internal.ts Outdated
@wobsoriano

wobsoriano commented Nov 13, 2024

Copy link
Copy Markdown
Member Author

@LekoArts README added! 😆

(will be updated later to match existing READMEs after we got docs ready)

Comment thread .github/workflows/ci.yml Outdated
@wobsoriano
wobsoriano requested a review from LekoArts November 14, 2024 15:02
@wobsoriano
wobsoriano force-pushed the rob/eco-225-add-nuxt-package branch from b808fe0 to 6010ef6 Compare November 14, 2024 19:35

@LekoArts LekoArts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left some more comments I'd like to be addressed before merging but unblocking it since it's generally fine :shipit:

Comment thread packages/nuxt/README.md Outdated
Comment thread packages/nuxt/README.md
Comment on lines +44 to +50
### Build

To build the package locally with the TypeScript compiler, run:

```bash
npm run build
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At some point I want to update our READMEs to remove this portion, let's not add it here in the first place. For the end-user who wants to use the package it's not really useful 😊

Comment thread packages/nuxt/package.json Outdated
"h3": "^1.13.0"
},
"devDependencies": {
"@types/node": "latest",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's replace the alias with a version range instead. We use ^18.19.33 in other places. If it indeed only works with Node 22, then we'd need to change the engines#node

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed it! I was testing something yesterday and forgot to remove it. Thanks!

@anagstef anagstef left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔥

@wobsoriano
wobsoriano force-pushed the rob/eco-225-add-nuxt-package branch from 5d7502c to 86262db Compare November 15, 2024 14:38
@wobsoriano
wobsoriano merged commit 91f60ca into main Nov 15, 2024
@wobsoriano
wobsoriano deleted the rob/eco-225-add-nuxt-package branch November 15, 2024 15:07
wobsoriano added a commit that referenced this pull request Feb 8, 2025
Co-authored-by: Lennart <lekoarts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants