Skip to content

Commit

Permalink
fix(adapter): improve Adapter docs, add runtime assertions (#6877)
Browse files Browse the repository at this point in the history
* docs(adapters): move dgraph adapters docs to source code

* refactor: review suggestions (1)

* docs(prisma): move content to source code

* chore: sort

* fix: dgraph logo and content
  • Loading branch information
ubbe-xyz authored and balazsorban44 committed Mar 5, 2023
1 parent 36286b1 commit 7462e79
Show file tree
Hide file tree
Showing 7 changed files with 271 additions and 237 deletions.
210 changes: 0 additions & 210 deletions docs/docs/reference/06-adapters/prisma.md

This file was deleted.

48 changes: 30 additions & 18 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

const fs = require("fs")
const path = require("path")

Expand All @@ -11,6 +13,25 @@ const providers = fs
const typedocConfig = require("./typedoc.json")
delete typedocConfig.$schema

/**
* @param {string} name
* @returns Record<string, any>
*/
function createTypeDocAdapterConfig(name) {
const slug = name.toLowerCase().replace(" ", "-")
return {
id: slug,
plugin: [require.resolve("./typedoc-mdn-links")],
watch: process.env.TYPEDOC_WATCH,
entryPoints: [`../packages/adapter-${slug}/src/index.ts`],
tsconfig: `../packages/adapter-${slug}/tsconfig.json`,
out: `reference/adapter/${slug}`,
sidebar: {
indexLabel: name,
},
}
}

/** @type {import("@docusaurus/types").Config} */
const docusaurusConfig = {
title: "Auth.js",
Expand Down Expand Up @@ -230,30 +251,21 @@ const docusaurusConfig = {
"docusaurus-plugin-typedoc",
{
...typedocConfig,
id: "firebase-adapter",
plugin: [require.resolve("./typedoc-mdn-links")],
watch: process.env.TYPEDOC_WATCH,
entryPoints: ["../packages/adapter-firebase/src/index.ts"],
tsconfig: "../packages/adapter-firebase/tsconfig.json",
out: "reference/adapter/firebase",
sidebar: {
indexLabel: "Firebase",
},
...createTypeDocAdapterConfig("Firebase"),
},
],
[
"docusaurus-plugin-typedoc",
{
...typedocConfig,
id: "dgraph-adapter",
plugin: [require.resolve("./typedoc-mdn-links")],
watch: process.env.TYPEDOC_WATCH,
entryPoints: ["../packages/adapter-dgraph/src/index.ts"],
tsconfig: "../packages/adapter-dgraph/tsconfig.json",
out: "reference/adapter/dgraph",
sidebar: {
indexLabel: "Dgraph",
},
...createTypeDocAdapterConfig("Dgraph"),
},
],
[
"docusaurus-plugin-typedoc",
{
...typedocConfig,
...createTypeDocAdapterConfig("Prisma"),
},
],
],
Expand Down
3 changes: 2 additions & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ module.exports = {
label: "Database Adapters",
link: { type: "doc", id: "reference/adapters/overview" },
items: [
{ type: "doc", id: "reference/adapter/firebase/index" },
{ type: "doc", id: "reference/adapter/dgraph/index" },
{ type: "doc", id: "reference/adapter/firebase/index" },
{ type: "doc", id: "reference/adapter/prisma/index" },
{ type: "autogenerated", dirName: "reference/06-adapters" },
],
},
Expand Down
6 changes: 0 additions & 6 deletions packages/adapter-dgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<p align="center">
Open Source. Full Stack. Own Your Data.
</p>
<!-- <p align="center" style="align: center;">
<img src="https://github.com/nextauthjs/next-auth/actions/workflows/release.yml/badge.svg?branch=main" alt="CI Test" />
<img src="https://img.shields.io/bundlephobia/minzip/@next-auth/prisma-adapter" alt="Bundle Size"/>
<img src="https://img.shields.io/npm/v/@next-auth/prisma-adapter" alt="@next-auth/prisma-adapter Version" />
</p> -->
</p>

## Overview
Expand Down Expand Up @@ -152,7 +147,6 @@ type User

We're open to all community contributions! If you'd like to contribute in any way, please read our [Contributing Guide](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md).


## License

ISC
15 changes: 15 additions & 0 deletions packages/adapter-dgraph/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions packages/adapter-dgraph/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
* <div style={{display: "flex", justifyContent: "space-between", alignItems: "center", padding: 16}}>
* <p style={{fontWeight: "normal"}}>Official <a href="https://dgraph.io/">Dgraph</a> adapter for Auth.js / NextAuth.js.</p>
* <p style={{fontWeight: "normal"}}>Official <a href="https://dgraph.io/docs">Dgraph</a> adapter for Auth.js / NextAuth.js.</p>
* <a href="https://dgraph.io/">
* <img style={{display: "block"}} src="https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/adapter-dgraph/logo.svg" height="30"/>
* </a>
* </div>
*
* ## Installation
Expand Down Expand Up @@ -41,7 +44,7 @@ export { format }
/**
* ### Basic usage
*
* Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object.
* Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object:
*
* ```ts title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
Expand Down

0 comments on commit 7462e79

Please sign in to comment.