Skip to content

docs: update documentation to 1.0.0-rc.1 #1029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/.vitepress/routes/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ export const routes: DefaultTheme.Config['nav'] = [
],
},
{
text: '0.10.0',
text: '1.0.0-rc.1',
items: [
{
text: '0.10.0',
link: 'https://github.com/sidebase/nuxt-auth/tree/0.10.1/docs',
},
{
text: '0.9.4',
link: 'https://github.com/sidebase/nuxt-auth/tree/0.9.4/docs',
Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/routes/sidebar/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const routes: DefaultTheme.SidebarItem[] = [
text: 'Versions',
base: '/upgrade',
items: [
{
text: 'Version 1.0',
link: '/version-1.0'
},
{
text: 'Version 0.10.0',
link: '/version-0.10.0'
Expand Down
2 changes: 1 addition & 1 deletion docs/upgrade/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ title: 'Redirecting'
editLink: false
---

<meta http-equiv="refresh" content="0;URL='/upgrade/version-0.10.0'" />
<meta http-equiv="refresh" content="0;URL='/upgrade/version-1.0'" />
74 changes: 74 additions & 0 deletions docs/upgrade/version-1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Upgrade to 1.0.0-rc.1

> This is a pre-release. We encourage you to test it out and report all the issues you find with it.

> This release contains breaking changes for `signIn` and `signUp` functions

πŸŽ‰ We're excited to share that `@sidebase/nuxt-auth` is moving towards its 1.0 release! Read the [full roadmap here](https://github.com/sidebase/nuxt-auth/issues/1028).

## Installation

::: code-group

```bash [npm]
npm i -D @sidebase/nuxt-auth@^1.0.0-rc.1
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend we pin the version, as its still in RC. What do you think?

```

```bash [pnpm]
pnpm i -D @sidebase/nuxt-auth@^1.0.0-rc.1
```

```bash [yarn]
yarn add --dev @sidebase/nuxt-auth@^1.0.0-rc.1
```

:::

## :warning: Breaking changes

### `signUp` function in `local` provider
There's a breaking change in `local` provider `signUp` function which now only accepts 2 parameters. This is due to `signUp` having an [extra parameter](https://github.com/sidebase/nuxt-auth/blob/4b3a5904c9e0d3bce6a6334bf4a463d4835d4a48/src/runtime/composables/local/useAuth.ts#L170) from its initial implementation.

If you used `signUp` with three parameters, merge the third parameter into the second:
```ts diff
await signUp(credentials, { external: true }, { preventLoginFlow: true }) // [!code --]
await signUp(credentials, { external: true, preventLoginFlow: true }) // [!code ++]

await signUp(credentials, undefined, { preventLoginFlow: true }) // [!code --]
await signUp(credentials, { preventLoginFlow: true }) // [!code ++]
```

### `signIn` function in `authjs` provider
This function now [always](https://github.com/sidebase/nuxt-auth/blob/07199b1ccf74577890cab224c2782c7f88a9a9b6/src/runtime/composables/authjs/useAuth.ts#L90) returns an object [`SignInResult`](https://github.com/sidebase/nuxt-auth/blob/07199b1ccf74577890cab224c2782c7f88a9a9b6/src/runtime/composables/authjs/useAuth.ts#L29-L34):

```ts
interface SignInResult {
error: string | null
status: number
ok: boolean
url: any
}
```

This was done to remove the previously missing `| void` from the signature, improving type-safety and usability. If you checked for `void` being returned, adjust your usage accordingly:

```ts diff
const signInResponse = await signIn(/* ... */)

const isResponseDefined = signInResponse // [!code --]
const isResponseDefined = signInResponse.error === null // [!code ++]

if (isResponseDefined) {
// ...
}
```

## Changelog

* feat: return signin response if no redirection by @despatates in https://github.com/sidebase/nuxt-auth/pull/977
* Enh(#843): Allow signup flow return data when preventLoginFlow is true by @iamKiNG-Fr in https://github.com/sidebase/nuxt-auth/pull/903
* chore: display register error message by @DevDengChao in https://github.com/sidebase/nuxt-auth/pull/1015
* bump dependencies by @phoenix-ru in https://github.com/sidebase/nuxt-auth/pull/1016
* chore: refactor useAuth composables to encapsulate context by @phoenix-ru in https://github.com/sidebase/nuxt-auth/pull/1024

**Full Changelog**: https://github.com/sidebase/nuxt-auth/compare/0.10.1...v1.0.0-rc.1