-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Revamp NuxtAuth Example to use sidebase and version
0.6.0
(#31)
- Loading branch information
1 parent
321fded
commit 8272bdb
Showing
26 changed files
with
9,308 additions
and
18,752 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[**.{json,js,ts,y{a,}ml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
GITHUB_CLIENT_ID="YOUR_GIHUB_APPLICATION_ID" | ||
GITHUB_CLIENT_SECRET="YOUR_GIHUB_APPLICATION_SECRET" | ||
NUXT_SECRET="YOUR_NUXT_SECRET" | ||
ORIGIN="YOUR_ORIGIN" | ||
AUTH_SECRET="YOUR_NUXT_SECRET" | ||
AUTH_ORIGIN="YOUR_ORIGIN" | ||
CERTBOT_DOMAIN="YOUR_DOMAIN" | ||
CERTBOT_EMAIL="YOUR_ADMIN_EMAIL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ignore generate imports | ||
auto-imports.d.ts | ||
components.d.ts | ||
nuxt.d.ts | ||
|
||
# nuxt and other artefacts | ||
.nuxt | ||
.output | ||
node_modules | ||
dist | ||
public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"@nuxtjs/eslint-config-typescript" | ||
], | ||
"rules": { | ||
"vue/multi-word-component-names": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"./server/**/*.ts" | ||
], | ||
"rules": { | ||
"no-console": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"info", | ||
"warn", | ||
"trace", | ||
"error" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,53 @@ | ||
name: nodejs CI | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
branches: [ main ] | ||
pull_request: | ||
branches: [main] | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
lint: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 16.14.2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.14.2 | ||
|
||
- name: Setup | ||
run: npm i -g @antfu/ni | ||
|
||
- name: Install | ||
run: nci | ||
|
||
- name: Lint | ||
run: nr lint | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 16.14.2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.14.2 | ||
|
||
# Install locked dependencies and prepare types | ||
- run: npm ci | ||
- name: Setup | ||
run: npm i -g @antfu/ni | ||
|
||
# Check building | ||
- run: npm run build | ||
- name: Install | ||
run: nci | ||
|
||
# start dev-app and curl from it | ||
- run: "timeout 30 npm run dev & (sleep 10 && curl --fail localhost:3000)" | ||
- name: Build | ||
run: nr build | ||
|
||
# start prod-app and curl from it | ||
- run: "timeout 30 npm run start & (sleep 10 && curl --fail localhost:3000)" | ||
# TODO: Add more steps here, like "nr test" as you add the tooling for it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ node_modules | |
.output | ||
.env | ||
dist | ||
*.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
shamefully-hoist=true | ||
strict-peer-dependencies=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"editorconfig.editorconfig", | ||
"dbaeumer.vscode-eslint", | ||
"vue.volar", | ||
"bradlc.vscode-tailwindcss" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
// Use `eslint` for vue, ts and js | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"[vue]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[js]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[ts]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"eslint.validate": [ | ||
"javascript", | ||
"typescript", | ||
"vue" | ||
], | ||
// Tailwind Support, see https://tailwindcss.nuxt.dev/tailwind/editor-support | ||
"tailwindCSS.experimental.configFile": ".nuxt/tailwind.config.cjs", | ||
"files.associations": { | ||
"*.css": "tailwindcss" | ||
}, | ||
// Auto-complete `.value` attribute when volar is installed | ||
"volar.autoCompleteRefs": true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
<script setup lang="ts"> | ||
const { status, data, signOut, signIn } = useSession() | ||
const { status, data, signOut, signIn } = useAuth() | ||
</script> | ||
|
||
<template> | ||
<div class="w-full max-w-5xl mx-auto bg-white px-5 py-4 rounded-t shadow-xl"> | ||
<div class="flex items-center justify-between"> | ||
<div class="flex items-center space-x-2"> | ||
<img | ||
v-if="status === 'authenticated' && data?.user?.image" | ||
class="w-12 h-12 rounded-full" | ||
:src="data.user.image" | ||
alt="User Avatar" | ||
/> | ||
<h1 v-if="status === 'authenticated'" class="text-lg"> | ||
Authenticated as {{ data?.user?.name }}! | ||
</h1> | ||
<h1 v-else> | ||
Not logged in | ||
</h1> | ||
</div> | ||
<button v-if="status === 'authenticated'" class="flex items-center justify-center space-x-2 bg-red-500 text-white rounded-lg py-2 px-3 text-lg" @click="signOut({ callbackUrl: '/' })"> | ||
<span>Logout</span> | ||
</button> | ||
<button v-else class="flex items-center justify-center space-x-2 bg-green-500 text-white rounded-lg py-2 px-3 text-lg" @click="signIn()"> | ||
<i class="fa fa-right-to-bracket pt-0.5" /> | ||
<span>Login</span> | ||
</button> | ||
<div class="w-full max-w-5xl mx-auto bg-white px-5 py-4 rounded-t shadow-xl"> | ||
<div class="flex items-center justify-between"> | ||
<div class="flex items-center space-x-2"> | ||
<img | ||
v-if="status === 'authenticated' && data?.user?.image" | ||
class="w-12 h-12 rounded-full" | ||
:src="data.user.image" | ||
alt="User Avatar" | ||
> | ||
<h1 v-if="status === 'authenticated'" class="text-lg"> | ||
Authenticated as {{ data?.user?.name }}! | ||
</h1> | ||
<h1 v-else> | ||
Not logged in | ||
</h1> | ||
</div> | ||
<button v-if="status === 'authenticated'" class="flex items-center justify-center space-x-2 bg-red-500 text-white rounded-lg py-2 px-3 text-lg" @click="signOut({ callbackUrl: '/' })"> | ||
<span>Logout</span> | ||
</button> | ||
<button v-else class="flex items-center justify-center space-x-2 bg-green-500 text-white rounded-lg py-2 px-3 text-lg" @click="signIn()"> | ||
<i class="fa fa-right-to-bracket pt-0.5" /> | ||
<span>Login</span> | ||
</button> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.