Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
risv1 committed Oct 29, 2024
1 parent 9a7b89f commit 918ee7d
Show file tree
Hide file tree
Showing 16 changed files with 135 additions and 127 deletions.
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ build-client:
@pnpm run generate
@pnpm dlx serve .output/public

start:
@pnpm run start
@pnpm run generate
@pnpm dlx serve .output/public

start:
@pnpm run start

build:
@pnpm run build
@node .output/server/index.mjs
Expand Down
4 changes: 2 additions & 2 deletions app/app.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@font-face {
font-family: 'Satoshi-Variable';
src: url('/fonts/Satoshi-Variable.ttf') format('trueType');
font-family: "Satoshi-Variable";
src: url("/fonts/Satoshi-Variable.ttf") format("trueType");
font-weight: 100 900;
font-style: normal;
font-display: swap;
Expand Down
12 changes: 7 additions & 5 deletions app/components/Counter.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<script setup lang="ts">
const counter = useCount()
const counter = useCount();
const buttons = [
{ icon: 'ic:baseline-plus', fn: counter.increment },
{ icon: 'ic:baseline-minus', fn: counter.decrement },
]
{ icon: "ic:baseline-plus", fn: counter.increment },
{ icon: "ic:baseline-minus", fn: counter.decrement },
];
</script>

<template>
<div class="mt-4 sm:mt-6 md:mt-8">
<div class="flex flex-col items-center gap-2 sm:gap-3 md:gap-4 text-gray-900 dark:text-gray-100">
<div
class="flex flex-col items-center gap-2 sm:gap-3 md:gap-4 text-gray-900 dark:text-gray-100"
>
<p class="text-2xl sm:text-3xl font-medium">
Counter: {{ counter.count }}
</p>
Expand Down
71 changes: 42 additions & 29 deletions app/components/Hero.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,60 @@
<script setup lang="ts">
const icons = [
{
name: 'nuxt',
iconName: 'logos:nuxt-icon',
label: 'Nuxt',
name: "nuxt",
iconName: "logos:nuxt-icon",
label: "Nuxt",
},
{
name: 'pinia',
iconName: 'logos:pinia',
label: 'Pinia',
name: "pinia",
iconName: "logos:pinia",
label: "Pinia",
},
{
name: 'drizzle',
iconName: 'simple-icons:drizzle',
label: 'Drizzle ORM',
name: "drizzle",
iconName: "simple-icons:drizzle",
label: "Drizzle ORM",
},
{
name: 'biome',
iconName: 'devicon:eslint',
label: 'ESLint',
name: "biome",
iconName: "devicon:eslint",
label: "ESLint",
},
{
name: 'docker',
iconName: 'logos:docker-icon',
label: 'Docker',
name: "docker",
iconName: "logos:docker-icon",
label: "Docker",
},
{
name: 'unocss',
iconName: 'logos:unocss',
label: 'UnoCSS',
name: "unocss",
iconName: "logos:unocss",
label: "UnoCSS",
},
]
];
</script>

<template>
<section class="min-h-screen flex flex-col items-center justify-center overflow-auto bg-inherit p-4">
<div class="mx-auto w-full max-w-6xl flex flex-col items-center gap-8 sm:gap-12">
<section
class="min-h-screen flex flex-col items-center justify-center overflow-auto bg-inherit p-4"
>
<div
class="mx-auto w-full max-w-6xl flex flex-col items-center gap-8 sm:gap-12"
>
<div class="flex flex-col items-center gap-3 sm:gap-4">
<Icon name="logos:nuxt-icon" class="h-12 w-12 sm:h-14 sm:w-14 md:h-16 md:w-16 text-green-500" />
<h1 class="text-3xl sm:text-4xl text-gray-900 font-bold dark:text-gray-100 text-center">
<Icon
name="logos:nuxt-icon"
class="h-12 w-12 sm:h-14 sm:w-14 md:h-16 md:w-16 text-green-500"
/>
<h1
class="text-3xl sm:text-4xl text-gray-900 font-bold dark:text-gray-100 text-center"
>
Nuxt Starter
</h1>
</div>

<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 w-2/3 gap-3 sm:gap-4 text-gray-900 dark:text-gray-100">

<div
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 w-2/3 gap-3 sm:gap-4 text-gray-900 dark:text-gray-100"
>
<div
v-for="icon in icons"
:key="icon.name"
Expand All @@ -54,15 +65,17 @@ const icons = [
:name="icon.iconName"
:class="[
'h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 group-hover:scale-110 transition-transform duration-200',
icon.name === 'drizzle' ? 'text-yellow-400' : ''
icon.name === 'drizzle' ? 'text-yellow-400' : '',
]"
/>
<span class="font-medium text-sm sm:text-base">{{ icon.label }}</span>
<span class="font-medium text-sm sm:text-base">{{
icon.label
}}</span>
</div>
</div>
</div>

<Counter />
</div>
</section>
</template>
</template>
16 changes: 8 additions & 8 deletions app/components/Theme.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<script setup lang="ts">
const colorMode = useColorMode({
modes: {
light: 'light',
dark: 'dark',
light: "light",
dark: "dark",
},
})
const isDark = useState('isDark', () => true)
});
const isDark = useState("isDark", () => true);
function toggleColorMode() {
colorMode.value = colorMode.value === 'light' ? 'dark' : 'light'
isDark.value = !isDark.value
colorMode.value = colorMode.value === "light" ? "dark" : "light";
isDark.value = !isDark.value;
}
onMounted(() => {
isDark.value = colorMode.value === 'dark'
})
isDark.value = colorMode.value === "dark";
});
</script>

