Skip to content

Commit

Permalink
docs: api reference restructure (#6608)
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Feb 4, 2023
1 parent fb43c5d commit e9d8805
Show file tree
Hide file tree
Showing 18 changed files with 1,092 additions and 791 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pnpm-lock.yaml

.docusaurus
build
docs/docs/reference/03-core
docs/docs/reference/04-sveltekit
docs/docs/reference/core
docs/docs/reference/sveltekit
static

# --------------- Packages ---------------
Expand Down
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ packages/next-auth/utils
packages/next-auth/core
packages/next-auth/jwt
packages/next-auth/react
packages/next-auth/adapters.d.ts
packages/next-auth/adapters.js
packages/next-auth/index.d.ts
packages/next-auth/index.js
packages/next-auth/next
packages/next-auth/middleware.d.ts
packages/next-auth/middleware.js
packages/*/*.js
packages/*/*.d.ts
packages/*/*.d.ts.map

# Development app
apps/dev/src/css
Expand Down Expand Up @@ -88,8 +85,8 @@ packages/core/src/providers/oauth-types.ts
packages/core/lib
packages/core/providers
packages/core/src/lib/pages/styles.ts
docs/docs/reference/03-core
docs/docs/reference/04-sveltekit
docs/docs/reference/core
docs/docs/reference/sveltekit


# SvelteKit
Expand Down
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pnpm-lock.yaml

.docusaurus
build
docs/docs/reference/03-core
docs/docs/reference/04-sveltekit
docs/docs/reference/core
docs/docs/reference/sveltekit
static
docs/providers.json

Expand Down
7 changes: 3 additions & 4 deletions apps/playgrounds/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"name": "playground-nuxt",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "export NODE_OPTIONS='--no-experimental-fetch' && nuxt dev",
"build": "nuxt prepare && nuxt build",
"dev": "nuxt prepare && export NODE_OPTIONS='--no-experimental-fetch' && nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
"preview": "nuxt preview"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.1.1",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/03-basics/refresh-token-rotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Using a JWT to store the `refresh_token` is less secure than saving it in a data

#### JWT strategy

Using the [jwt](../../reference/03-core/interfaces/types.CallbacksOptions.md#jwt) and [session](../../reference/03-core/interfaces/types.CallbacksOptions.md#session) callbacks, we can persist OAuth tokens and refresh them when they expire.
Using the [jwt](../../reference/core/interfaces/types.CallbacksOptions.md#jwt) and [session](../../reference/core/interfaces/types.CallbacksOptions.md#session) callbacks, we can persist OAuth tokens and refresh them when they expire.

Below is a sample implementation using Google's Identity Provider. Please note that the OAuth 2.0 request in the `refreshAccessToken()` function will vary between different providers, but the core logic should remain similar.

Expand Down
25 changes: 0 additions & 25 deletions docs/docs/reference/index.md

This file was deleted.

43 changes: 17 additions & 26 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const docusaurusConfig = {
position: "left",
},
{
to: "/reference/core/modules/main",
to: "/reference/core",
// TODO: change to this when the overview page looks better.
// to: "/reference",
activeBasePath: "/reference",
Expand Down Expand Up @@ -101,7 +101,7 @@ const docusaurusConfig = {
announcementBar: {
id: "new-major-announcement",
content:
"<a target='_blank' rel='noopener noreferrer' href='https://next-auth.js.org'>NextAuth.js</a> is becoming Auth.js! 🎉 We're creating Authentication for the Web. Everyone included. Starting with SvelteKit, check out <a href='/reference/sveltekit'>the docs</a>.",
"<a target='_blank' rel='noopener noreferrer' href='https://next-auth.js.org'>NextAuth.js</a> is becoming Auth.js! 🎉 We're creating Authentication for the Web. Everyone included. Starting with SvelteKit, check out <a href='/reference/sveltekit'>the docs</a>. Note, this site is under active development.",
backgroundColor: "#000",
textColor: "#fff",
},
Expand Down Expand Up @@ -182,10 +182,7 @@ const docusaurusConfig = {
lastVersion: "current",
showLastUpdateAuthor: true,
showLastUpdateTime: true,
remarkPlugins: [
require("@sapphire/docusaurus-plugin-npm2yarn2pnpm").npm2yarn2pnpm,
require("remark-github"),
],
remarkPlugins: [require("@sapphire/docusaurus-plugin-npm2yarn2pnpm").npm2yarn2pnpm],
versions: {
current: {
label: "experimental",
Expand All @@ -204,35 +201,29 @@ const docusaurusConfig = {
{
...typedocConfig,
id: "core",
plugin: ["./tyepdoc"],
entryPoints: [
"index.ts",
"adapters.ts",
"errors.ts",
"jwt.ts",
"types.ts",
]
.map((e) => `${coreSrc}/${e}`)
.concat(providers),
tsconfig: "../packages/core/tsconfig.json",
out: "reference/03-core",
plugin: [require.resolve("./typedoc-mdn-links")],
watch: process.env.TYPEDOC_WATCH,
includeExtension: false,
entryPoints: ["index.ts", "adapters.ts", "errors.ts", "jwt.ts", "types.ts"].map((e) => `${coreSrc}/${e}`).concat(providers),
tsconfig: "../packages/core/tsconfig.json",
out: "reference/core",
sidebar: {
indexLabel: "index",
},
},
],
[
"docusaurus-plugin-typedoc",
{
...typedocConfig,
id: "sveltekit",
plugin: ["./tyepdoc"],
entryPoints: ["index.ts", "client.ts"].map(
(e) => `../packages/frameworks-sveltekit/src/lib/${e}`
),
tsconfig: "../packages/frameworks-sveltekit/tsconfig.json",
out: "reference/04-sveltekit",
plugin: [require.resolve("./typedoc-mdn-links")],
watch: process.env.TYPEDOC_WATCH,
includeExtension: false,
entryPoints: ["index.ts", "client.ts"].map((e) => `../packages/frameworks-sveltekit/src/lib/${e}`),
tsconfig: "../packages/frameworks-sveltekit/tsconfig.json",
out: "reference/sveltekit",
sidebar: {
indexLabel: "index",
},
},
],
],
Expand Down
7 changes: 4 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"repository": "https://github.com/nextauthjs/next-auth",
"name": "docs",
"scripts": {
"start": "TYPEDOC_WATCH=true docusaurus start --no-open --port 8000",
"start": "TYPEDOC_WATCH=true docusaurus start --no-open",
"dev": "pnpm providers && pnpm snippets && pnpm start",
"build": "pnpm providers && docusaurus build",
"docusaurus": "docusaurus",
Expand All @@ -27,7 +27,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-marquee-slider": "^1.1.5",
"remark-github": "10.1.0",
"styled-components": "5.3.6"
},
"devDependencies": {
Expand All @@ -37,7 +36,9 @@
"@docusaurus/preset-classic": "2.2.0",
"@docusaurus/theme-common": "2.2.0",
"@docusaurus/types": "2.2.0",
"docusaurus-plugin-typedoc": "^0.18.0"
"docusaurus-plugin-typedoc": "1.0.0-next.2",
"typedoc": "^0.23.24",
"typedoc-plugin-markdown": "4.0.0-next.2"
},
"browserslist": {
"production": [
Expand Down
47 changes: 7 additions & 40 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,28 @@ module.exports = {
},
],
referenceSidebar: [
"reference/index",
{
type: "category",
label: "@auth/core",
link: {
type: "doc",
id: "reference/core/modules/main",
},
items: [
{
type: "autogenerated",
dirName: "reference/03-core/modules",
// See: https://github.com/facebook/docusaurus/issues/5689
// exclude: ["index"],
},
{
type: "category",
label: "Reflections",
collapsed: true,
className: "reflection-category", // See src/index.css
items: [{ type: "autogenerated", dirName: "reference/03-core" }],
},
],
link: { type: "doc", id: "reference/core/index" },
items: [{ type: "autogenerated", dirName: "reference/core" }],
},
{
type: "category",
label: "@auth/sveltekit",
link: { type: "doc", id: "reference/sveltekit/modules/main" },
items: [
{ type: "autogenerated", dirName: "reference/04-sveltekit/modules" },
{
type: "category",
label: "Reflections",
collapsed: true,
className: "reflection-category", // See src/index.css
items: [{ type: "autogenerated", dirName: "reference/04-sveltekit" }],
},
],
link: { type: "doc", id: "reference/sveltekit/index" },
items: [{ type: "autogenerated", dirName: "reference/sveltekit" }],
},
{
type: "category",
label: "@auth/solid-start",
link: {
type: "doc",
id: "reference/solidstart/index",
},
items: ["reference/solidstart/client", "reference/solidstart/protected"],
link: { type: "doc", id: "reference/solidstart/index" },
items: [{ type: "autogenerated", dirName: "reference/04-solidstart" }],
},
{
type: "category",
label: "@auth/nextjs",
link: {
type: "doc",
id: "reference/nextjs/index",
},
link: { type: "doc", id: "reference/nextjs/index" },
items: [
"reference/nextjs/client",
{
Expand Down
25 changes: 1 addition & 24 deletions docs/src/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -272,27 +272,4 @@ html[data-theme="dark"] #carbonads > span {
html[data-theme="dark"] #carbonads .carbon-poweredby {
color: #aaa;
background: #1e2021;
}

/*
This is a hack to hide the "Reflection" category and "main" module from the sidebar.
This is because:
1. opening any page under the "Reflection" category would hide the entire sidebar.
2. the "main" module would show up twice.
See sidebars.js
*/
.reflection-category,
.theme-doc-sidebar-item-link-level-2 [href="/reference/core/modules/main"],
.theme-doc-sidebar-item-link-level-2
[href="/reference/sveltekit/modules/main"] {
display: none;
}

/*
HACK: to hide the "Classes" header and duplicate items together with the "typedoc-plugin-markdown" patch.
See: https://github.com/TypeStrong/typedoc/issues/2006
*/
/* h3.anchor + p:has(code, strong), */ /** hack did not work as it hides property types elsewhere */
#classes {
display: none;
}
}
File renamed without changes.
27 changes: 14 additions & 13 deletions docs/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
{
"excludeNotDocumented": true,
"$schema": "https://typedoc.org/schema.json",
"allReflectionsHaveOwnDocument": true,
"cleanOutputDir": true,
"disableSources": true,
"hideBreadcrumbs": true,
"excludeExternals": true,
"excludeInternal": true,
"excludeNotDocumented": true,
"excludePrivate": true,
"cleanOutputDir": true,
"excludeProtected": true,
"hideHierarchy": true,
"gitRevision": "main",
"hideBreadcrumbs": true,
"hideGenerator": true,
"intentionallyNotExported": [
"ReturnTypes",
"CallbackParameters",
"JsonValue"
],
"readme": "none",
"sort": ["kind", "static-first", "required-first", "alphabetical"],
"kindSortOrder": [
"Function",
"TypeAlias",
Expand All @@ -41,5 +34,13 @@
"IndexSignature",
"GetSignature",
"SetSignature"
]
}
],
"readme": "none",
"sort": [
"kind",
"static-first",
"required-first",
"alphabetical"
],
"symbolsWithOwnFile": "none"
}
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
"prettier": "2.8.1",
"prettier-plugin-svelte": "^2.8.1",
"turbo": "1.6.3",
"typedoc": "^0.23.22",
"typedoc-plugin-markdown": "^3.14.0",
"typescript": "4.9.4"
},
"engines": {
Expand All @@ -64,7 +62,6 @@
"undici": "5.11.0"
},
"patchedDependencies": {
"typedoc-plugin-markdown@3.14.0": "patches/typedoc-plugin-markdown@3.14.0.patch",
"@balazsorban/monorepo-release@0.1.8": "patches/@balazsorban__monorepo-release@0.1.8.patch"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* - [Getting started](https://authjs.dev/getting-started/introduction)
* - [Most common use case guides](https://authjs.dev/guides)
*
* @module main
* @module index
*/

import { assertConfig } from "./lib/assert.js"
Expand Down

1 comment on commit e9d8805

@vercel
Copy link

@vercel vercel bot commented on e9d8805 Feb 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.