1
0
Fork 0

Switch to Vite

This commit is contained in:
Moritz Ruth 2021-12-17 18:45:44 +01:00
parent 2c3dcc9c1a
commit c44f07a576
No known key found for this signature in database
GPG key ID: AFD57E23E753841B
24 changed files with 298 additions and 4612 deletions

5
.gitignore vendored
View file

@ -1,7 +1,6 @@
.idea/ .idea/
/node_modules/ /node_modules/
/dist/
*.log *.log
.nuxt
nuxt.d.ts
.output
.env .env

View file

@ -4,5 +4,3 @@
TODO: TODO:
- Blog - Blog
- Legal Notice
- Terms

25
index.html Normal file
View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Moritz Ruth</title>
<link rel="preload" as="font" href="/node_modules/@fontsource/plus-jakarta-sans/files/plus-jakarta-sans-latin-400-normal.woff2" crossorigin="anonymous">
<link rel="stylesheet" href="/node_modules/@fontsource/plus-jakarta-sans/400.css">
<link rel="stylesheet" href="/node_modules/@fontsource/plus-jakarta-sans/700.css">
<meta name="description" content="freelance software developer, graphic design enthusiast and hobby photographer">
<meta name="keywords" content="web, dev, development, coding, moritz, ruth, development, design, kotlin, android">
<link rel="shortcut icon" type="image/png" href="/icon.png">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<script
async
defer
src="https://stats.moritzruth.de/umami.js"
data-website-id="e68ac4a6-c999-4f8e-be75-5a6252a55f17"
data-domains="moritzruth.de"
></script>
</body>
</html>

View file

@ -1,23 +0,0 @@
import { defineNuxtConfig } from "nuxt3"
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
ssr: true,
target: "static",
buildModules: [
"nuxt-windicss",
"unplugin-icons/nuxt"
],
css: [
"@fontsource/plus-jakarta-sans/400.css",
"@fontsource/plus-jakarta-sans/700.css"
],
build: {
loaders: {
css: {
// @ts-expect-error
module: false
}
}
}
})

View file

@ -2,25 +2,30 @@
"name": "moritzruth.de", "name": "moritzruth.de",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "nuxi dev", "dev": "vite --host",
"build": "NITRO_PRESET=server nuxi build", "build": "vite build",
"start": "node .output/server/index.mjs", "start": "vite preview",
"fi": "pnpm i --shamefully-hoist" "lint": "eslint . --fix"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^2.0.1",
"@vue/compiler-sfc": "^3.1.1",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-awzzm-vue": "^2.0.1", "eslint-config-awzzm-vue": "^2.0.1",
"nuxt-windicss": "^2.1.1", "typescript": "^4.5.4",
"nuxt3": "latest", "vite": "^2.3.7",
"typescript": "^4.5.3", "vite-plugin-pages": "^0.19.4",
"vite-plugin-windicss": "^1.0.4",
"windicss": "^3.2.1" "windicss": "^3.2.1"
}, },
"dependencies": { "dependencies": {
"@fontsource/plus-jakarta-sans": "^4.5.0", "@fontsource/plus-jakarta-sans": "^4.5.0",
"@iconify/json": "^1.1.441", "@iconify/json": "1.1.444",
"@vueuse/core": "^7.2.2", "@vueuse/core": "^7.2.2",
"@vueuse/head": "^0.7.4",
"blobs": "^2.2.1-beta.1", "blobs": "^2.2.1-beta.1",
"unplugin-icons": "^0.12.23", "unplugin-icons": "^0.12.23",
"vue": "^3.2.26" "vue": "^3.2.26",
"vue-router": "^4.0.12"
} }
} }

4745
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="h-100vh w-100vw text-light-100 overflow-x-hidden"> <div class="h-100vh w-100vw text-light-100 overflow-x-hidden">
<NuxtPage/> <router-view/>
</div> </div>
</template> </template>

View file

@ -24,9 +24,9 @@
</style> </style>
<script lang="ts"> <script>
import ArrowLeftIcon from "~icons/ph/arrow-left" import ArrowLeftIcon from "~icons/ph/arrow-left"
import { useMeta } from "#meta" import { useHead } from "@vueuse/head"
export default { export default {
name: "TopBarLayout", name: "TopBarLayout",
@ -42,7 +42,7 @@
} }
}, },
setup(props) { setup(props) {
useMeta({ useHead({
title: `${props.title} — Moritz Ruth` title: `${props.title} — Moritz Ruth`
}) })
} }

23
src/main.ts Normal file
View file

