Skip to content

sassdavid/personal-site

 
 

Repository files navigation

My Personal Website

This repository was originally forked from Michael D'Angelo's personal site. Since then, I have made several updates and enhancements. I replaced the create-react-app setup with Next.js, leveraging its features for server-side rendering and routing.

I have aimed to maintain clean and simple code while taking full advantage of Next.js capabilities.

For dark theme support, I integrated next-themes.

To standardize type handling, I consolidated redundant type definitions from various files, particularly in the resume section, into a single src/lib/types.tsx. This file serves as a centralized location for reusable type definitions throughout the project.

Regarding SCSS sources, I adopted best practices for Sass. I resolved all deprecation warnings, which had accumulated over the years, ensuring the codebase is free from major issues. While the SCSS setup may not be fully cutting-edge, it is now clean and reliable. The migration process was handled using the official Sass migrator.

For managing the Node.js version and other tools, I utilized mise, an efficient tool for managing multiple CLI tool versions. Finally, I used mise-tasks to define and manage tasks and their dependencies.

Mise Tasks

TOML Tasks

The following TOML tasks are defined in mise.toml:

  • install (mise r i): Installs npm dependencies.
  • build (mise r b): Builds the project.
  • format (mise r f): Formats project files.
  • ci (mise r ci): Installs npm dependencies using npm ci.

File Tasks

These file tasks, located in the mise-tasks directory, help ensure code cleanliness and dynamically gather project data during build time:

Environment Variables

Three environment variables are used during the build process. Their values are managed through mise and defined in mise.toml:

  • NEXT_PUBLIC_GOOGLE_ANALYTICS: Used for Google Analytics integration.
  • NEXT_PUBLIC_NUMBER_OF_LINES: Reflects the number of TypeScript lines, calculated at build time.
  • NEXT_PUBLIC_MDX_DETAILS_ABOUT: Provides details about .mdx files, including word count and reading time.

These variables are substituted at build time, with their management implemented in src/lib/config.tsx.

GitHub Action

The GitHub Action workflow is defined in .github/workflows/github-pages.yml.

This workflow builds and deploys the project to GitHub Pages. For more details, refer to the workflow file.

To deploy a Next.js application to GitHub Pages, I drew inspiration from this guide.

Since I have my own domain, davidsass.eu, I configured the repository to support a custom domain.

To set this up, I took the following steps:

  1. Created a public/CNAME.
  2. Removed the basePath configuration from next.config.js, as it was not needed for my setup.
  3. Adjusted the code to omit the base path, particularly for imported images, as explained here. This step is unnecessary when using a custom domain.

Acknowledgements

About

My personal website - built with React, Next.js and GitHub Pages.

Resources

License

Stars

Watchers

Forks

Languages

  • SCSS 58.4%
  • TypeScript 35.9%
  • MDX 4.9%
  • Shell 0.8%