Compare commits

...

4 Commits

Author SHA1 Message Date
Balázs Orbán
2ad1cb3f8c chore(release): bump package version(s) [skip ci] 2022-12-14 02:51:15 +01:00
Balázs Orbán
98707282eb fix(release): tweak package metadata 2022-12-14 02:45:57 +01:00
Balázs Orbán
f4a2430891 fix(release): build packages before publish 2022-12-14 02:45:18 +01:00
Balázs Orbán
575bcb5710 chore: format sveltekit playground 2022-12-13 23:45:32 +01:00
14 changed files with 244 additions and 240 deletions

View File

@@ -1,8 +1,5 @@
{ {
"useTabs": true, "semi": false,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"], "plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."], "pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]

View File

@@ -1,15 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" /> <link rel="icon" href="%sveltekit.assets%/favicon.ico" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
%sveltekit.head% %sveltekit.head%
</head> </head>
<body> <body>
<div>%sveltekit.body%</div> <div>%sveltekit.body%</div>
</body> </body>
</html> </html>

View File

@@ -1,25 +1,7 @@
import SvelteKitAuth from "@auth/sveltekit" import SvelteKitAuth from "@auth/sveltekit"
import GitHub from '@auth/core/providers/github'; import GitHub from "@auth/core/providers/github"
import Google from '@auth/core/providers/google'; import { GITHUB_ID, GITHUB_SECRET } from "$env/static/private"
import Credentials from '@auth/core/providers/credentials';
import {
GITHUB_CLIENT_ID,
GITHUB_CLIENT_SECRET,
GOOGLE_CLIENT_ID,
GOOGLE_CLIENT_SECRET,
} from "$env/static/private"
export const handle = SvelteKitAuth({ export const handle = SvelteKitAuth({
providers: [ providers: [GitHub({ clientId: GITHUB_ID, clientSecret: GITHUB_SECRET })],
GitHub({ clientId: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET }), })
Google({ clientId: GOOGLE_CLIENT_ID, clientSecret: GOOGLE_CLIENT_SECRET }),
Credentials({
credentials: { password: { label: "Password", type: "password" } },
async authorize(credentials) {
if (credentials.password !== "pw") return null
return { name: "Fill Murray", email: "bill@fillmurray.com", image: "https://www.fillmurray.com/64/64", id: "1", foo: "" }
},
}),
],
debug: true,
});

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
export let provider: any; export let provider: any
</script> </script>
<form action={provider.signinUrl} method="POST"> <form action={provider.signinUrl} method="POST">

View File

@@ -1,12 +1,10 @@
import type { LayoutServerLoad } from "./$types" import type { LayoutServerLoad } from "./$types"
export const load: LayoutServerLoad = (event) => { export const load: LayoutServerLoad = (event) => {
console.log('layout server load', event.locals.getSession) console.log("layout server load", event.locals.getSession)
let session let session
if (event.locals.getSession) if (event.locals.getSession) {
{
session = event.locals.getSession() session = event.locals.getSession()
} }
return { return {
session, session,

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/stores'; import { page } from "$app/stores"
</script> </script>
<div> <div>
@@ -8,11 +8,17 @@
<p class="nojs-show loaded"> <p class="nojs-show loaded">
{#if Object.keys($page.data.session || {}).length} {#if Object.keys($page.data.session || {}).length}
{#if $page.data.session.user.image} {#if $page.data.session.user.image}
<span style="background-image: url('{$page.data.session.user.image}')" class="avatar" /> <span
style="background-image: url('{$page.data.session.user.image}')"
class="avatar"
/>
{/if} {/if}
<span class="signedInText"> <span class="signedInText">
<small>Signed in as</small><br /> <small>Signed in as</small><br />
<strong>{$page.data.session.user.email || $page.data.session.user.name}</strong> <strong
>{$page.data.session.user.email ||
$page.data.session.user.name}</strong
>
</span> </span>
<a href="/auth/signout" class="button">Sign out</a> <a href="/auth/signout" class="button">Sign out</a>
{:else} {:else}
@@ -33,9 +39,10 @@
<style> <style>
:global(body) { :global(body) {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
'Segoe UI Symbol', 'Noto Color Emoji'; "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
padding: 0 1rem 1rem 1rem; padding: 0 1rem 1rem 1rem;
max-width: 680px; max-width: 680px;
margin: 0 auto; margin: 0 auto;

View File

@@ -1,25 +1,34 @@
<script> <script>
import { signIn, signOut } from '@auth/sveltekit/client'; import { signIn, signOut } from "@auth/sveltekit/client"
import { page } from '$app/stores'; import { page } from "$app/stores"
</script> </script>
<h1>SvelteKit + NextAuth.js Example</h1> <h1>SvelteKit + NextAuth.js Example</h1>
<p> <p>
This is an example site to demonstrate how to use <a href="https://kit.svelte.dev/">SvelteKit</a> This is an example site to demonstrate how to use <a
href="https://kit.svelte.dev/">SvelteKit</a
>
with <a href="https://next-auth.js.org">NextAuth.js</a> for authentication. with <a href="https://next-auth.js.org">NextAuth.js</a> for authentication.
{#if Object.keys($page.data.session || {}).length} {#if Object.keys($page.data.session || {}).length}
{#if $page.data.session.user.image} {#if $page.data.session.user.image}
<span style="background-image: url('{$page.data.session.user.image}')" class="avatar" /> <span
style="background-image: url('{$page.data.session.user.image}')"
class="avatar"
/>
{/if} {/if}
<span class="signedInText"> <span class="signedInText">
<small>Signed in as</small><br /> <small>Signed in as</small><br />
<strong>{$page.data.session.user.email || $page.data.session.user.name}</strong> <strong
>{$page.data.session.user.email || $page.data.session.user.name}</strong
>
</span> </span>
<button on:click={() => signOut()} class="button">Sign out</button> <button on:click={() => signOut()} class="button">Sign out</button>
{:else} {:else}
<span class="notSignedInText">You are not signed in</span> <span class="notSignedInText">You are not signed in</span>
<button on:click={() => signIn('github')}>Sign In with GitHub</button> <button on:click={() => signIn("github")}>Sign In with GitHub</button>
<button on:click={() => signIn('credentials', { redirect: false })}>Sign In credentials</button> <button on:click={() => signIn("credentials", { redirect: false })}
>Sign In credentials</button
>
{/if} {/if}
</p> </p>

View File

@@ -5,7 +5,7 @@
"repository": "https://github.com/nextauthjs/next-auth.git", "repository": "https://github.com/nextauthjs/next-auth.git",
"scripts": { "scripts": {
"build:app": "turbo run build --filter=next-auth-app", "build:app": "turbo run build --filter=next-auth-app",
"build": "turbo run build --filter=next-auth --filter=@next-auth/* --no-deps", "build": "turbo run build --filter=next-auth --filter=@next-auth/* --filter=@auth/* --no-deps",
"lint": "turbo run lint --filter=!next-auth-docs --parallel", "lint": "turbo run lint --filter=!next-auth-docs --parallel",
"test": "turbo run test --concurrency=1 --filter=!@next-auth/pouchdb-adapter --filter=!@next-auth/upstash-redis-adapter --filter=!next-auth-* --filter=[HEAD^1]", "test": "turbo run test --concurrency=1 --filter=!@next-auth/pouchdb-adapter --filter=!@next-auth/upstash-redis-adapter --filter=!next-auth-* --filter=[HEAD^1]",
"clean": "turbo run clean --no-cache", "clean": "turbo run clean --no-cache",
@@ -32,7 +32,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.0.0",
"husky": "^7.0.4", "husky": "^7.0.4",
"prettier": "2.7.1", "prettier": "2.8.1",
"pretty-quick": "^3.1.2", "pretty-quick": "^3.1.2",
"semver": "7.3.5", "semver": "7.3.5",
"stream-to-array": "2.3.0", "stream-to-array": "2.3.0",

View File

@@ -1,8 +1,8 @@
{ {
"name": "@auth/core", "name": "@auth/core",
"version": "0.1.1", "version": "0.1.2",
"description": "Authentication for the web.", "description": "Authentication for the web.",
"homepage": "https://next-auth.js.org", "homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth.git", "repository": "https://github.com/nextauthjs/next-auth.git",
"author": "Balázs Orbán <info@balazsorban.com>", "author": "Balázs Orbán <info@balazsorban.com>",
"contributors": [ "contributors": [
@@ -44,7 +44,7 @@
"@panva/hkdf": "1.0.2", "@panva/hkdf": "1.0.2",
"cookie": "0.5.0", "cookie": "0.5.0",
"jose": "4.11.1", "jose": "4.11.1",
"oauth4webapi": "2.0.4", "oauth4webapi": "2.0.5",
"preact": "10.11.3", "preact": "10.11.3",
"preact-render-to-string": "5.2.3" "preact-render-to-string": "5.2.3"
}, },

View File

@@ -7,7 +7,7 @@ module.exports = {
"prettier", "prettier",
], ],
plugins: ["svelte3", "@typescript-eslint"], plugins: ["svelte3", "@typescript-eslint"],
ignorePatterns: ["*.cjs"], ignorePatterns: ["*.cjs", "client.*", "index.*"],
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }], overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
settings: { settings: {
"svelte3/typescript": () => require("typescript"), "svelte3/typescript": () => require("typescript"),

View File

@@ -3,11 +3,5 @@ node_modules
/build /build
/.svelte-kit /.svelte-kit
/package /package
.env /index.*
.env.* /client.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

View File

@@ -1,6 +1,9 @@
{ {
"name": "@auth/sveltekit", "name": "@auth/sveltekit",
"version": "0.1.1", "version": "0.1.2",
"description": "Authentication for SvelteKit.",
"homepage": "https://sveltekit.authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth.git",
"author": "Thang Huu Vu <hi@thvu.dev>", "author": "Thang Huu Vu <hi@thvu.dev>",
"contributors": [ "contributors": [
"Thang Huu Vu <hi@thvu.dev>", "Thang Huu Vu <hi@thvu.dev>",
@@ -31,7 +34,7 @@
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0", "eslint-plugin-svelte3": "^4.0.0",
"next-auth": "workspace:*", "next-auth": "workspace:*",
"prettier": "^2.8.0", "prettier": "2.8.1",
"prettier-plugin-svelte": "^2.8.1", "prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0", "svelte": "^3.54.0",
"svelte-check": "^2.9.2", "svelte-check": "^2.9.2",

48
pnpm-lock.yaml generated
View File

@@ -21,7 +21,7 @@ importers:
eslint-plugin-node: ^11.1.0 eslint-plugin-node: ^11.1.0
eslint-plugin-promise: ^6.0.0 eslint-plugin-promise: ^6.0.0
husky: ^7.0.4 husky: ^7.0.4
prettier: 2.7.1 prettier: 2.8.1
pretty-quick: ^3.1.2 pretty-quick: ^3.1.2
semver: 7.3.5 semver: 7.3.5
stream-to-array: 2.3.0 stream-to-array: 2.3.0
@@ -43,8 +43,8 @@ importers:
eslint-plugin-node: 11.1.0_eslint@7.32.0 eslint-plugin-node: 11.1.0_eslint@7.32.0
eslint-plugin-promise: 6.0.0_eslint@7.32.0 eslint-plugin-promise: 6.0.0_eslint@7.32.0
husky: 7.0.4 husky: 7.0.4
prettier: 2.7.1 prettier: 2.8.1
pretty-quick: 3.1.3_prettier@2.7.1 pretty-quick: 3.1.3_prettier@2.8.1
semver: 7.3.5 semver: 7.3.5
stream-to-array: 2.3.0 stream-to-array: 2.3.0
ts-node: 10.5.0_ksn4eycaeggbrckn3ykh37hwf4 ts-node: 10.5.0_ksn4eycaeggbrckn3ykh37hwf4
@@ -128,7 +128,7 @@ importers:
'@fontsource/fira-mono': 4.5.10 '@fontsource/fira-mono': 4.5.10
'@neoconfetti/svelte': 1.0.0 '@neoconfetti/svelte': 1.0.0
'@sveltejs/adapter-auto': 1.0.0-next.90 '@sveltejs/adapter-auto': 1.0.0-next.90
'@sveltejs/kit': 1.0.0-next.586_svelte@3.54.0+vite@4.0.1 '@sveltejs/kit': 1.0.0-next.587_svelte@3.54.0+vite@4.0.1
'@types/cookie': 0.5.1 '@types/cookie': 0.5.1
'@typescript-eslint/eslint-plugin': 5.45.1_tdm6ms4ntwhlpozn7kjqrhum74 '@typescript-eslint/eslint-plugin': 5.45.1_tdm6ms4ntwhlpozn7kjqrhum74
'@typescript-eslint/parser': 5.45.1_s5ps7njkmjlaqajutnox5ntcla '@typescript-eslint/parser': 5.45.1_s5ps7njkmjlaqajutnox5ntcla
@@ -496,7 +496,7 @@ importers:
cookie: 0.5.0 cookie: 0.5.0
cssnano: 5.1.14 cssnano: 5.1.14
jose: 4.11.1 jose: 4.11.1
oauth4webapi: 2.0.4 oauth4webapi: 2.0.5
postcss: 8.4.19 postcss: 8.4.19
postcss-nested: 6.0.0 postcss-nested: 6.0.0
preact: 10.11.3 preact: 10.11.3
@@ -505,7 +505,7 @@ importers:
'@panva/hkdf': 1.0.2 '@panva/hkdf': 1.0.2
cookie: 0.5.0 cookie: 0.5.0
jose: 4.11.1 jose: 4.11.1
oauth4webapi: 2.0.4 oauth4webapi: 2.0.5
preact: 10.11.3 preact: 10.11.3
preact-render-to-string: 5.2.3_preact@10.11.3 preact-render-to-string: 5.2.3_preact@10.11.3
devDependencies: devDependencies:
@@ -531,7 +531,7 @@ importers:
eslint-config-prettier: ^8.5.0 eslint-config-prettier: ^8.5.0
eslint-plugin-svelte3: ^4.0.0 eslint-plugin-svelte3: ^4.0.0
next-auth: workspace:* next-auth: workspace:*
prettier: ^2.8.0 prettier: 2.8.1
prettier-plugin-svelte: ^2.8.1 prettier-plugin-svelte: ^2.8.1
svelte: ^3.54.0 svelte: ^3.54.0
svelte-check: ^2.9.2 svelte-check: ^2.9.2
@@ -544,7 +544,7 @@ importers:
devDependencies: devDependencies:
'@playwright/test': 1.28.1 '@playwright/test': 1.28.1
'@sveltejs/adapter-auto': 1.0.0-next.90 '@sveltejs/adapter-auto': 1.0.0-next.90
'@sveltejs/kit': 1.0.0-next.586_svelte@3.54.0+vite@4.0.1 '@sveltejs/kit': 1.0.0-next.587_svelte@3.54.0+vite@4.0.1
'@sveltejs/package': 1.0.0-next.6_gf4dcx76vtk2o62ixxeqx7chra '@sveltejs/package': 1.0.0-next.6_gf4dcx76vtk2o62ixxeqx7chra
'@typescript-eslint/eslint-plugin': 5.45.1_tdm6ms4ntwhlpozn7kjqrhum74 '@typescript-eslint/eslint-plugin': 5.45.1_tdm6ms4ntwhlpozn7kjqrhum74
'@typescript-eslint/parser': 5.45.1_s5ps7njkmjlaqajutnox5ntcla '@typescript-eslint/parser': 5.45.1_s5ps7njkmjlaqajutnox5ntcla
@@ -552,8 +552,8 @@ importers:
eslint-config-prettier: 8.5.0_eslint@8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0
eslint-plugin-svelte3: 4.0.0_2aagxyyd66x6iymg5nfckajqjq eslint-plugin-svelte3: 4.0.0_2aagxyyd66x6iymg5nfckajqjq
next-auth: link:../next-auth next-auth: link:../next-auth
prettier: 2.8.0 prettier: 2.8.1
prettier-plugin-svelte: 2.8.1_kaioqtfwjumrsfopsgfoca65re prettier-plugin-svelte: 2.8.1_sro2v6ld777payjtkjtiuogcxi
svelte: 3.54.0 svelte: 3.54.0
svelte-check: 2.10.1_svelte@3.54.0 svelte-check: 2.10.1_svelte@3.54.0
tslib: 2.4.1 tslib: 2.4.1
@@ -8303,8 +8303,8 @@ packages:
import-meta-resolve: 2.2.0 import-meta-resolve: 2.2.0
dev: true dev: true
/@sveltejs/kit/1.0.0-next.586_svelte@3.54.0+vite@4.0.1: /@sveltejs/kit/1.0.0-next.587_svelte@3.54.0+vite@4.0.1:
resolution: {integrity: sha512-lTYWy4voh/r4jz8qnurIATyrH2ZgHPUswYQ9KauyASSjQGYeB1TPDgwcafM/LtgMxpcvFgWsx2KeflykSHXKxg==} resolution: {integrity: sha512-F8zYXd7URcq57sGfrBRWTLtfj6JKkhNhwM4M8w4hNnJsJlZawPUvpybOSlIP87Z8URO8iCmyigQHxAYYzedrOg==}
engines: {node: '>=16.14'} engines: {node: '>=16.14'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true
@@ -20465,8 +20465,8 @@ packages:
resolution: {integrity: sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA==} resolution: {integrity: sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA==}
dev: false dev: false
/oauth4webapi/2.0.4: /oauth4webapi/2.0.5:
resolution: {integrity: sha512-d6NmQuOlCo6+HzNPG70Pl8T4WnHo/XPvQ3Dxus3fRvRjFmt9H+BggI/APyzQ4/jlcdIjPaOw81wIO6WkRGKfkg==} resolution: {integrity: sha512-KmoR3KxCwmr9KvL/c/6UVzQnc4CUjo+j8NSgD3bWYlZXpUmyOVw97nDVb0BKZhCcUtGsbll16v8vsnR5JbTZ9A==}
dev: false dev: false
/object-assign/4.1.1: /object-assign/4.1.1:
@@ -22375,6 +22375,16 @@ packages:
svelte: 3.54.0 svelte: 3.54.0
dev: true dev: true
/prettier-plugin-svelte/2.8.1_sro2v6ld777payjtkjtiuogcxi:
resolution: {integrity: sha512-KA3K1J3/wKDnCxW7ZDRA/QL2Q67N7Xs3gOERqJ5X1qFjq1DdnN3K1R29scSKwh+kA8FF67pXbYytUpvN/i3iQw==}
peerDependencies:
prettier: ^1.16.4 || ^2.0.0
svelte: ^3.2.0
dependencies:
prettier: 2.8.1
svelte: 3.54.0
dev: true
/prettier/2.7.1: /prettier/2.7.1:
resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==} resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==}
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
@@ -22387,6 +22397,12 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/prettier/2.8.1:
resolution: {integrity: sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==}
engines: {node: '>=10.13.0'}
hasBin: true
dev: true
/pretty-error/4.0.0: /pretty-error/4.0.0:
resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==} resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==}
dependencies: dependencies:
@@ -22451,7 +22467,7 @@ packages:
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
dev: true dev: true
/pretty-quick/3.1.3_prettier@2.7.1: /pretty-quick/3.1.3_prettier@2.8.1:
resolution: {integrity: sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==} resolution: {integrity: sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==}
engines: {node: '>=10.13'} engines: {node: '>=10.13'}
hasBin: true hasBin: true
@@ -22464,7 +22480,7 @@ packages:
ignore: 5.2.0 ignore: 5.2.0
mri: 1.2.0 mri: 1.2.0
multimatch: 4.0.0 multimatch: 4.0.0
prettier: 2.7.1 prettier: 2.8.1
dev: true dev: true
/pretty-time/1.1.0: /pretty-time/1.1.0: