Skip to content

Commit 046ff67

Browse files
committed
feat: selected providers are added to module
1 parent a376a9d commit 046ff67

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ jobs:
2727
# Check linting and typing
2828
- run: npm run lint
2929
- run: npm run types
30+
31+
# Check building
32+
- run: npm run build
33+
- run: npm run build:playground

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
2222
"lint": "eslint . --max-warnings=0",
2323
"types": "tsc --noEmit",
24-
"build": "nuxi build"
24+
"build:module": "nuxi build",
25+
"build:playground": "nuxi build playground",
26+
"start:playground": "node playground/.output/server/index.mjs"
2527
},
2628
"dependencies": {
2729
"@nuxt/kit": "^3.0.0-rc.12",

src/module.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ export default defineNuxtModule<ModuleOptions>({
6767
const providerOptions = nextAuthOptions.options.providers.map(({ id, name, type, options }) => ({ id, name, type, options }))
6868

6969
// 2.3. Create virtual imports
70-
// - TODO: add imports for all providers
71-
72-
// TODO: deduplicate providers
73-
const providerImports = providerOptions.map(({ id }) => `import ${id} from "next-auth/providers/${id}"`)
74-
const providerExports = providerOptions.map(({ id }) => `"${id}": ${id}`)
70+
const deduplicatedProviderIds = Array.from(new Set(providerOptions.map(({ id }) => id)))
71+
const providerImports = deduplicatedProviderIds.map(id => `import ${id} from "next-auth/providers/${id}"`)
72+
const providerExports = deduplicatedProviderIds.map(id => `"${id}": ${id}`)
7573

7674
// TODO: make `\n` OS-independent
7775
const providerModule = `

src/runtime/server/api/auth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { NextAuthConfig } from '../../../module'
99

1010
// @ts-ignore Virtual import declared in `module.ts` - TODO: make the import discoverable
1111
import nextConfig from '#sidebase/auth'
12+
// @ts-ignore Virtual import declared in `module.ts` - TODO: make the import discoverable
1213
import bundlesProviders from '#sidebase/providers'
1314

1415
// TODO: Make `NEXTAUTH_URL` configurable

0 commit comments

Comments
 (0)