Lint code

This commit is contained in:
2024-07-24 01:54:48 +02:00
parent 5c96b8eea0
commit f18bd1fd98
22 changed files with 13391 additions and 38 deletions

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example

75
README.md Normal file
View File

@@ -0,0 +1,75 @@
# Nuxt UI Minimal Starter
Look at [Nuxt docs](https://nuxt.com/docs/getting-started/introduction) and [Nuxt UI docs](https://ui.nuxt.com) to learn more.
## Setup
Make sure to install the dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm run dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm run build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm run preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

6
app.config.ts Normal file
View File

@@ -0,0 +1,6 @@
export default defineAppConfig({
ui: {
primary: 'lime',
gray: 'neutral',
},
})

24
app.vue Normal file
View File

@@ -0,0 +1,24 @@
<template>
<UContainer>
<UCard class="mt-10">
<template #header>
<div class="flex justify-between">
<h1>Welcome to Nuxt UI Starter</h1>
<ColorScheme>
<USelect
v-model="$colorMode.preference"
:options="['system', 'light', 'dark']"
/>
</ColorScheme>
</div>
</template>
<UButton
icon="i-heroicons-book-open"
to="https://ui.nuxt.com"
target="_blank"
>
Open Nuxt UI Documentation
</UButton>
</UCard>
</UContainer>
</template>

View File

@@ -3,7 +3,7 @@ export default defineAppConfig({
gray: 'neutral',
primary: 'gray',
icons: {
dynamic: true
}
}
dynamic: true,
},
},
})

View File

@@ -1,3 +1,15 @@
<script lang="ts" setup>
useHead({
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.ico' }],
})
const head = useLocaleHead({
addDirAttribute: true,
identifierAttribute: 'id',
addSeoAttributes: true,
})
</script>
<template>
<Html
:dir="head.htmlAttrs.dir"
@@ -37,18 +49,6 @@
</Html>
</template>
<script lang="ts" setup>
useHead({
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.ico' }]
})
const head = useLocaleHead({
addDirAttribute: true,
identifierAttribute: 'id',
addSeoAttributes: true
})
</script>
<style>
body {
font-family: 'DM Sans', sans-serif;

View File

@@ -3,5 +3,5 @@ import type { Config } from 'drizzle-kit'
export default {
dialect: 'sqlite',
schema: './server/database/schema.ts',
out: './server/database/migrations'
out: './server/database/migrations',
} satisfies Config

View File

@@ -1,6 +1,3 @@
// @ts-check
import withNuxt from './.nuxt/eslint.config.mjs'
import antfu from '@antfu/eslint-config'
export default withNuxt(
// Your custom configs here
)
export default antfu()

98
nuxt.config.ts Normal file
View File

@@ -0,0 +1,98 @@
export default defineNuxtConfig({
future: { compatibilityVersion: 4 },
// Nuxt App
app: {
pageTransition: { name: 'page', mode: 'out-in' },
head: {
templateParams: {
separator: '•',
},
},
},
// Nuxt Modules
modules: [
'@nuxthub/core',
'@nuxt/ui',
'@nuxt/content',
'@vueuse/nuxt',
'@nuxtjs/google-fonts',
'@nuxthq/studio',
'@nuxt/image',
'@nuxtjs/i18n',
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
'nuxt-auth-utils',
],
// Nuxt Hub
hub: {
cache: true,
kv: true,
database: true,
analytics: true,
},
// Nuxt Content
content: {
highlight: {
theme: 'github-dark',
},
},
// Nuxt Color Mode
colorMode: {
preference: 'system',
fallback: 'light',
},
// Nuxt Devtools
devtools: {
enabled: true,
timeline: { enabled: true },
},
// Nuxt I18N
i18n: {
strategy: 'no_prefix',
locales: [
{
code: 'en',
iso: 'en-EN',
icon: 'i-twemoji-flag-united-kingdom',
},
{
code: 'fr',
iso: 'fr-FR',
icon: 'i-twemoji-flag-france',
},
],
defaultLocale: 'en',
},
// Nuxt Google Fonts
googleFonts: {
display: 'swap',
families: {
'Inter': [400, 500, 600, 700, 800, 900],
'DM Sans': [400, 500, 600, 700, 800, 900],
},
},
// Nitro
nitro: {
experimental: {
openAPI: true,
},
},
// Nuxt Env
runtimeConfig: {
public: {
test: '',
},
},
compatibilityDate: '2024-07-23',
})

47
package.json Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "nuxt-starter",
"type": "module",
"private": true,
"packageManager": "pnpm@9.5.0",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev --host",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"db:generate": "drizzle-kit generate"
},
"dependencies": {
"@iconify/json": "^2.2.230",
"@nuxt/content": "^2.13.2",
"@nuxt/image": "^1.7.0",
"@nuxt/ui": "^2.17.0",
"@nuxthq/studio": "^2.0.3",
"@nuxthub/core": "^0.7.1",
"@nuxtjs/google-fonts": "^3.2.0",
"@nuxtjs/i18n": "^8.3.1",
"@pinia/nuxt": "^0.5.1",
"drizzle-orm": "^0.32.1",
"h3-zod": "^0.5.3",
"nuxt": "^3.12.4",
"nuxt-auth-utils": "^0.2.0",
"pinia": "^2.1.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^2.23.2",
"@nuxt/devtools": "^1.3.9",
"@nuxt/ui": "^2.17.0",
"@pinia-plugin-persistedstate/nuxt": "^1.2.1",
"@types/node": "^20.14.11",
"@vueuse/core": "^10.11.0",
"@vueuse/nuxt": "^10.11.0",
"drizzle-kit": "^0.23.0",
"eslint": "^9.7.0",
"typescript": "^5.5.4",
"vue-tsc": "^2.0.28",
"wrangler": "^3.66.0"
}
}

