Skip to content

Commit 8751fa4

Browse files
authored
chore(adapters): cleanup extraneous documentation in adapter and fix testing and release GHA (#10854)
1 parent fbc89ea commit 8751fa4

File tree

31 files changed

+102
-2656
lines changed

31 files changed

+102
-2656
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ env:
7474

7575
jobs:
7676
test:
77-
name: Run release
77+
name: Test
7878
runs-on: ubuntu-latest
7979
steps:
8080
- name: Init
8181
uses: actions/checkout@v4
8282
with:
8383
fetch-depth: 0
8484
- name: Install pnpm
85-
uses: pnpm/action-setup@v2.2.4
85+
uses: pnpm/action-setup@v4
8686
- name: Setup Node
8787
uses: actions/setup-node@v4
8888
with:
@@ -114,7 +114,7 @@ jobs:
114114
if: steps.playwright-cache.outputs.cache-hit != 'true' && github.repository == 'nextauthjs/next-auth'
115115
run: |
116116
pnpm exec playwright install --with-deps chromium
117-
- name: Run Docker E2E
117+
- name: Run E2E tests (Nextjs-Docker)
118118
continue-on-error: true
119119
if: false
120120
timeout-minutes: 15
@@ -148,29 +148,30 @@ jobs:
148148
name: playwright-traces
149149
path: "**/packages/utils/test-results/*/trace.zip"
150150
retention-days: 7
151-
- uses: codecov/codecov-action@v3
151+
- uses: codecov/codecov-action@v4
152152
if: always()
153153
name: Coverage
154154
with:
155155
token: ${{ secrets.CODECOV_TOKEN }}
156156

157157
release-branch:
158158
name: Publish branch
159+
timeout-minutes: 120
159160
runs-on: ubuntu-latest
160161
needs: test
161162
if: ${{ github.event_name == 'push' }}
162163
environment: Production
163164
steps:
164165
- name: Init
165-
uses: actions/checkout@v3
166+
uses: actions/checkout@v4
166167
with:
167168
fetch-depth: 0
168169
# Please upvote https://github.com/orgs/community/discussions/13836
169170
token: ${{ secrets.GH_PAT }}
170171
- name: Install pnpm
171-
uses: pnpm/action-setup@v2.2.4
172+
uses: pnpm/action-setup@v4
172173
- name: Setup Node
173-
uses: actions/setup-node@v3
174+
uses: actions/setup-node@v4
174175
with:
175176
cache: "pnpm"
176177
- name: Install dependencies
@@ -183,17 +184,18 @@ jobs:
183184
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
184185
release-pr:
185186
name: Publish PR
187+
timeout-minutes: 120
186188
runs-on: ubuntu-latest
187189
needs: test
188190
if: ${{ github.event_name == 'pull_request' }}
189191
environment: Preview
190192
steps:
191193
- name: Init
192-
uses: actions/checkout@v3
194+
uses: actions/checkout@v4
193195
- name: Install pnpm
194-
uses: pnpm/action-setup@v2.2.4
196+
uses: pnpm/action-setup@v4
195197
- name: Setup Node
196-
uses: actions/setup-node@v3
198+
uses: actions/setup-node@v4
197199
with:
198200
node-version: 18
199201
cache: "pnpm"
@@ -228,11 +230,11 @@ jobs:
228230
if: ${{ github.event_name == 'workflow_dispatch' }}
229231
steps:
230232
- name: Init
231-
uses: actions/checkout@v3
233+
uses: actions/checkout@v4
232234
- name: Install pnpm
233-
uses: pnpm/action-setup@v2.2.4
235+
uses: pnpm/action-setup@v4
234236
- name: Setup Node
235-
uses: actions/setup-node@v3
237+
uses: actions/setup-node@v4
236238
with:
237239
node-version: 18
238240
cache: "pnpm"

apps/dev/express/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ app.get(
5656
authenticatedUser,
5757
async (_req: Request, res: Response) => {
5858
res.json(res.locals.session)
59-
},
59+
}
6060
)
6161

6262
app.get("/", async (_req: Request, res: Response) => {

apps/examples/nextjs/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ RUN apk add --no-cache libc6-compat
77
WORKDIR /app
88

99
# Install dependencies
10-
COPY package.json ./
11-
RUN npm i
10+
COPY package.json pnpm-lock.yaml ./
11+
RUN corepack enable && pnpm install
1212

1313

1414
# Rebuild the source code only when needed
@@ -54,4 +54,4 @@ ENV PORT 3000
5454

5555
# server.js is created by next build from the standalone output
5656
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
57-
CMD HOSTNAME="0.0.0.0" node server.js
57+
CMD HOSTNAME="0.0.0.0" node server.js

apps/examples/nextjs/app/[...proxy]/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function stripContentEncoding(result: Response) {
1313
})
1414
}
1515

