Skip to content

Commit f925e0c

Browse files
feat: introduce @auth/firebase-adapter (#7803)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope. This PR is part of a series to convert adapters, using `@auth/core` for types. BREAKING CHANGE: If you are coming from the previous adapter, change your `package.json`: ```diff - "@next-auth/firebase-adapter": "0.0.0", + "@auth/firebase-adapter": "0.0.0", ``` And run `npm install`, `yarn install` or `pnpm install` respectively. **Note:** This packages is published as ESM-only
1 parent de4e20c commit f925e0c

File tree

8 files changed

+40
-35
lines changed

8 files changed

+40
-35
lines changed

.github/ISSUE_TEMPLATE/3_bug_adapter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ body:
2424
- "@auth/dgraph-adapter"
2525
- "@auth/dynamodb-adapter"
2626
- "@auth/fauna-adapter"
27-
- "@next-auth/firebase-adapter"
27+
- "@auth/firebase-adapter"
2828
- "@auth/mikro-orm-adapter"
2929
- "@auth/mongodb-adapter"
3030
- "@next-auth/neo4j-adapter"

.github/issue-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fauna:
1010
- "@auth/fauna-adapter"
1111

1212
firebase:
13-
- "@next-auth/firebase-adapter"
13+
- "@auth/firebase-adapter"
1414

1515
mikro-orm:
1616
- "@auth/mikro-orm-adapter"

packages/adapter-firebase/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
</a>
99
<h3 align="center"><b>Firebase Adapter</b> - NextAuth.js / Auth.js</a></h3>
1010
<p align="center" style="align: center;">
11-
<a href="https://npm.im/@next-auth/firebase-adapter">
11+
<a href="https://npm.im/@auth/firebase-adapter">
1212
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
1313
</a>
14-
<a href="https://npm.im/@next-auth/firebase-adapter">
15-
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/firebase-adapter?color=green&label=@next-auth/firebase-adapter&style=flat-square">
14+
<a href="https://npm.im/@auth/firebase-adapter">
15+
<img alt="npm" src="https://img.shields.io/npm/v/@auth/firebase-adapter?color=green&label=@auth/firebase-adapter&style=flat-square">
1616
</a>
17-
<a href="https://www.npmtrends.com/@next-auth/firebase-adapter">
18-
<img src="https://img.shields.io/npm/dm/@next-auth/firebase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
17+
<a href="https://www.npmtrends.com/@auth/firebase-adapter">
18+
<img src="https://img.shields.io/npm/dm/@auth/firebase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
1919
</a>
2020
<a href="https://github.com/nextauthjs/next-auth/stargazers">
2121
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

packages/adapter-firebase/package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@next-auth/firebase-adapter",
2+
"name": "@auth/firebase-adapter",
33
"version": "2.0.1",
4-
"description": "Firebase adapter for next-auth.",
4+
"description": "Firebase adapter for Auth.js",
55
"homepage": "https://authjs.dev",
66
"repository": "https://github.com/nextauthjs/next-auth",
77
"bugs": {
@@ -13,17 +13,18 @@
1313
"Alex Meuer <[email protected]>"
1414
],
1515
"type": "module",
16+
"types": "./index.d.ts",
17+
"files": [
18+
"*.js",
19+
"*.d.ts*",
20+
"src"
21+
],
1622
"exports": {
1723
".": {
1824
"types": "./index.d.ts",
1925
"import": "./index.js"
2026
}
2127
},
22-
"files": [
23-
"src",
24-
"*.js",
25-
"*.d.ts*"
26-
],
2728
"license": "ISC",
2829
"keywords": [
2930
"next-auth",
@@ -40,16 +41,17 @@
4041
"build": "tsc",
4142
"test": "firebase emulators:exec --only firestore --project next-auth-test 'jest -c tests/jest.config.js'"
4243
},
44+
"dependencies": {
45+
"@auth/core": "workspace:*"
46+
},
4347
"peerDependencies": {
44-
"firebase-admin": "^11.4.1",
45-
"next-auth": "^4"
48+
"firebase-admin": "^11.4.1"
4649
},
4750
"devDependencies": {
4851
"@next-auth/adapter-test": "workspace:*",
4952
"@next-auth/tsconfig": "workspace:*",
5053
"firebase-admin": "^11.4.1",
5154
"firebase-tools": "^11.16.1",
52-
"jest": "^29.3.1",
53-
"next-auth": "workspace:*"
55+
"jest": "^29.3.1"
5456
}
55-
}
57+
}

