Skip to content

Commit fb7a26a

Browse files
authored
Merge branch 'main' into update-pull-request
2 parents 6d13eb4 + 4729b1f commit fb7a26a

File tree

24 files changed

+9151
-6855
lines changed

24 files changed

+9151
-6855
lines changed

.github/workflows/ci.yaml

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88

99
env:
10-
NODE_VER: 18.19.1
10+
NODE_VER: 22.5
1111
CI: true
1212

1313
jobs:
@@ -17,20 +17,19 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20+
- uses: pnpm/action-setup@v4
21+
name: Install pnpm
22+
with:
23+
run_install: false
24+
2025
- name: Use Node.js ${{ env.NODE_VER }}
2126
uses: actions/setup-node@v4
2227
with:
2328
node-version: ${{ env.NODE_VER }}
29+
cache: 'pnpm'
2430

25-
- uses: pnpm/action-setup@v3
26-
name: Install pnpm
27-
id: pnpm-install
28-
with:
29-
version: 8
30-
31-
# Install deps and prepare types
32-
- run: pnpm i
33-
- run: pnpm dev:prepare
31+
- name: Install deps and prepare types
32+
run: pnpm i && pnpm dev:prepare
3433

3534
# Check if build and package artifacts can still be generated
3635
- run: pnpm prepack
@@ -48,23 +47,22 @@ jobs:
4847
steps:
4948
- uses: actions/checkout@v4
5049

50+
- uses: pnpm/action-setup@v4
51+
name: Install pnpm
52+
with:
53+
run_install: false
54+
5155
- name: Use Node.js ${{ env.NODE_VER }}
5256
uses: actions/setup-node@v4
5357
with:
5458
node-version: ${{ env.NODE_VER }}
59+
cache: 'pnpm'
5560

56-
- uses: pnpm/action-setup@v3
57-
name: Install pnpm
58-
id: pnpm-install
59-
with:
60-
version: 8
61-
62-
# Install deps and prepare types
63-
- run: pnpm i
64-
- run: pnpm dev:prepare
61+
- name: Install deps and prepare types
62+
run: pnpm i && pnpm dev:prepare
6563

6664
# Build docs
67-
- run: cd docs && pnpm docs:build
65+
- run: pnpm docs:build
6866

6967
test-playground-local:
7068
runs-on: ubuntu-latest
@@ -75,19 +73,19 @@ jobs:
7573
steps:
7674
- uses: actions/checkout@v4
7775

76+
- uses: pnpm/action-setup@v4
77+
name: Install pnpm
78+
with:
79+
run_install: false
80+
7881
- name: Use Node.js ${{ env.NODE_VER }}
7982
uses: actions/setup-node@v4
8083
with:
8184
node-version: ${{ env.NODE_VER }}
85+
cache: 'pnpm'
8286

83-
- uses: pnpm/action-setup@v3
84-
name: Install pnpm
85-
id: pnpm-install
86-
with:
87-
version: 8
88-
89-
# Install deps
90-
- run: pnpm i
87+
- name: Install deps
88+
run: pnpm i
9189

9290
- name: Install Playwright Browsers
9391
run: pnpm exec playwright install --with-deps
@@ -106,19 +104,19 @@ jobs:
106104
steps:
107105
- uses: actions/checkout@v4
108106

107+
- uses: pnpm/action-setup@v4
108+
name: Install pnpm
109+
with:
110+
run_install: false
111+
109112
- name: Use Node.js ${{ env.NODE_VER }}
110113
uses: actions/setup-node@v4
111114
with:
112115
node-version: ${{ env.NODE_VER }}
116+
cache: 'pnpm'
113117

114-
- uses: pnpm/action-setup@v3
115-
name: Install pnpm
116-
id: pnpm-install
117-
with:
118-
version: 8
119-
120-
# Install deps
121-
- run: pnpm i
118+
- name: Install deps
119+
run: pnpm i
122120

123121
- name: Install Playwright Browsers
124122
run: pnpm exec playwright install --with-deps
@@ -137,19 +135,19 @@ jobs:
137135
steps:
138136
- uses: actions/checkout@v4
139137

138+
- uses: pnpm/action-setup@v4
139+
name: Install pnpm
140+
with:
141+
run_install: false
142+
140143
- name: Use Node.js ${{ env.NODE_VER }}
141144
uses: actions/setup-node@v4
142145
with:
143146
node-version: ${{ env.NODE_VER }}
147+
cache: 'pnpm'
144148

145-
- uses: pnpm/action-setup@v3
146-
name: Install pnpm
147-
id: pnpm-install
148-
with:
149-
version: 8
150-
151-
# Install deps
152-
- run: pnpm i
149+
- name: Install deps
150+
run: pnpm i
153151

154152
# Check building
155153
- run: pnpm build

.github/workflows/deploy-docs.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
# Allows you to run this workflow manually from the Actions tab
88
workflow_dispatch:
99