16-
export async function handler(request: NextRequest) {
16+
async function handler(request: NextRequest) {
1717
const session = await auth()
1818

1919
const headers = new Headers(request.headers)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "3"
2+
3+
services:
4+
authjs-docker-test:
5+
environment:
6+
- TEST_KEYCLOAK_USERNAME
7+
- TEST_KEYCLOAK_PASSWORD
8+
- AUTH_KEYCLOAK_ID
9+
- AUTH_KEYCLOAK_SECRET
10+
- AUTH_KEYCLOAK_ISSUER
11+
- AUTH_SECRET="MohY0/2zSQw/psWEnejC2ka3Al0oifvY4YjOkUaFfnI="
12+
- AUTH_URL=http://localhost:3000/auth
13+
build:
14+
context: .
15+
dockerfile: Dockerfile
16+
ports:
17+
- "3000:3000"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# Easier to read `docker-compose up` output
4+
# export BUILDKIT_PROGRESS=plain
5+
6+
args=("-f" "docker-compose.yml")
7+
if [[ -z "${CI}" ]]; then
8+
args+=("--env-file" ".env")
9+
fi
10+
args+=("up" "--detach" "--build")
11+
12+
echo "Running: docker-compose ${args[*]}"
13+
14+
if ! docker-compose "${args[@]}"; then
15+
echo "Failed to start container"
16+
exit 1
17+
fi
18+
19+
echo "waiting 10 seconds for container to start..."
20+
sleep 10
21+
22+
# Used to control which env vars to load in the playwright process
23+
export TEST_DOCKER=1
24+
25+
# Always stop container, but exit with 1 when tests are failing
26+
if playwright test -c ../../../packages/utils/playwright.config.ts; then
27+
docker-compose down
28+
else
29+
docker-compose down && exit 1
30+
fi

packages/adapter-azure-tables/src/index.ts

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* <div style={{display: "flex", justifyContent: "space-between", alignItems: "center", padding: "16px"}}>
3-
* <p style={{fontWeight: "300"}}>An official <a href="https://azure.microsoft.com/en-us/products/storage/tables">Azure Table Storage</a> adapter for Auth.js / NextAuth.js.</p>
3+
* <p>An official <a href="https://azure.microsoft.com/en-us/products/storage/tables">Azure Table Storage</a> adapter for Auth.js / NextAuth.js.</p>
44
* <a href="https://azure.microsoft.com/en-us/products/storage/tables">
55
* <img style={{display: "block"}} src="/img/adapters/azure-tables.svg" width="48" />
66
* </a>
@@ -51,46 +51,7 @@ export function withoutKeys<T>(
5151

5252
return entity
5353
}
54-
/**
55-
*
56-
* 1. Create a table for authentication data, `auth` in the example below.
57-
*
58-
* ```js title="auth.ts"
59-
* import type { AuthConfig } from "next-auth"
60-
* import { TableStorageAdapter } from "@next-auth/azure-tables-adapter"
61-
* import { AzureNamedKeyCredential, TableClient } from "@azure/data-tables"
62-
*
63-
* const credential = new AzureNamedKeyCredential(
64-
* process.env.AZURE_ACCOUNT,
65-
* process.env.AZURE_ACCESS_KEY
66-
* )
67-
* const authClient = new TableClient(
68-
* process.env.AZURE_TABLES_ENDPOINT,
69-
* "auth",
70-
* credential
71-
* )
72-
*
73-
* // For more information on each option (and a full list of options) go to
74-
* // https://authjs.dev/reference/core/types#authconfig
75-
* export default const authConfig = {
76-
* // https://authjs.dev/getting-started/authentication/oauth
77-
* providers: [
78-
* // ...
79-
* ],
80-
* adapter: TableStorageAdapter(authClient),
81-
* // ...
82-
* } satisfies AuthConfig
83-
* ```
84-
*
85-
* Environment variable are as follows:
86-
*
87-
* ```
88-
* AZURE_ACCOUNT=storageaccountname
89-
* AZURE_ACCESS_KEY=longRandomKey
90-
* AZURE_TABLES_ENDPOINT=https://$AZURE_ACCOUNT.table.core.windows.net
91-
* ```
92-
*
93-
*/
54+
9455
export const TableStorageAdapter = (client: TableClient): Adapter => {
9556
return {
9657
async createUser(user) {

packages/adapter-d1/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* <div style={{display: "flex", justifyContent: "space-between", alignItems: "center", padding: "16px"}}>
3-
* <p style={{fontWeight: "normal"}}>An official <a href="https://developers.cloudflare.com/d1/">Cloudflare D1</a> adapter for Auth.js / NextAuth.js.</p>
3+
* <p>An official <a href="https://developers.cloudflare.com/d1/">Cloudflare D1</a> adapter for Auth.js / NextAuth.js.</p>
44
* <a href="https://developers.cloudflare.com/d1/">
55
* <img style={{display: "block"}} src="/img/adapters/d1.svg" width="48" />
66
* </a>

0 commit comments

Comments
 (0)