<template>
Expand Down
5 changes: 3 additions & 2 deletions app/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<template>
<slot />
<!-- eslint-disable vue/no-multiple-template-root -->
<template>
<slot />
</template>
22 changes: 11 additions & 11 deletions app/store/count.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export const useCount = defineStore({
id: "count",
state: () => ({ count: 0 }),
actions: {
increment() {
this.count++;
},
decrement() {
this.count--;
},
},
persist: true,
id: "count",
state: () => ({ count: 0 }),
actions: {
increment() {
this.count++;
},
decrement() {
this.count--;
},
},
persist: true,
});
39 changes: 19 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
services:

nuxt-app:
container_name: nuxt_app
build:
context: .
dockerfile: Dockerfile
ports:
- '3000:3000'

postgres:
container_name: postgres_nuxt
image: postgres
environment:
POSTGRES_DB: postgres
POSTGRES_USER: root
POSTGRES_PASSWORD: password
PGDATA: /data/postgres
ports:
- '5432:5432'
services:
nuxt-app:
container_name: nuxt_app
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"

postgres:
container_name: postgres_nuxt
image: postgres
environment:
POSTGRES_DB: postgres
POSTGRES_USER: root
POSTGRES_PASSWORD: password
PGDATA: /data/postgres
ports:
- "5432:5432"
restart: unless-stopped
12 changes: 6 additions & 6 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineConfig } from 'drizzle-kit'
import { dbUrl } from './env'
import { defineConfig } from "drizzle-kit";
import { dbUrl } from "./env";

export default defineConfig({
schema: 'server/database/schema.ts',
out: '.drizzle',
dialect: 'sqlite',
schema: "server/database/schema.ts",
out: ".drizzle",
dialect: "sqlite",
dbCredentials: {
url: dbUrl,
},
strict: true,
verbose: true,
})
});
4 changes: 2 additions & 2 deletions env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (!process.env.DB_URL) {
throw new Error('DB_URL is not set in .env file');
throw new Error("DB_URL is not set in .env file");
}

export const dbUrl = process.env.DB_URL
export const dbUrl = process.env.DB_URL;
8 changes: 5 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import withNuxt from './.nuxt/eslint.config.mjs'
import withNuxt from "./.nuxt/eslint.config.mjs";

export default withNuxt({
'vue/multi-word-component-names': 'off',
})
rules: {
"vue/multi-word-component-names": "off",
},
});
24 changes: 12 additions & 12 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-10-24',
compatibilityDate: "2024-10-24",
modules: [
'@vueuse/nuxt',
'@nuxt/icon',
'@unocss/nuxt',
'@nuxt/eslint',
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
"@vueuse/nuxt",
"@nuxt/icon",
"@unocss/nuxt",
"@nuxt/eslint",
"@pinia/nuxt",
"@pinia-plugin-persistedstate/nuxt",
],
ssr: false,
devtools: { enabled: true },
css: ['./app/app.css'],
srcDir: 'app',
serverDir: 'server',
css: ["./app/app.css"],
srcDir: "app",
serverDir: "server",
unocss: {
nuxtLayers: true,
},
imports: {
dirs: ["./store"],
},
})
}
});
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"start": "node .output/server/index.mjs",
"lint": "pnpm lint:eslint && pnpm lint:prettier",
"lint:eslint": "eslint .",
"lint:prettier": "prettier . --check",
"lintfix": "eslint . --fix && prettier --write --list-different ."
"lint:prettier": "prettier . --write"
},
"dependencies": {
"@nuxt/eslint": "^0.6.0",
Expand All @@ -24,7 +23,6 @@
"@types/better-sqlite3": "^7.6.11",
"@types/uuid": "^10.0.0",
"@unocss/core": "^0.63.6",
"@unocss/core": "^0.63.6",
"@unocss/nuxt": "^0.63.6",
"@vueuse/core": "^11.1.0",
"@vueuse/nuxt": "^11.1.0",
Expand Down
2 changes: 1 addition & 1 deletion server/api/health.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default defineEventHandler((event) => {
return { status: "ok" };
return { status: "ok" };
});
20 changes: 12 additions & 8 deletions server/database/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import { sql } from "drizzle-orm";
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";

export const users = sqliteTable("users", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(),
email: text("email").notNull().unique(),
password: text("password").notNull(),
created_at: text("timestamp").notNull().default(sql`(current_timestamp)`),
updated_at: text("timestamp").notNull().default(sql`(current_timestamp)`),
deleted_at: text("timestamp"),
is_deleted: integer("is_deleted").notNull().default(0),
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(),
email: text("email").notNull().unique(),
password: text("password").notNull(),
created_at: text("timestamp")
.notNull()
.default(sql`(current_timestamp)`),
updated_at: text("timestamp")
.notNull()
.default(sql`(current_timestamp)`),
deleted_at: text("timestamp"),
is_deleted: integer("is_deleted").notNull().default(0),
});
Loading

0 comments on commit 918ee7d

Please sign in to comment.