10+
env:
11+
NODE_VER: 22.5
12+
CI: true
13+
1014
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1115
permissions:
1216
contents: read
@@ -28,21 +32,27 @@ jobs:
2832
uses: actions/checkout@v4
2933
with:
3034
fetch-depth: 0 # Required to calculate lastUpdated
31-
- name: Install pnpm
32-
uses: pnpm/action-setup@v3
35+
36+
- uses: pnpm/action-setup@v4
37+
name: Install pnpm
3338
with:
34-
version: 8
35-
- name: Setup Node
39+
run_install: false
40+
41+
- name: Use Node.js ${{ env.NODE_VER }}
3642
uses: actions/setup-node@v4
3743
with:
38-
node-version: 20
39-
cache: pnpm
44+
node-version: ${{ env.NODE_VER }}
45+
cache: 'pnpm'
46+
4047
- name: Setup Pages
4148
uses: actions/configure-pages@v4
49+
4250
- name: Install dependencies
4351
run: pnpm i
52+
4453
- name: Build with VitePress
45-
run: cd docs/ && pnpm docs:build
54+
run: pnpm docs:build
55+
4656
- name: Upload artifact
4757
uses: actions/upload-pages-artifact@v3
4858
with:

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
shamefully-hoist=true
22
strict-peer-dependencies=false
3-
ignore-workspace-root-check=true
3+
link-workspace-packages=true

docs/.vitepress/config.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'vitepress'
22
import { routes as navRoutes } from './routes/navbar'
33
import { routes as sidebarRoutes } from './routes/sidebar'
4+
import { headConfig, sitemapConfig } from './head'
45