13074
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -1,3 +1,3 @@
export default defineEventHandler(() => {
return { hello: 'API' }
})
})

View File

@@ -46,4 +46,4 @@
"internal": {
"indexes": {}
}
}
}

View File

@@ -10,4 +10,4 @@
"breakpoints": true
}
]
}
}

View File

@@ -4,5 +4,5 @@ import { sql } from 'drizzle-orm'
export const users = sqliteTable('users', {
id: integer('id').primaryKey(),
name: text('name').default(''),
createdAt: text('created_at').default(sql`(CURRENT_DATE)`)
createdAt: text('created_at').default(sql`(CURRENT_DATE)`),
})

View File

@@ -2,7 +2,8 @@ import { consola } from 'consola'
import { migrate } from 'drizzle-orm/d1/migrator'
export default defineNitroPlugin(async () => {
if (!import.meta.dev) return
if (!import.meta.dev)
return
onHubReady(async () => {
await migrate(useDB(), { migrationsFolder: 'server/database/migrations' })

View File

@@ -1,19 +1,19 @@
export default oauth.githubEventHandler({
config: {
emailRequired: true
emailRequired: true,
},
async onSuccess(event, { user }) {
await setUserSession(event, {
user: {
name: user.name,
imageUrl: user.avatar_url,
email: user.email
}
email: user.email,
},
})
return sendRedirect(event, '/')
},
onError(event, error) {
console.error('GitHub OAuth error:', error)
return sendRedirect(event, '/')
}
},
})

View File

@@ -1,16 +1,16 @@
export default oauth.googleEventHandler({
config: {
authorizationParams: {
access_type: 'offline'
}
access_type: 'offline',
},
},
async onSuccess(event, { user }) {
await setUserSession(event, {
user: {
name: user.name,
imageUrl: user.picture,
email: user.email
}
email: user.email,
},
})
return sendRedirect(event, '/')
@@ -19,5 +19,5 @@ export default oauth.googleEventHandler({
onError(event, error) {
console.error('Google OAuth error:', error)
return sendRedirect(event, '/')
}
},
})

3
server/tsconfig.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}

View File

@@ -14,12 +14,12 @@ export default <Partial<Config>>{
'./Error.{js,ts,vue}',
'./error.{js,ts,vue}',
'./app.config.{js,ts}',
'content/**/*.md'
'content/**/*.md',
],
theme: {
extend: {
}
},
},
plugins: [typography]
plugins: [typography],
}

4
tsconfig.json Normal file
View File

@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}