refactor: move project to src folder and cleanup with typescript

This commit is contained in:
Anthony Berg 2024-10-30 11:39:24 +01:00
parent c71771088a
commit c5c576cbcb
18 changed files with 102 additions and 141 deletions

View File

@ -1,13 +1,13 @@
import nextra from 'nextra'
import type { NextConfig } from 'next'
const withNextra = nextra({
theme: 'nextra-theme-blog',
themeConfig: './theme.config.js',
themeConfig: './src/theme.config.tsx',
// optional: add `unstable_staticImage: true` to enable Nextra's auto image import
})
/** @type {import('next').NextConfig} */
const nextConfig = {
const nextConfig: NextConfig = {
// any configs you need
}

View File

@ -6,7 +6,7 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "next",
"dev": "next dev",
"build": "next build",
"start": "next start"
},
@ -17,11 +17,10 @@
"dependencies": {
"gray-matter": "^4.0.3",
"next": "^15.0.2",
"nextra": "^3.1.3",
"nextra-theme-blog": "^3.1.3",
"nextra": "^3.2.0",
"nextra-theme-blog": "^3.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rss": "^1.2.2"
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^22.8.4",

View File

@ -1,21 +0,0 @@
import 'nextra-theme-blog/style.css'
import type { AppProps } from 'next/app'
import Head from 'next/head'
import '../styles/main.css'
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<link
rel="preload"
href="/fonts/Inter-roman.latin.var.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>
</Head>
<Component {...pageProps} />
</>
)
}

View File

@ -1,31 +0,0 @@
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
const meta = {
title: 'Anthony Berg\'s Portfolio',
description: 'My own personal portfolio including for my own projects related to computer science',
image: '/images/kgxtunnel.jpg',
}
return (
<Html lang="en">
<Head>
<meta name="robots" content="follow, index" />
<meta name="description" content={meta.description} />
<meta property="og:site_name" content={meta.title} />
<meta property="og:description" content={meta.description} />
<meta property="og:title" content={meta.title} />
<meta property="og:image" content={meta.image} />
<meta name="twitter:card" content="summary_large_image" />
{/*<meta name="twitter:site" content="@yourname" />*/}
<meta name="twitter:title" content={meta.title} />
<meta name="twitter:description" content={meta.description} />
<meta name="twitter:image" content={meta.image} />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}

78
pnpm-lock.yaml generated
View File