56
export default defineConfig({
67
title: 'NuxtAuth',
@@ -11,7 +12,8 @@ export default defineConfig({
1112
lang: 'en-US',
1213
appearance: 'dark',
1314
lastUpdated: true,
14-
head: [['link', { rel: 'icon', href: '/favicon.ico' }]],
15+
head: headConfig,
16+
sitemap: sitemapConfig,
1517
themeConfig: {
1618
logo: '/lock.png',
1719
outline: { level: 'deep' },

docs/.vitepress/head.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { HeadConfig } from "vitepress"
2+
3+
const HOST_NAME = 'https://auth.sidebase.io'
4+
const OG_IMAGE_URL = `${HOST_NAME}/nuxt-auth-og.jpg`
5+
6+
export const sitemapConfig = {
7+
hostname: HOST_NAME
8+
}
9+
10+
export const headConfig: HeadConfig[] = [
11+
['link', { rel: 'icon', href: '/favicon.ico' }],
12+
['meta', { name: 'theme-color', content: '#30A36C' }],
13+
['meta', { property: 'og:title', content: 'NuxtAuth | Authentication for Nuxt 3' }],
14+
['meta', { property: 'og:description', content: 'User authentication and sessions via authjs' }],
15+
['meta', { property: 'og:site_name', content: 'NuxtAuth' }],
16+
['meta', { property: 'og:type', content: 'website' }],
17+
['meta', { property: 'og:locale', content: 'en' }],
18+
['meta', { property: 'og:image', content: OG_IMAGE_URL }],
19+
['meta', { property: 'og:url', content: HOST_NAME }],
20+
]

docs/.vitepress/theme/Layout.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script setup>
2+
import DefaultTheme from 'vitepress/theme'
3+
import GithubStarsButton from './components/GithubStarsButton.vue'
4+
import Banner from './components/Banner.vue'
5+
6+
const { Layout } = DefaultTheme
7+
8+
// Banner Configuration
9+
const bannerConfig = {
10+
// Leave text empty to disable the banner
11+
text: '✨ NuxtAuth v0.8.0 has been released! ✨',
12+
button: {
13+
href: 'https://github.com/sidebase/nuxt-auth/releases/tag/0.8.0',
14+
text: 'View release notes'
15+
}
16+
}
17+
</script>
18+
19+
<template>
20+
<Layout>
21+
<template #nav-bar-content-after>
22+
<GithubStarsButton owner="sidebase" repo="nuxt-auth" />
23+
</template>
24+
25+
<template #home-hero-before>
26+
<Banner v-bind="bannerConfig" />
27+
</template>
28+
</Layout>
29+
</template>

docs/.vitepress/theme/index.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import { h } from 'vue'
32
import type { Theme } from 'vitepress'
43
import DefaultTheme from 'vitepress/theme'
4+
import Layout from './Layout.vue'
55

66
// Styles
77
import './style.css'
88

9-
// Custom Components
10-
import GithubStarsButton from './components/GithubStarsButton.vue'
11-
import Banner from './components/Banner.vue'
12-
13-
// Configuration
14-
const bannerConfig = {
15-
// Leave text empty to disable the banner
16-
text: '✨ NuxtAuth v0.8.0 has been released! ✨',
17-
button: {
18-
href: 'https://github.com/sidebase/nuxt-auth/releases/tag/0.8.0',
19-
text: 'View release notes'
20-
}
21-
}
22-
23-
export default {
24-
extends: DefaultTheme,
25-
Layout: () => {
26-
return h(DefaultTheme.Layout, null, {
27-
// https://vitepress.dev/guide/extending-default-theme#layout-slots
28-
'nav-bar-content-after': h(GithubStarsButton, { owner: 'sidebase', repo: 'nuxt-auth' }),
29-
'home-hero-before': h(Banner, bannerConfig)
30-
})
31-
},
32-
} satisfies Theme
9+
export default { extends: DefaultTheme, Layout } satisfies Theme

docs/guide/advanced/deployment/self-hosted.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This guide will explain how you can self-host a Nuxt3 application running NuxtAu
66

77
When deploying the Auth.JS provider, the application must be informed what URL it is running at. This is to properly determine callback urls when navigating users to external OAuth providers. Depending on your setup, NuxtAuth allows you to set this value at either [**Runtime**](https://nuxt.com/docs/guide/going-further/hooks#app-hooks-runtime) or [**Buildtime**](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time).
88

9-
- **Runtime:** Set the `AUTH_ORIGIN` environment variable.
9+
- **Runtime:** Set the `NUXT_AUTH_ORIGIN` environment variable.
1010
- **Buildtime:** Set the `baseURL`-config key inside the `nuxt.config.ts`
1111

1212
The origin consists out of:
@@ -15,17 +15,17 @@ The origin consists out of:
1515
- **host:** e.g., localhost, example.org, google.com
1616
- **port:** empty (implies `:80` for http and `:443` for https), :3000, :8888
1717

18-
An example of the `AUTH_ORIGIN` would be: `https://my-awesome-app.com`
18+
An example of the `NUXT_AUTH_ORIGIN` would be: `https://my-awesome-app.com`
1919

2020
:::info Origin Order
2121
When [attempting to determine the server origin](https://github.com/sidebase/nuxt-auth/blob/main/src/runtime/server/services/utils.ts#L11), NuxtAuth checks the available options in the following order:
22-
- **Prio 1**: Using `AUTH_ORIGIN`
22+
- **Prio 1**: Using `NUXT_AUTH_ORIGIN`
2323
- **Prio 2**: Using `baseURL`-config key from inside the `nuxt.config.ts`
2424
- **Prio 3**: Infer the origin _(Only in development)_
2525
:::
2626

2727
:::tip
28-
We recommend setting the `AUTH_ORIGIN` during runtime and leaving the `baseURL`-config key empty, to avoid using a potentially incorrect ORIGIN.
28+
We recommend setting the `NUXT_AUTH_ORIGIN` during runtime and leaving the `baseURL`-config key empty, to avoid using a potentially incorrect ORIGIN.
2929
:::
3030

3131
In addition to verifying that the origin is correctly set, also ensure that you have a secure [`secret` set in the NuxtAuthHandler](/guide/authjs/nuxt-auth-handler#secret).
@@ -36,7 +36,7 @@ When deploying a Local or Refresh -provider based app, you will only need to set
3636

3737
This path can either be:
3838

39-
- **Reletive**: Pointing at a path inside your own application (e.g. `/api/auth`)
39+
- **Relative**: Pointing at a path inside your own application (e.g. `/api/auth`)
4040
- **Absolute**: Pointing at a path inside an external application (e.g. `https://my-auth-backend/api`)
4141

4242
:::warning

docs/guide/application-side/configuration.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default defineNuxtConfig({
88
auth: {
99
isEnabled: true,
1010
disableServerSideAuth: false,
11+
originEnvKey: 'AUTH_ORIGIN',
1112
baseURL: 'http://localhost:3000/api/auth',
1213
provider: { /* your provider config */ },
1314
sessionRefresh: {
@@ -25,6 +26,13 @@ export default defineNuxtConfig({
2526

2627
Whether the module is enabled at all
2728

29+
## `originEnvKey`
30+
31+
- **Type**: `string`
32+
- **Default**: `AUTH_ORIGIN`
33+
34+
The name of the environment variable that holds the origin of the application. This is used to determine the origin of your application in production. Read more [here](/resources/error-reference#auth-no-origin).
35+
2836
## `disableServerSideAuth`
2937

3038
- **Type**: `boolean`
@@ -144,7 +152,7 @@ export default new CustomRefreshHandler()
144152

145153
If no custom RefreshHandler is defined, the [built-in-handler](https://github.com/sidebase/nuxt-auth/blob/main/src/runtime/utils/refreshHandler.ts) will be used to handle refreshes.
146154

147-
### `globalAppMiddleware`
155+
## `globalAppMiddleware`
148156

149157
- **Type:** `GlobalMiddlewareOptions | boolean`
150158
- **Default**: `false`

docs/package.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)