diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index fecaaba0..00000000 --- a/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -root = true - -[*] -indent_size = 2 -indent_style = space -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false -indent_size = 4 diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index de4d1f00..00000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist -node_modules diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 4eb22f8a..00000000 --- a/.eslintrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": [ - "@nuxtjs/eslint-config-typescript" - ], - "overrides": [ - { - "files": [ - "./**/*" - ], - "rules": { - "no-console": [ - "error", - { - "allow": [ - "info", - "warn", - "trace", - "error" - ] - } - ] - } - } - ] -} diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index da284b83..a5452899 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -41,10 +41,10 @@ Before posting an enchantment, please consider the following questions: - Would it require a major, minor, or patch release? - Which providers would be impacted by this change? -> [!IMPORTANT] +> [!IMPORTANT] > The more impact your Enchantment has on the package, the longer it may take to push, as we need to integrate it into our release cycle. -> [!IMPORTANT] +> [!IMPORTANT] > While we appreciate every request, we cannot accept them all. Please be understanding if we do not accept your request. ## Pull requests @@ -94,10 +94,10 @@ To start developing on this package, please follow the quick start guide below. ``` 8. [Open a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests), and fill out the provided fields. -> [!TIP] +> [!TIP] > Read more about how to use the included playground [here](../README.md#development). -> [!IMPORTANT] +> [!IMPORTANT] > By submitting a Pull request, you agree to license your work under the MIT license used by the project. ### Reviews @@ -106,7 +106,7 @@ After you submit your Pull request, a member of our core team will review it. Pl After receiving a review, please address any comments left by the reviewer or debate them if you disagree. This process will repeat until the pull request is approved and merged! -> [!NOTE] +> [!NOTE] > Besides a manual review of your pull request, we will run an automated CI pipeline on your code. ## Release cycles @@ -119,7 +119,7 @@ This package follows [Semantic Versioning 2.0.0](https://semver.org/). If we release a pre-version of a new release, we will tag it with `next` in the npmjs release and add one of the following additions to the versions: -- **ALPHA**: Early development build of a new release +- **ALPHA**: Early development build of a new release - Not properly tested yet - **RC**: Potential release candidate of a new release - Internally tested on a series of demo apps diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ef48f7e7..0fe7df89 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,7 +19,6 @@ ### 📚 Description - ### 📝 Checklist - [ ] I have linked an issue or discussion. diff --git a/.github/reproduire/needs-reproduction.md b/.github/reproduire/needs-reproduction.md index 1b794148..ad62e6b2 100644 --- a/.github/reproduire/needs-reproduction.md +++ b/.github/reproduire/needs-reproduction.md @@ -1,11 +1,11 @@ Hello 👋 -Please provide a [reproduction](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction) for this issue 🙏 +Please provide a [reproduction](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction) for this issue 🙏
How can I create a reproduction? -Please use one of the following links to reproduce your issue. +Please use one of the following links to reproduce your issue. - https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz - https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0b72261..d0dd9904 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: nodejs CI +name: CI on: push: diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml new file mode 100644 index 00000000..b18c86b2 --- /dev/null +++ b/.github/workflows/pkg.pr.new.yml @@ -0,0 +1,41 @@ +name: Publish Commit +on: + push: + branches: + - '**' + tags: + - '!**' + pull_request: + +env: + NODE_VER: 22.5 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20] + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Use Node.js ${{ env.NODE_VER }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VER }} + cache: 'pnpm' + + - name: Install deps + run: pnpm i + + - name: Build and pack + run: pnpm prepack + + - name: Publish package preview + run: pnpx pkg-pr-new publish --compact diff --git a/.npmrc b/.npmrc index c7f8ad58..e208a7b3 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ shamefully-hoist=true strict-peer-dependencies=false link-workspace-packages=true +ignore-workspace-root-check=true diff --git a/README.md b/README.md index 3355e9ef..ef7316bb 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ npx nuxi@latest module add sidebase-auth
Or install manually - + #### 1. Install the package as a dev dependency ```sh @@ -53,7 +53,7 @@ npx nuxi@latest module add sidebase-auth ```ts export default defineNuxtConfig({ - modules: ['@sidebase/nuxt-auth'] + modules: ['@sidebase/nuxt-auth'] }) ```
@@ -64,8 +64,7 @@ Then visit the [Quick Start documentation](https://auth.sidebase.io/guide/gettin `@sidebase/nuxt-auth` is a library with the goal of supporting authentication for any universal Nuxt 3 application. At the moment three providers are supported: - [`authjs`](https://auth.sidebase.io/guide/authjs/quick-start): for non-static apps that want to use [Auth.js / NextAuth.js](https://github.com/nextauthjs/next-auth) to offer the reliability & convenience of a 23k star library to the Nuxt 3 ecosystem with a native developer experience (DX) -- [`local`](https://auth.sidebase.io/guide/local/quick-start): for static pages that rely on an external backend with a credential flow for authentication. -- [`refresh`](https://auth.sidebase.io/guide/local/quick-start#refresh-token): for static pages that rely on an external backend with a credential flow and refresh tokens for authentication. +- [`local`](https://auth.sidebase.io/guide/local/quick-start): for static pages that rely on an external backend with a credential flow for authentication. The Local Provider also supports refresh tokens since `v0.9.0`. Read more [here](https://auth.sidebase.io/upgrade/version-0.9.0). You can find a full list of our features, as well as which provider supports each feature [on our docs](https://auth.sidebase.io/guide/getting-started/choose-provider). @@ -80,7 +79,7 @@ You can find a full list of our features, as well as which provider supports eac - Methods to `getSession`, `getCsrfToken`, `getProviders`, `signIn` and `signOut` - Full TypeScript support for all methods and properties -### Application protection +### Application protection - Application-side middleware protection for the [full application](https://auth.sidebase.io/guide/application-side/protecting-pages#global-middleware) or [specific pages](https://auth.sidebase.io/guide/application-side/protecting-pages#local-middleware) - Server-side [middleware](https://auth.sidebase.io/guide/authjs/server-side/session-access#server-middleware) and [endpoint protection](https://auth.sidebase.io/guide/authjs/server-side/session-access#endpoint-protection) @@ -142,7 +141,6 @@ This module also has it's own playground: We have one playground per provider: - [`authjs`](./playground-authjs) - [`local`](./playground-local) -- [`refresh`](./playground-refresh) ##### How to test static Nuxt 3 apps? @@ -162,10 +160,10 @@ To test static Nuxt 3 apps we want to run a static frontend and a separate backe pnpm dev - # A second Nuxt app should now be running on http://localhost:3001. + # A second Nuxt app should now be running on http://localhost:3001. # We use this purely for authentication ``` -4. Visit [http://localhost:3000](http://localhost:3000) -> this should open the static application. Performing any auth-related actions, the app should send requests to the backend running on port `3001` +4. Visit [http://localhost:3000](http://localhost:3000) -> this should open the static application. Performing any auth-related actions, the app should send requests to the backend running on port `3001` ## Contributing diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 2d5235fa..fa0915b9 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -34,7 +34,7 @@ export default defineConfig({ }, editLink: { pattern: 'https://github.com/sidebase/nuxt-auth/tree/main/docs/:path', - text: 'Edit this page on GitHub' - } + text: 'Edit this page on GitHub', + }, }, }) diff --git a/docs/.vitepress/head.ts b/docs/.vitepress/head.ts index b2c2ac79..7c8aa90e 100644 --- a/docs/.vitepress/head.ts +++ b/docs/.vitepress/head.ts @@ -1,10 +1,10 @@ -import type { HeadConfig } from "vitepress" +import type { HeadConfig } from 'vitepress' const HOST_NAME = 'https://auth.sidebase.io' const OG_IMAGE_URL = `${HOST_NAME}/nuxt-auth-og.jpg` export const sitemapConfig = { - hostname: HOST_NAME + hostname: HOST_NAME, } export const headConfig: HeadConfig[] = [ diff --git a/docs/.vitepress/routes/navbar.ts b/docs/.vitepress/routes/navbar.ts index fd2f0cef..c2de2a18 100644 --- a/docs/.vitepress/routes/navbar.ts +++ b/docs/.vitepress/routes/navbar.ts @@ -13,7 +13,7 @@ export const routes: DefaultTheme.Config['nav'] = [ link: '/guide/authjs/quick-start', }, { - text: 'Local / Refresh guide', + text: 'Local guide', link: '/guide/local/quick-start', }, ], @@ -25,6 +25,10 @@ export const routes: DefaultTheme.Config['nav'] = [ text: 'Overview', link: '/resources/overview', }, + { + text: 'Upgrade Guides', + link: '/upgrade', + }, { text: 'Recipes', link: '/recipes/introduction/welcome', @@ -40,8 +44,12 @@ export const routes: DefaultTheme.Config['nav'] = [ ], }, { - text: '0.8.0', + text: '0.9.1', items: [ + { + text: '0.8.2', + link: 'https://github.com/sidebase/nuxt-auth/tree/0.8.2/docs', + }, { text: '0.7.2', link: 'https://github.com/sidebase/nuxt-auth/tree/0.7.2/docs/content', diff --git a/docs/.vitepress/routes/sidebar/guide.ts b/docs/.vitepress/routes/sidebar/guide.ts index ce07216b..7e822a2d 100644 --- a/docs/.vitepress/routes/sidebar/guide.ts +++ b/docs/.vitepress/routes/sidebar/guide.ts @@ -69,7 +69,7 @@ export const routes: DefaultTheme.SidebarItem[] = [ ], }, { - text: 'Local / Refresh Provider', + text: 'Local Provider', base: '/guide/local', items: [ { diff --git a/docs/.vitepress/routes/sidebar/index.ts b/docs/.vitepress/routes/sidebar/index.ts index 91240e73..e54b7582 100644 --- a/docs/.vitepress/routes/sidebar/index.ts +++ b/docs/.vitepress/routes/sidebar/index.ts @@ -2,8 +2,10 @@ import type { DefaultTheme } from 'vitepress' import { routes as guideRoutes } from './guide' import { routes as recipesRoutes } from './recipes' +import { routes as upgradeRoutes } from './upgrade' export const routes: DefaultTheme.Config['sidebar'] = { '/guide': guideRoutes, - '/recipes': recipesRoutes + '/recipes': recipesRoutes, + '/upgrade': upgradeRoutes } diff --git a/docs/.vitepress/routes/sidebar/upgrade.ts b/docs/.vitepress/routes/sidebar/upgrade.ts new file mode 100644 index 00000000..b4945ed5 --- /dev/null +++ b/docs/.vitepress/routes/sidebar/upgrade.ts @@ -0,0 +1,18 @@ +import type { DefaultTheme } from 'vitepress' + +export const routes: DefaultTheme.SidebarItem[] = [ + { + text: 'Versions', + base: '/upgrade', + items: [ + { + text: 'Version 0.9.0', + link: '/version-0.9.0' + }, + { + text: 'Version 0.8.0', + link: '/version-0.8.0' + } + ], + }, +] diff --git a/docs/.vitepress/theme/components/Banner.vue b/docs/.vitepress/theme/components/Banner.vue index f05e310a..f710d151 100644 --- a/docs/.vitepress/theme/components/Banner.vue +++ b/docs/.vitepress/theme/components/Banner.vue @@ -1,10 +1,10 @@