@ -15,20 +15,17 @@ importers:
specifier: ^15.0.2
version: 15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
nextra:
specifier: ^3.1.3
version: 3.1.3(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)
specifier: ^3.2.0
version: 3.2.0(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)
nextra-theme-blog:
specifier: ^3.1.3
version: 3.1.3(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.1.3(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
specifier: ^3.2.0
version: 3.2.0(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.2.0(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react:
specifier: ^18.3.1
version: 18.3.1
react-dom:
specifier: ^18.3.1
version: 18.3.1(react@18.3.1)
rss:
specifier: ^1.2.2
version: 1.2.2
devDependencies:
'@types/node':
specifier: ^22.8.4
@ -75,8 +72,8 @@ packages:
'@floating-ui/core@1.6.8':
resolution: {integrity: sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA==}
'@floating-ui/dom@1.6.11':
resolution: {integrity: sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ==}
'@floating-ui/dom@1.6.12':
resolution: {integrity: sha512-NP83c0HjokcGVEMeoStg317VD9W7eDlGK7457dMBANbKA6GJZdc7rjujdgqzTaz93jkGgc5P/jeWbaCHnMNc+w==}
'@floating-ui/react-dom@2.1.2':
resolution: {integrity: sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==}
@ -84,8 +81,8 @@ packages:
react: '>=16.8.0'
react-dom: '>=16.8.0'
'@floating-ui/react@0.26.25':
resolution: {integrity: sha512-hZOmgN0NTOzOuZxI1oIrDu3Gcl8WViIkvPMpB4xdd4QD6xAMtwgwr3VPoiyH/bLtRcS1cDnhxLSD1NsMJmwh/A==}
'@floating-ui/react@0.26.26':
resolution: {integrity: sha512-iv2BjdcyoF1j1708Z9CrGtMc9ZZvMPZnDqyB1FrSWYCi+/nlPArUO/u9QhwC4E1Pi4T0g18GZ4W702m0NDh9bw==}
peerDependencies:
react: '>=16.8.0'
react-dom: '>=16.8.0'
@ -535,8 +532,8 @@ packages:
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
engines: {node: '>=10.16.0'}
caniuse-lite@1.0.30001674:
resolution: {integrity: sha512-jOsKlZVRnzfhLojb+Ykb+gyUSp9Xb57So+fAiFlLzzTKpqg8xxSav0e40c8/4F/v9N8QSvrRRaLeVzQbLqomYw==}
caniuse-lite@1.0.30001675:
resolution: {integrity: sha512-/wV1bQwPrkLiQMjaJF5yUMVM/VdRPOCU8QZ+PmG6uW6DvYSrNY1bpwHI/3mOcUosLaJCzYDi5o91IQB51ft6cg==}
ccount@2.0.1:
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
@ -1247,14 +1244,6 @@ packages:
micromark@4.0.0:
resolution: {integrity: sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==}
mime-db@1.25.0:
resolution: {integrity: sha512-5k547tI4Cy+Lddr/hdjNbBEWBwSl8EBc5aSdKvedav8DReADgWJzcYiktaRIw3GtGC1jjwldXtTzvqJZmtvC7w==}
engines: {node: '>= 0.6'}
mime-types@2.1.13:
resolution: {integrity: sha512-ryBDp1Z/6X90UvjUK3RksH0IBPM137T7cmg4OgD5wQBojlAiUwuok0QeELkim/72EtcYuNlmbkrcGuxj3Kl0YQ==}
engines: {node: '>= 0.6'}
mj-context-menu@0.6.1:
resolution: {integrity: sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==}
@ -1300,11 +1289,11 @@ packages:
sass:
optional: true
nextra-theme-blog@3.1.3:
resolution: {integrity: sha512-5KGa9tt8xEzJhVUaridbK/EnaE3nhF5bTzFNudWeEN4etDUiwR/iVVm6q77UkLuN9fjjTkoVRmh3OPXUuXSnOQ==}
nextra-theme-blog@3.2.0:
resolution: {integrity: sha512-fsHNXf8MkHAky43/0hHSS/xNLYBNAQ3U5ew59Q/Wda4JAN/ajIuRId/TlOSnR8Q2tAlHt3UWQ7WCfRFwTPPAWA==}
peerDependencies:
next: '>=13'
nextra: 3.1.3
nextra: 3.2.0
react: '>=18'
react-cusdis: ^2.1.3
react-dom: '>=18'
@ -1312,8 +1301,8 @@ packages:
react-cusdis:
optional: true
nextra@3.1.3:
resolution: {integrity: sha512-rpntSivQsjgtpjqBL1fXM2puKgzhShWTj92sV8jzFJlYZXU3bkEsBXarn3TwGpFZ5HAVuStvXX4z/AVygYbH4A==}
nextra@3.2.0:
resolution: {integrity: sha512-Gi+Q6BI9rFmQdy3e4FXCqgaSUcv8CGRVOVWbgY6/GTAWKMKK4v5M1gxYNhxdOywSkIoXrxSeXbIaj0qgNdjv3A==}
engines: {node: '>=18'}
peerDependencies:
next: '>=13'
@ -1480,9 +1469,6 @@ packages:
roughjs@4.6.6:
resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==}
rss@1.2.2:
resolution: {integrity: sha512-xUhRTgslHeCBeHAqaWSbOYTydN2f0tAzNXvzh3stjz7QDhQMzdgHf3pfgNIngeytQflrFPfy6axHilTETr6gDg==}
rw@1.3.3:
resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}
@ -1719,9 +1705,6 @@ packages:
wicked-good-xpath@1.3.0:
resolution: {integrity: sha512-Gd9+TUn5nXdwj/hFsPVx5cuHHiF5Bwuc30jZ4+ronF1qHK5O7HD0sgmXWSEgwKquT3ClLoKPVbO6qGwVwLzvAw==}
xml@1.0.1:
resolution: {integrity: sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==}
xmldom-sre@0.1.31:
resolution: {integrity: sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==}
engines: {node: '>=0.1'}
@ -1787,18 +1770,18 @@ snapshots:
dependencies:
'@floating-ui/utils': 0.2.8
'@floating-ui/dom@1.6.11':
'@floating-ui/dom@1.6.12':
dependencies:
'@floating-ui/core': 1.6.8
'@floating-ui/utils': 0.2.8
'@floating-ui/react-dom@2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@floating-ui/dom': 1.6.11
'@floating-ui/dom': 1.6.12
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
'@floating-ui/react@0.26.25(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
'@floating-ui/react@0.26.26(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@floating-ui/react-dom': 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@floating-ui/utils': 0.2.8
@ -1814,7 +1797,7 @@ snapshots:
'@headlessui/react@2.2.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@floating-ui/react': 0.26.25(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@floating-ui/react': 0.26.26(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@react-aria/focus': 3.18.4(react@18.3.1)
'@react-aria/interactions': 3.22.4(react@18.3.1)
'@tanstack/react-virtual': 3.10.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@ -2231,7 +2214,7 @@ snapshots:
dependencies:
streamsearch: 1.1.0
caniuse-lite@1.0.30001674: {}
caniuse-lite@1.0.30001675: {}
ccount@2.0.1: {}
@ -3379,12 +3362,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
mime-db@1.25.0: {}
mime-types@2.1.13:
dependencies:
mime-db: 1.25.0
mj-context-menu@0.6.1: {}
mlly@1.7.2:
@ -3411,7 +3388,7 @@ snapshots:
'@swc/counter': 0.1.3
'@swc/helpers': 0.5.13
busboy: 1.6.0
caniuse-lite: 1.0.30001674
caniuse-lite: 1.0.30001675
postcss: 8.4.31
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
@ -3430,15 +3407,15 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
nextra-theme-blog@3.1.3(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.1.3(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
nextra-theme-blog@3.2.0(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.2.0(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
next: 15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
next-themes: 0.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
nextra: 3.1.3(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)
nextra: 3.2.0(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
nextra@3.1.3(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3):
nextra@3.2.0(@types/react@18.3.12)(acorn@8.14.0)(next@15.0.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3):
dependencies:
'@formatjs/intl-localematcher': 0.5.6
'@headlessui/react': 2.2.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@ -3757,11 +3734,6 @@ snapshots:
points-on-curve: 0.2.0
points-on-path: 0.2.1
rss@1.2.2:
dependencies:
mime-types: 2.1.13
xml: 1.0.1
rw@1.3.3: {}
safer-buffer@2.1.2: {}
@ -4029,8 +4001,6 @@ snapshots:
wicked-good-xpath@1.3.0: {}
xml@1.0.1: {}
xmldom-sre@0.1.31: {}
yallist@2.1.2: {}

View File

@ -6,7 +6,7 @@ export type Props = Omit<ImageProps, 'src' | 'priority' | 'loading'> & {
srcDark: string
}
export const ThemeImage = (props: Props) => {
export function ThemeImage(props: Props) {
const { srcLight, srcDark, ...rest } = props
return (

6
src/pages/_app.tsx Normal file
View File

@ -0,0 +1,6 @@
import type { AppProps } from 'next/app'
import '../styles/main.css'
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}

View File

@ -4,7 +4,7 @@ title: Anthony Berg
date: 2024-10-05
---
import {ThemeImage} from './components/theme-image'
import {ThemeImage} from '@/components/theme-image'
# Anthony Berg

57
src/theme.config.tsx Normal file
View File

@ -0,0 +1,57 @@
import Link from "next/link";
const YEAR = new Date().getFullYear()
const websiteMeta = {
title: 'Anthony Berg\'s Portfolio',
description: 'My own personal portfolio including for my own projects related to computer science',
image: '/images/kgxtunnel.jpg',
}
export default {
footer: (
<footer>
<small>
<Link href={"https://github.com/smyalygames/anthonyberg-website/blob/main/LICENSE"}><time>{YEAR}</time> © Anthony Berg.</Link>
<a href={"https://github.com/smyalygames/anthonyberg-website/"}>GitHub Repository</a>
</small>
<style jsx>{`
footer {
margin-top: 8rem;
}
a {
float: right;
}
`}</style>
</footer>
),
head: ({ title, meta } : { title: string; meta: any }) => (
<>
<link
rel="preload"
href="/fonts/Inter-roman.latin.var.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>
{meta.description && (
<meta name="description" content={meta.description}/>
)}
{meta.tag && <meta name="keywords" content={meta.tag}/>}
{meta.author && <meta name="author" content={meta.author}/>}
{/*og meta*/}
<meta name="robots" content="follow, index"/>
<meta name="description" content={websiteMeta.description}/>
<meta property="og:site_name" content={websiteMeta.title}/>
<meta property="og:description" content={websiteMeta.description}/>
<meta property="og:title" content={websiteMeta.title}/>
<meta property="og:image" content={websiteMeta.image}/>
<meta name="twitter:card" content="summary_large_image"/>
{/*<meta name="twitter:site" content="@yourname" />*/}
<meta name="twitter:title" content={websiteMeta.title}/>
<meta name="twitter:description" content={websiteMeta.description}/>
<meta name="twitter:image" content={websiteMeta.image}/>
</>
)
}

View File

@ -1,22 +0,0 @@
import Link from "next/link";
const YEAR = new Date().getFullYear()
export default {
footer: (
<footer>
<small>
<Link href={"https://github.com/smyalygames/anthonyberg-website/blob/main/LICENSE"}><time>{YEAR}</time> © Anthony Berg.</Link>
<a href={"https://github.com/smyalygames/anthonyberg-website/"}>GitHub Repository</a>
</small>
<style jsx>{`
footer {
margin-top: 8rem;
}
a {
float: right;
}
`}</style>
</footer>
),
}

View File

@ -4,7 +4,7 @@
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
@ -13,8 +13,11 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
"incremental": true,
"paths": {
"@/components/*": ["./src/components/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}