Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit 40428fa

Browse files
committed
chore(nuxt): Use publishable key from env var
1 parent 2bc56a3 commit 40428fa

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

apps/playground/nuxt.config.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
/* eslint-disable node/prefer-global/process */
21
// https://nuxt.com/docs/api/configuration/nuxt-config
32
export default defineNuxtConfig({
43
devtools: { enabled: false },
54

65
modules: ['vue-clerk/nuxt'],
76

8-
clerk: {
9-
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
10-
},
7+
clerk: {},
118

129
compatibilityDate: '2024-07-26',
1310
})

eslint.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default antfu(
1111
{
1212
rules: {
1313
'no-console': 'warn',
14+
'node/prefer-global/process': 'warn',
1415
},
1516
},
1617
)

packages/nuxt/src/module.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ export default defineNuxtModule<ModuleOptions>({
1313
},
1414
},
1515
async setup(options, nuxt) {
16-
nuxt.options.runtimeConfig.public.clerk = options
16+
const runtimeConfig = nuxt.options.runtimeConfig
17+
runtimeConfig.public = defu(runtimeConfig.public, {
18+
clerk: {
19+
...options,
20+
publishableKey: options.publishableKey || process.env.CLERK_PUBLISHABLE_KEY,
21+
},
22+
})
1723
nuxt.options.build.transpile.push('vue-clerk')
1824

1925
const resolver = createResolver(import.meta.url)

packages/nuxt/src/runtime/plugins/clerk.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { defineNuxtPlugin, navigateTo, useRuntimeConfig, useState } from '#app'
55
export default defineNuxtPlugin((nuxtApp: any) => {
66
const serverInitialState = useState<AuthObject | undefined>('clerk-initial-state', () => undefined)
77

8-
// eslint-disable-next-line node/prefer-global/process
98
if (process.env.server) {
109
const authContext = nuxtApp.ssrContext?.event.context.auth
1110
serverInitialState.value = authContext ? JSON.parse(JSON.stringify(authContext)) : undefined

packages/vue-clerk/src/isomorphicClerk.ts

-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ import { isConstructor } from './utils/index'
6565
const SDK_METADATA = {
6666
name: PACKAGE_NAME,
6767
version: PACKAGE_VERSION,
68-
// eslint-disable-next-line node/prefer-global/process
6968
environment: process.env.NODE_ENV,
7069
}
7170

@@ -478,7 +477,6 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
478477
// In Next.js we can throw a full screen error in development mode.
479478
// However, in production throwing an error results in an infinite loop.
480479
// More info at: https://github.com/vercel/next.js/issues/6973
481-
// eslint-disable-next-line node/prefer-global/process
482480
if (process.env.NODE_ENV === 'production') {
483481
console.error(error.stack || error.message || error)
484482
}

0 commit comments

Comments
 (0)