mirror of
https://github.com/ArthurDanjou/nuxt-starter.git
synced 2026-01-14 12:14:38 +01:00
Lint code
This commit is contained in:
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal 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
75
README.md
Normal 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
6
app.config.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export default defineAppConfig({
|
||||||
|
ui: {
|
||||||
|
primary: 'lime',
|
||||||
|
gray: 'neutral',
|
||||||
|
},
|
||||||
|
})
|
||||||
24
app.vue
Normal file
24
app.vue
Normal 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>
|
||||||
@@ -3,7 +3,7 @@ export default defineAppConfig({
|
|||||||
gray: 'neutral',
|
gray: 'neutral',
|
||||||
primary: 'gray',
|
primary: 'gray',
|
||||||
icons: {
|
icons: {
|
||||||
dynamic: true
|
dynamic: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
24
app/app.vue
24
app/app.vue
@@ -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>
|
<template>
|
||||||
<Html
|
<Html
|
||||||
:dir="head.htmlAttrs.dir"
|
:dir="head.htmlAttrs.dir"
|
||||||
@@ -37,18 +49,6 @@
|
|||||||
</Html>
|
</Html>
|
||||||
</template>
|
</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>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: 'DM Sans', sans-serif;
|
font-family: 'DM Sans', sans-serif;
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import type { Config } from 'drizzle-kit'
|
|||||||
export default {
|
export default {
|
||||||
dialect: 'sqlite',
|
dialect: 'sqlite',
|
||||||
schema: './server/database/schema.ts',
|
schema: './server/database/schema.ts',
|
||||||
out: './server/database/migrations'
|
out: './server/database/migrations',
|
||||||
} satisfies Config
|
} satisfies Config
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// @ts-check
|
import antfu from '@antfu/eslint-config'
|
||||||
import withNuxt from './.nuxt/eslint.config.mjs'
|
|
||||||
|
|
||||||
export default withNuxt(
|
export default antfu()
|
||||||
// Your custom configs here
|
|
||||||
)
|
|
||||||
|
|||||||
98
nuxt.config.ts
Normal file
98
nuxt.config.ts
Normal 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
47
package.json
Normal 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
13074
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -4,5 +4,5 @@ import { sql } from 'drizzle-orm'
|
|||||||
export const users = sqliteTable('users', {
|
export const users = sqliteTable('users', {
|
||||||
id: integer('id').primaryKey(),
|
id: integer('id').primaryKey(),
|
||||||
name: text('name').default(''),
|
name: text('name').default(''),
|
||||||
createdAt: text('created_at').default(sql`(CURRENT_DATE)`)
|
createdAt: text('created_at').default(sql`(CURRENT_DATE)`),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { consola } from 'consola'
|
|||||||
import { migrate } from 'drizzle-orm/d1/migrator'
|
import { migrate } from 'drizzle-orm/d1/migrator'
|
||||||
|
|
||||||
export default defineNitroPlugin(async () => {
|
export default defineNitroPlugin(async () => {
|
||||||
if (!import.meta.dev) return
|
if (!import.meta.dev)
|
||||||
|
return
|
||||||
|
|
||||||
onHubReady(async () => {
|
onHubReady(async () => {
|
||||||
await migrate(useDB(), { migrationsFolder: 'server/database/migrations' })
|
await migrate(useDB(), { migrationsFolder: 'server/database/migrations' })
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
export default oauth.githubEventHandler({
|
export default oauth.githubEventHandler({
|
||||||
config: {
|
config: {
|
||||||
emailRequired: true
|
emailRequired: true,
|
||||||
},
|
},
|
||||||
async onSuccess(event, { user }) {
|
async onSuccess(event, { user }) {
|
||||||
await setUserSession(event, {
|
await setUserSession(event, {
|
||||||
user: {
|
user: {
|
||||||
name: user.name,
|
name: user.name,
|
||||||
imageUrl: user.avatar_url,
|
imageUrl: user.avatar_url,
|
||||||
email: user.email
|
email: user.email,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
return sendRedirect(event, '/')
|
return sendRedirect(event, '/')
|
||||||
},
|
},
|
||||||
onError(event, error) {
|
onError(event, error) {
|
||||||
console.error('GitHub OAuth error:', error)
|
console.error('GitHub OAuth error:', error)
|
||||||
return sendRedirect(event, '/')
|
return sendRedirect(event, '/')
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
export default oauth.googleEventHandler({
|
export default oauth.googleEventHandler({
|
||||||
config: {
|
config: {
|
||||||
authorizationParams: {
|
authorizationParams: {
|
||||||
access_type: 'offline'
|
access_type: 'offline',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
async onSuccess(event, { user }) {
|
async onSuccess(event, { user }) {
|
||||||
await setUserSession(event, {
|
await setUserSession(event, {
|
||||||
user: {
|
user: {
|
||||||
name: user.name,
|
name: user.name,
|
||||||
imageUrl: user.picture,
|
imageUrl: user.picture,
|
||||||
email: user.email
|
email: user.email,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return sendRedirect(event, '/')
|
return sendRedirect(event, '/')
|
||||||
@@ -19,5 +19,5 @@ export default oauth.googleEventHandler({
|
|||||||
onError(event, error) {
|
onError(event, error) {
|
||||||
console.error('Google OAuth error:', error)
|
console.error('Google OAuth error:', error)
|
||||||
return sendRedirect(event, '/')
|
return sendRedirect(event, '/')
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
3
server/tsconfig.json
Normal file
3
server/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "../.nuxt/tsconfig.server.json"
|
||||||
|
}
|
||||||
@@ -14,12 +14,12 @@ export default <Partial<Config>>{
|
|||||||
'./Error.{js,ts,vue}',
|
'./Error.{js,ts,vue}',
|
||||||
'./error.{js,ts,vue}',
|
'./error.{js,ts,vue}',
|
||||||
'./app.config.{js,ts}',
|
'./app.config.{js,ts}',
|
||||||
'content/**/*.md'
|
'content/**/*.md',
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
plugins: [typography]
|
},
|
||||||
|
plugins: [typography],
|
||||||
}
|
}
|
||||||
|
|||||||
4
tsconfig.json
Normal file
4
tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
// https://nuxt.com/docs/guide/concepts/typescript
|
||||||
|
"extends": "./.nuxt/tsconfig.json"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user