packages/adapter-firebase/src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
* ## Installation
1313
*
1414
* ```bash npm2yarn2pnpm
15-
* npm install next-auth @next-auth/firebase-adapter firebase-admin
15+
* npm install @auth/firebase-adapter firebase-admin
1616
* ```
1717
*
18-
* @module @next-auth/firebase-adapter
18+
* @module @auth/firebase-adapter
1919
*/
2020

2121
import { type AppOptions, getApps, initializeApp } from "firebase-admin/app"
@@ -33,7 +33,7 @@ import type {
3333
AdapterAccount,
3434
AdapterSession,
3535
VerificationToken,
36-
} from "next-auth/adapters"
36+
} from "@auth/core/adapters"
3737

3838
/** Configure the Firebase Adapter. */
3939
export interface FirebaseAdapterConfig extends AppOptions {
@@ -52,7 +52,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
5252
* @example
5353
* ```ts title="pages/api/auth/[...nextauth].ts"
5454
* import NextAuth from "next-auth"
55-
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
55+
* import { FirestoreAdapter } from "@auth/firebase-adapter"
5656
*
5757
* export default NextAuth({
5858
* adapter: FirestoreAdapter({ namingStrategy: "snake_case" })
@@ -78,7 +78,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
7878
* @example
7979
* ```ts title="pages/api/auth/[...nextauth].ts"
8080
* import NextAuth from "next-auth"
81-
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
81+
* import { FirestoreAdapter } from "@auth/firebase-adapter"
8282
*
8383
* export default NextAuth({
8484
* adapter: FirestoreAdapter(),
@@ -95,7 +95,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
9595
* @example
9696
* ```ts title="pages/api/auth/[...nextauth].ts"
9797
* import NextAuth from "next-auth"
98-
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
98+
* import { FirestoreAdapter } from "@auth/firebase-adapter"
9999
* import { cert } from "firebase-admin/app"
100100
*
101101
* export default NextAuth({
@@ -125,7 +125,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
125125
* @example
126126
* ```ts title="pages/api/auth/[...nextauth].ts"
127127
* import NextAuth from "next-auth"
128-
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
128+
* import { FirestoreAdapter } from "@auth/firebase-adapter"
129129
* import { firestore } from "lib/firestore"
130130
*
131131
* export default NextAuth({
@@ -428,7 +428,7 @@ export function collectionsFactory(
428428
*
429429
* @example
430430
* ```ts title="lib/firestore.ts"
431-
* import { initFirestore } from "@next-auth/firebase-adapter"
431+
* import { initFirestore } from "@auth/firebase-adapter"
432432
* import { cert } from "firebase-admin/app"
433433
*
434434
* export const firestore = initFirestore({

packages/adapter-firebase/tsconfig.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
2+
"extends": "@next-auth/tsconfig/tsconfig.base.json",
33
"compilerOptions": {
4-
"strict": true,
5-
"noUncheckedIndexedAccess": true,
4+
"allowJs": true,
5+
"baseUrl": ".",
6+
"isolatedModules": true,
67
"target": "ES2020",
78
"module": "ESNext",
89
"moduleResolution": "node",
@@ -18,6 +19,7 @@
1819
"src/**/*"
1920
],
2021
"exclude": [
21-
"tests"
22+
"*.js",
23+
"*.d.ts",
2224
]
2325
}

pnpm-lock.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@auth/dgraph-adapter#build",
5959
"@auth/dynamodb-adapter#build",
6060
"@auth/fauna-adapter#build",
61-
"@next-auth/firebase-adapter#build",
61+
"@auth/firebase-adapter#build",
6262
"@auth/mikro-orm-adapter#build",
6363
"@auth/mongodb-adapter#build",
6464
"@next-auth/neo4j-adapter#build",
@@ -81,7 +81,7 @@
8181
"@auth/dgraph-adapter#build",
8282
"@auth/dynamodb-adapter#build",
8383
"@auth/fauna-adapter#build",
84-
"@next-auth/firebase-adapter#build",
84+
"@auth/firebase-adapter#build",
8585
"@auth/mikro-orm-adapter#build",
8686
"@auth/mongodb-adapter#build",
8787
"@next-auth/neo4j-adapter#build",

0 commit comments

Comments
 (0)