@ -0,0 +1,23 @@
import "virtual:windi.css"
import routes from "~pages"
import { createApp } from "vue"
import { createRouter, createWebHistory } from "vue-router"
import App from "./App.vue"
import { createHead } from "@vueuse/head"
const router = createRouter({
history: createWebHistory(),
routes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) return savedPosition
if (to.hash) return { el: to.hash }
return { top: 0 }
}
})
const head = createHead()
createApp(App)
.use(router)
.use(head)
.mount("#app")

View file

@ -29,7 +29,7 @@
</style> </style>
<script lang="ts"> <script>
import TopBarLayout from "../components/TopBarLayout.vue" import TopBarLayout from "../components/TopBarLayout.vue"
import LinkCardList from "../components/LinkCardList.vue" import LinkCardList from "../components/LinkCardList.vue"
import BlurredBlobCanvas from "../components/BlurredBlobCanvas.vue" import BlurredBlobCanvas from "../components/BlurredBlobCanvas.vue"

View file

@ -96,7 +96,7 @@
import BlurredBlobCanvas from "../components/BlurredBlobCanvas.vue" import BlurredBlobCanvas from "../components/BlurredBlobCanvas.vue"
import XSpacer from "../components/XSpacer.vue" import XSpacer from "../components/XSpacer.vue"
import LinkCardList from "../components/LinkCardList.vue" import LinkCardList from "../components/LinkCardList.vue"
import { useMeta } from "#meta" import { useHead } from "@vueuse/head"
const NAVIGATION_LINKS = [ const NAVIGATION_LINKS = [
{ {
@ -134,7 +134,7 @@
BlurredBlobCanvas BlurredBlobCanvas
}, },
setup() { setup() {
useMeta({ useHead({
title: "Moritz Ruth — freelance software developer" title: "Moritz Ruth — freelance software developer"
}) })

View file

@ -33,8 +33,8 @@
<script lang="ts"> <script lang="ts">
import TopBarLayout from "../components/TopBarLayout.vue" import TopBarLayout from "../components/TopBarLayout.vue"
import { photos } from "assets/photos" import { photos } from "../photos"
import XSpacer from "~/components/XSpacer.vue" import XSpacer from "../components/XSpacer.vue"
export default { export default {
name: "PhotographyPage", name: "PhotographyPage",

View file

@ -10,16 +10,16 @@
</style> </style>
<script lang="ts"> <script>
import TopBarLayout from "../components/TopBarLayout.vue" import TopBarLayout from "../components/TopBarLayout.vue"
import ArrowRightIcon from "~icons/ph/arrow-right" import ArrowRightIcon from "~icons/ph/arrow-right"
import LinkCardList, { Link } from "../components/LinkCardList.vue" import LinkCardList from "../components/LinkCardList.vue"
export default { export default {
name: "ProjectsPage", name: "ProjectsPage",
components: { LinkCardList, TopBarLayout, ArrowRightIcon }, components: { LinkCardList, TopBarLayout, ArrowRightIcon },
setup() { setup() {
const projects: Link[] = [ const projects = [
{ {
label: "JamRSS", label: "JamRSS",
description: "An RSS reader app for Android, built with Jetpack\u00A0Compose.", description: "An RSS reader app for Android, built with Jetpack\u00A0Compose.",

3
src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1,3 @@
/// <reference types="vite-plugin-pages/client"/>
/// <reference types="unplugin-icons/types/vue"/>
/// <reference types="vite/client"/>

View file

@ -1,10 +1,14 @@
{ {
// https://v3.nuxtjs.org/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"types": [ "baseUrl": ".",
"nuxt-windicss", "module": "ESNext",
"unplugin-icons/types/vue" "lib": ["DOM", "ESNext", "es2020"],
] "strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true
} }
} }

14
vite.config.ts Normal file
View file

@ -0,0 +1,14 @@
import { defineConfig } from "vite"
import vuePlugin from "@vitejs/plugin-vue"
import windicssPlugin from "vite-plugin-windicss"
import pagesPlugin from "vite-plugin-pages"
import iconsPlugin from "unplugin-icons/vite"
export default defineConfig({
plugins: [
vuePlugin(),
pagesPlugin(),
windicssPlugin(),
iconsPlugin()
]
})

7
webstorm-shims.d.ts vendored
View file

@ -1,7 +0,0 @@
// Taken from https://github.com/antfu/unplugin-icons/issues/128#issuecomment-992718883
declare module "~icons/*" {
import { FunctionalComponent, SVGAttributes } from "vue"
const component: FunctionalComponent<SVGAttributes>
export default component
}