1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

Compare commits

..

31 Commits

Author SHA1 Message Date
3074945c54 chore(release): 3.3.0 [skip ci] 2024-05-23 20:35:01 +00:00
fc0dfdda5f chore(blog): update shiki to v1.6.0 and update next-mdx-remote to v5.0.0 2024-05-23 22:30:13 +02:00
f62964c62a ci: update GitHub Actions 2024-05-23 21:41:05 +02:00
8ec113c9cb feat(blog): update Git Ultimate Guide to add trick about cherry-pick and diff-commits alias 2024-05-23 10:29:35 +02:00
8a59e9034f chore(release): 3.2.6 [skip ci] 2024-05-21 18:23:28 +00:00
d7121ea833 style: fix tailwindcss linting 2024-05-21 20:18:05 +02:00
c10f690622 build(deps): update dependencies to latest 2024-05-21 20:15:57 +02:00
6915072ab9 chore: delete unused config 2024-05-21 19:31:45 +02:00
dd803bcc51 test: fix should display hello-world blog post 2024-05-21 19:17:29 +02:00
efa33f26ec fix(blog): headings should be aligned with the text, not shifted 2024-05-21 19:06:12 +02:00
5f3dfad988 chore(release): 3.2.5 [skip ci] 2024-05-16 08:09:25 +00:00
b231381cb3 fix: client-side age calculation, more glanular check for isMounted
Allows to render as much as possible on the server side.
While keeping the calculation of the age on the client side to avoid hydratation mismatch.
2024-05-16 10:06:43 +02:00
bbb2e56512 fix: usage of correct heading levels and html tags 2024-05-16 09:56:19 +02:00
66cf6d7438 fix: add scroll behavior: smooth 2024-05-16 09:32:20 +02:00
2a635bf3ba fix: add hover effects 2024-05-16 09:26:05 +02:00
9f79b88202 chore(release): 3.2.4 [skip ci] 2024-04-13 17:17:11 +00:00
23d9caf578 style: fix eslint 2024-04-13 19:13:48 +02:00
7febe6d1f9 fix(blog): typos in posts 2024-04-13 19:03:18 +02:00
c4650c34d9 build(deps): update latest 2024-04-13 18:54:36 +02:00
0eb780485c fix(footer): show 0.0.0-development version in Footer in development 2024-04-06 20:40:25 +02:00
cd5e92b64a fix: hydratation error with age calculation 2024-04-06 20:32:09 +02:00
982b148329 Revert "fix(portfolio): update link to Carolo (carolo.org)"
This reverts commit c2c9b59c7a.
2024-04-06 20:27:04 +02:00
0febee5b51 refactor: rename to primary color 2024-04-06 20:25:02 +02:00
3502f51735 chore(release): 3.2.3 [skip ci] 2024-02-15 08:41:01 +00:00
493df4e2f2 style: fix prettier 2024-02-15 09:35:58 +01:00
c2c9b59c7a fix(portfolio): update link to Carolo (carolo.org) 2024-02-15 09:34:02 +01:00
f6e3008ab9 fix(blog): add command to commit in the past in Git Ultimate Guide 2024-02-15 09:30:34 +01:00
15e94cec64 fix: update dependencies to latest to address security issues Node.js v20.11.1
Ref: https://nodejs.org/en/blog/vulnerability/february-2024-security-releases
2024-02-15 09:27:03 +01:00
5185c6758b chore(release): 3.2.2 [skip ci] 2024-02-02 16:31:35 +00:00
b633eef833 fix: remove npm vulnerability by updating html-w3c-validator 2024-02-02 17:30:25 +01:00
d2e627ff13 chore: cleaner configs 2024-01-29 21:26:59 +01:00
60 changed files with 7535 additions and 5292 deletions

View File

@ -1 +0,0 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:20

View File

@ -1,9 +0,0 @@
services:
workspace:
build:
context: "./"
dockerfile: "./Dockerfile"
volumes:
- "..:/workspace:cached"
command: "sleep infinity"
network_mode: "host"

View File

@ -1,24 +0,0 @@
{
"name": "theoludwig",
"dockerComposeFile": "./compose.yaml",
"service": "workspace",
"workspaceFolder": "/workspace",
"customizations": {
"vscode": {
"settings": {
"remote.autoForwardPorts": false,
"remote.localPortHost": "allInterfaces",
},
},
"extensions": [
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint",
"bradlc.vscode-tailwindcss",
"mikestead.dotenv",
"ms-azuretools.vscode-docker",
],
},
"remoteUser": "node",
}

View File

@ -3,13 +3,9 @@
"extends": [ "extends": [
"conventions", "conventions",
"next/core-web-vitals", "next/core-web-vitals",
"plugin:tailwindcss/recommended", "plugin:tailwindcss/recommended"
"prettier"
], ],
"plugins": ["prettier"], "plugins": ["import", "promise", "unicorn"],
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": { "settings": {
"tailwindcss": { "tailwindcss": {
"callees": ["classNames"] "callees": ["classNames"]
@ -19,7 +15,6 @@
} }
}, },
"rules": { "rules": {
"prettier/prettier": "error",
"react/self-closing-comp": [ "react/self-closing-comp": [
"error", "error",
{ {
@ -33,7 +28,11 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx"], "files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser" "parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"project": "./tsconfig.json"
}
} }
] ]
} }

View File

@ -10,10 +10,10 @@ jobs:
build: build:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- uses: "actions/checkout@v4.1.1" - uses: "actions/checkout@v4.1.6"
- name: "Setup Node.js" - name: "Setup Node.js"
uses: "actions/setup-node@v4.0.1" uses: "actions/setup-node@v4.0.2"
with: with:
node-version: "20.x" node-version: "20.x"
cache: "npm" cache: "npm"

View File

@ -10,10 +10,10 @@ jobs:
lint: lint:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- uses: "actions/checkout@v4.1.1" - uses: "actions/checkout@v4.1.6"
- name: "Setup Node.js" - name: "Setup Node.js"
uses: "actions/setup-node@v4.0.1" uses: "actions/setup-node@v4.0.2"
with: with:
node-version: "20.x" node-version: "20.x"
cache: "npm" cache: "npm"
@ -37,6 +37,6 @@ jobs:
run: "npm run lint:prettier" run: "npm run lint:prettier"
- name: "lint:dotenv" - name: "lint:dotenv"
uses: "dotenv-linter/action-dotenv-linter@v2.18.0" uses: "dotenv-linter/action-dotenv-linter@v2.21.0"
with: with:
github_token: ${{ secrets.github_token }} github_token: ${{ secrets.github_token }}

View File

@ -8,7 +8,7 @@ jobs:
release: release:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- uses: "actions/checkout@v4.1.1" - uses: "actions/checkout@v4.1.6"
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
@ -21,7 +21,7 @@ jobs:
git_commit_gpgsign: true git_commit_gpgsign: true
- name: "Setup Node.js" - name: "Setup Node.js"
uses: "actions/setup-node@v4.0.1" uses: "actions/setup-node@v4.0.2"
with: with:
node-version: "20.x" node-version: "20.x"
cache: "npm" cache: "npm"

View File

@ -10,10 +10,10 @@ jobs:
test-unit: test-unit:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- uses: "actions/checkout@v4.1.1" - uses: "actions/checkout@v4.1.6"
- name: "Setup Node.js" - name: "Setup Node.js"
uses: "actions/setup-node@v4.0.1" uses: "actions/setup-node@v4.0.2"
with: with:
node-version: "20.x" node-version: "20.x"
cache: "npm" cache: "npm"
@ -27,10 +27,10 @@ jobs:
test-e2e: test-e2e:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- uses: "actions/checkout@v4.1.1" - uses: "actions/checkout@v4.1.6"
- name: "Setup Node.js" - name: "Setup Node.js"
uses: "actions/setup-node@v4.0.1" uses: "actions/setup-node@v4.0.2"
with: with:
node-version: "20.x" node-version: "20.x"
cache: "npm" cache: "npm"

View File

@ -1,10 +0,0 @@
image: "gitpod/workspace-full"
tasks:
- before: "cp .env.example .env"
init: "npm clean-install"
command: "npm run dev"
ports:
- port: 3000
onOpen: "open-preview"

View File

@ -1,4 +1,5 @@
{ {
"$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/master/schema/html-w3c-validatorrc-schema.json",
"urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/blog"], "urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/blog"],
"files": ["./public/curriculum-vitae/index.html"], "files": ["./public/curriculum-vitae/index.html"],
"severities": ["error"] "severities": ["error"]

View File

@ -1,4 +1,7 @@
{ {
"**/*": ["prettier --write --ignore-unknown", "editorconfig-checker"], "**/*": ["editorconfig-checker", "prettier --write --ignore-unknown"],
"**/*.{md,mdx}": ["markdownlint-cli2 --fix --no-globs"] "**/*.md": ["markdownlint-cli2 --fix --no-globs"],
"**/*.{js,jsx,ts,tsx}": [
"eslint --fix --max-warnings 0 --report-unused-disable-directives"
]
} }

View File

@ -6,7 +6,7 @@
"no-duplicate-heading": false, "no-duplicate-heading": false,
"no-inline-html": false, "no-inline-html": false,
}, },
"globs": ["**/*.{md,mdx}"], "globs": ["**/*.md"],
"ignores": ["**/node_modules"], "ignores": ["**/node_modules"],
"customRules": ["markdownlint-rule-relative-links"], "customRules": ["markdownlint-rule-relative-links"],
} }

View File

@ -29,8 +29,6 @@ The commit message guidelines adheres to [Conventional Commits](https://www.conv
## Getting Started ## Getting Started
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/theoludwig/theoludwig)
### Prerequisites ### Prerequisites
- [Node.js](https://nodejs.org/) >= 20.0.0 - [Node.js](https://nodejs.org/) >= 20.0.0
@ -66,6 +64,6 @@ npm run dev
docker compose up --build docker compose up --build
``` ```
### Services started ### Service started
- `website`: <http://127.0.0.1:3000> `website`: <http://127.0.0.1:3000>

View File

@ -1,9 +1,9 @@
FROM node:20.11.0 AS builder-dependencies FROM node:20.12.2 AS builder-dependencies
WORKDIR /usr/src/application WORKDIR /usr/src/application
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm clean-install RUN npm clean-install
FROM node:20.11.0 AS builder FROM node:20.12.2 AS builder
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV IS_STANDALONE=true ENV IS_STANDALONE=true
WORKDIR /usr/src/application WORKDIR /usr/src/application
@ -11,7 +11,7 @@ COPY --from=builder-dependencies /usr/src/application/node_modules ./node_module
COPY ./ ./ COPY ./ ./
RUN npm run build RUN npm run build
FROM node:20.11.0-slim AS runner FROM node:20.12.2-slim AS runner
ENV NODE_ENV=production ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0 ENV HOSTNAME=0.0.0.0
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1

View File

@ -25,7 +25,7 @@ const BlogPage = async (): Promise<JSX.Element> => {
return ( return (
<main className="flex flex-1 flex-col flex-wrap items-center"> <main className="flex flex-1 flex-col flex-wrap items-center">
<div className="mt-10 flex flex-col items-center"> <div className="mt-10 flex flex-col items-center">
<h1 className="text-4xl font-semibold text-yellow dark:text-yellow-dark"> <h1 className="text-4xl font-semibold text-primary dark:text-primary-dark">
Blog Blog
</h1> </h1>
<p className="mt-6 text-center" data-cy="blog-post-date"> <p className="mt-6 text-center" data-cy="blog-post-date">

View File

@ -18,7 +18,7 @@ const ErrorHandling = (props: ErrorHandlingProps): JSX.Element => {
<h1 className="my-6 text-4xl font-semibold"> <h1 className="my-6 text-4xl font-semibold">
Error{" "} Error{" "}
<span <span
className="text-yellow dark:text-yellow-dark" className="text-primary dark:text-primary-dark"
data-cy="status-code" data-cy="status-code"
> >
500 500

View File

@ -29,7 +29,7 @@
.prose a, .prose a,
.prose strong { .prose strong {
@apply !font-semibold text-yellow dark:text-yellow-dark; @apply !font-semibold text-primary dark:text-primary-dark;
} }
strong, strong,
@ -62,15 +62,17 @@ code {
code .line::before { code .line::before {
content: counter(step); content: counter(step);
counter-increment: step; counter-increment: step;
width: 1rem; margin-right: 1rem;
margin-right: 1.5rem;
display: inline-block;
text-align: right; text-align: right;
color: rgba(133, 133, 133, 0.8); color: rgba(133, 133, 133, 0.8);
word-wrap: normal; word-wrap: normal;
word-break: normal; word-break: normal;
} }
code .line:last-child {
display: none;
}
.katex .base { .katex .base {
display: inline !important; display: inline !important;
white-space: normal !important; white-space: normal !important;

View File

@ -57,10 +57,13 @@ const RootLayout = (props: RootLayoutProps): JSX.Element => {
return ( return (
<html <html
lang={i18n.locale} lang={i18n.locale}
className={classNames({ className={classNames(
dark: theme === "dark", {
light: theme === "light", dark: theme === "dark",
})} light: theme === "light",
},
"scroll-smooth",
)}
style={{ style={{
colorScheme: theme, colorScheme: theme,
}} }}

View File

@ -10,7 +10,7 @@ const NotFound = (): JSX.Element => {
<h1 className="my-6 text-4xl font-semibold"> <h1 className="my-6 text-4xl font-semibold">
{i18n.translate("errors.error")}{" "} {i18n.translate("errors.error")}{" "}
<span <span
className="text-yellow dark:text-yellow-dark" className="text-primary dark:text-primary-dark"
data-cy="status-code" data-cy="status-code"
> >
404 404
@ -20,7 +20,7 @@ const NotFound = (): JSX.Element => {
{i18n.translate("errors.not-found")}{" "} {i18n.translate("errors.not-found")}{" "}
<Link <Link
href="/" href="/"
className="text-yellow hover:underline dark:text-yellow-dark" className="text-primary hover:underline dark:text-primary-dark"
> >
{i18n.translate("errors.return-to-home-page")} {i18n.translate("errors.return-to-home-page")}
</Link> </Link>

View File

@ -21,7 +21,7 @@ export const BlogPost = async (props: BlogPostProps): Promise<JSX.Element> => {
return ( return (
<main className="break-wrap-words flex flex-1 flex-col flex-wrap items-center justify-center"> <main className="break-wrap-words flex flex-1 flex-col flex-wrap items-center justify-center">
<div className="my-10 flex flex-col items-center text-center"> <div className="my-10 flex flex-col items-center text-center">
<h1 className="text-3xl font-semibold text-yellow dark:text-yellow-dark"> <h1 className="text-3xl font-semibold text-primary dark:text-primary-dark">
{blogPost.frontmatter.title} {blogPost.frontmatter.title}
</h1> </h1>
<p className="mt-2" data-cy="blog-post-date"> <p className="mt-2" data-cy="blog-post-date">

View File

@ -1,22 +1,22 @@
import { faLink } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { nodeTypes } from "@mdx-js/mdx"
import rehypeShikiFromHighlighter from "@shikijs/rehype/core"
import { MDXRemote } from "next-mdx-remote/rsc"
import { cookies } from "next/headers"
import Image from "next/image" import Image from "next/image"
import Link from "next/link" import Link from "next/link"
import { cookies } from "next/headers"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faLink } from "@fortawesome/free-solid-svg-icons"
import { MDXRemote } from "next-mdx-remote/rsc"
import { nodeTypes } from "@mdx-js/mdx"
import rehypeRaw from "rehype-raw"
import remarkGfm from "remark-gfm"
import rehypeSlug from "rehype-slug"
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex" import rehypeKatex from "rehype-katex"
import { getHighlighter } from "shiki" import rehypeRaw from "rehype-raw"
import rehypeSlug from "rehype-slug"
import remarkGfm from "remark-gfm"
import remarkMath from "remark-math"
import { getHighlighterCore } from "shiki/core"
import "katex/dist/katex.min.css" import "katex/dist/katex.min.css"
import { getTheme } from "@/theme/theme.server"
import { remarkSyntaxHighlightingPlugin } from "@/blog/remarkSyntaxHighlightingPlugin"
import { BlogPostComments } from "@/blog/BlogPostComments" import { BlogPostComments } from "@/blog/BlogPostComments"
import { getTheme } from "@/theme/theme.server"
const Heading = ( const Heading = (
props: React.DetailedHTMLProps< props: React.DetailedHTMLProps<
@ -26,14 +26,14 @@ const Heading = (
): JSX.Element => { ): JSX.Element => {
const { children, id = "" } = props const { children, id = "" } = props
return ( return (
<h2 {...props} className="group"> <h2 {...props}>
<Link <Link href={`#${id}`} className="group relative hover:no-underline">
href={`#${id}`} <FontAwesomeIcon
className="invisible !text-black group-hover:visible dark:!text-white" className="absolute bottom-2 left-[-26px] mr-2 hidden size-4 !text-black group-hover:inline dark:!text-white"
> icon={faLink}
<FontAwesomeIcon className="mr-2 inline size-4" icon={faLink} /> />
{children}
</Link> </Link>
{children}
</h2> </h2>
) )
} }
@ -50,8 +50,19 @@ export const BlogPostContent = async (
const cookiesStore = cookies() const cookiesStore = cookies()
const theme = getTheme() const theme = getTheme()
const highlighter = await getHighlighter({ const highlighter = await getHighlighterCore({
theme: `${theme}-plus`, themes: [
import("shiki/themes/light-plus.mjs"),
import("shiki/themes/dark-plus.mjs"),
],
langs: [
import("shiki/langs/markdown.mjs"),
import("shiki/langs/shell.mjs"),
import("shiki/langs/javascript.mjs"),
import("shiki/langs/typescript.mjs"),
import("shiki/langs/python.mjs"),
],
loadWasm: import("shiki/wasm"),
}) })
return ( return (
@ -61,15 +72,18 @@ export const BlogPostContent = async (
source={content} source={content}
options={{ options={{
mdxOptions: { mdxOptions: {
remarkPlugins: [ remarkPlugins: [remarkGfm, remarkMath],
remarkGfm,
[remarkSyntaxHighlightingPlugin, { highlighter }],
remarkMath,
],
rehypePlugins: [ rehypePlugins: [
rehypeSlug, rehypeSlug,
[rehypeRaw, { passThrough: nodeTypes }], [rehypeRaw, { passThrough: nodeTypes }],
rehypeKatex, rehypeKatex,
[
rehypeShikiFromHighlighter,
highlighter,
{
theme: `${theme}-plus`,
},
],
], ],
}, },
}} }}

View File

@ -9,37 +9,34 @@ export const BlogPosts = async (): Promise<JSX.Element> => {
return ( return (
<div className="flex w-full items-center justify-center p-8"> <div className="flex w-full items-center justify-center p-8">
<div className="w-[1600px]" data-cy="blog-posts"> <ul className="w-[1600px]" data-cy="blog-posts">
{posts.map((post, index) => { {posts.map((post) => {
const postPublishedOn = date.format( const postPublishedOn = date.format(
new Date(post.frontmatter.publishedOn), new Date(post.frontmatter.publishedOn),
"DD/MM/YYYY", "DD/MM/YYYY",
) )
return ( return (
<Link <li key={post.slug}>
href={`/blog/${post.slug}`} <Link href={`/blog/${post.slug}`} locale="en" data-cy={post.slug}>
key={index} <ShadowContainer className="cursor-pointer p-6 transition-all duration-300 ease-in-out hover:scale-[1.02]">
locale="en" <h2
data-cy={post.slug} data-cy="blog-post-title"
> className="text-xl font-semibold text-primary dark:text-primary-dark"
<ShadowContainer className="cursor-pointer p-6 transition duration-200 ease-in-out hover:-translate-y-2"> >
<h2 {post.frontmatter.title}
data-cy="blog-post-title" </h2>
className="text-xl font-semibold text-yellow dark:text-yellow-dark" <p data-cy="blog-post-date" className="mt-2">
> {postPublishedOn}
{post.frontmatter.title} </p>
</h2> <p data-cy="blog-post-description" className="mt-3">
<p data-cy="blog-post-date" className="mt-2"> {post.frontmatter.description}
{postPublishedOn} </p>
</p> </ShadowContainer>
<p data-cy="blog-post-description" className="mt-3"> </Link>
{post.frontmatter.description} </li>
</p>
</ShadowContainer>
</Link>
) )
})} })}
</div> </ul>
</div> </div>
) )
} }

View File

@ -19,13 +19,13 @@ A clean code is a code that is **easy** to **read** and easy to **understand**.
But I promise it is not a code that is easy to write, in fact it is really **hard to write Clean Code**. But I promise it is not a code that is easy to write, in fact it is really **hard to write Clean Code**.
We could ask ourselves, what is **easy** to **read** and easy to **understand** ? We could ask ourselves, what is **easy** to **read** and easy to **understand**?
It depends of many factors, and is somewhat relative to each one of us. The **perfect** Clean code **doesn't exist**, but we can try to be **as perfect as possible**. It depends of many factors, and is somewhat relative to each one of us. The **perfect** Clean code **doesn't exist**, but we can try to be **as perfect as possible**.
## Why is it so important? ## Why is it so important?
Code like that works great, but it is not enough, even if the code will be read by the computer and understood by the machine, we should not forget that the code is **written by human** and will be also **read by human** not only a machine. Code that works is great, but not enough, even if the code will be read and understood by the computer, we should not forget that the code is **written by human** and will be also **read by human** not only a machine.
For example the [Linux kernel](https://www.kernel.org/), is one of the biggest open source project with many contributors worldwide. Last data shows that it is about **20 millions** lines of code. For example the [Linux kernel](https://www.kernel.org/), is one of the biggest open source project with many contributors worldwide. Last data shows that it is about **20 millions** lines of code.

View File

@ -84,7 +84,10 @@ git add .
git add <file> git add <file>
# Commit changes # Commit changes
git commit -m "chore: initial commit" git commit -m "Commit message"
# Commit changes in the past
git commit --date "10 day ago" -m "Commit message"
# Add remote repository # Add remote repository
git remote add <remote> <url> git remote add <remote> <url>
@ -151,6 +154,17 @@ git reset --soft <branch>
# (by first being on the branch where you want to apply the commit) # (by first being on the branch where you want to apply the commit)
git cherry-pick <commit> git cherry-pick <commit>
# To avoid creating duplicated commits with cherry-pick, we can use rebase after cherry-pick.
# <target-branch> being the commit where you want to apply the commit to cherry-pick.
# <from-branch> being the branch where the commit to cherry-pick is.
git rebase <target-branch> <from-branch>
# If, by mistake, you have started a branch from the wrong base branch, you can rebase the branch on the correct base branch.
# For example, if you have started a branch `feature-2` from `feature` instead of `develop`, you can rebase the branch on `develop`.
git rebase --onto <new-base-branch> <old-base-branch> <branch>
# For example:
git rebase --onto develop feature feature-2
# To list all commits that differ between two branches # To list all commits that differ between two branches
git log <branch1>..<branch2> # commits in branch2 that are not in branch1 (branch2 ahead of branch1, branch2 behind branch1) git log <branch1>..<branch2> # commits in branch2 that are not in branch1 (branch2 ahead of branch1, branch2 behind branch1)
git log <branch2>..<branch1> # commits in branch1 that are not in branch2 (branch1 ahead of branch2, branch1 behind branch2) git log <branch2>..<branch1> # commits in branch1 that are not in branch2 (branch1 ahead of branch2, branch1 behind branch2)
@ -242,6 +256,32 @@ There are many ways to organize the work, but the most popular ones are:
They are called **Git workflows**, or **Git branching strategies**. They are called **Git workflows**, or **Git branching strategies**.
## Tips and tricks
### `diff-commits` alias
The `git diff` command allows you to compare the changes between two commits, branches, etc.
Sometimes, you want to compare what commits have been made between two branches, without looking at the changes in the files, to do so, we can create an `alias` in `.gitconfig`:
```sh
[alias]
diff-commits = !sh -c 'echo -n "Commits in $2 not in $1 \\(" && printf "%d" $(git cherry -v $1 $2 | wc -l) && echo "\\)" && git cherry -v $1 $2 && echo "" && echo -n "Commits in $1 not in $2 \\(" && printf "%d" $(git cherry -v $2 $1 | wc -l) && echo "\\)" && git cherry -v $2 $1' -
```
With this alias, we can compare the commits between `main` and `develop` branches for example:
```sh
$ git diff-commits main develop
Commits in develop not in main (2)
+ 9b80e0724df8454b43bc3935a1bffb67615572d7 feat: new feature
+ 50721f8ecb60ff023bdccc1873ec1e20ee0b21a0 feat: new feature 2
Commits in main not in develop (1)
- f7bb9d2af7763e0a311099e880e8bf7d6b51bf4d fix: urgent hotfix
```
## Conclusion ## Conclusion
`git` is the tool that every programmer should know to do collaborative work (not only, `git` is also very powerful even when working alone) and keep track of changes across a set of files. `git` is the tool that every programmer should know to do collaborative work (not only, `git` is also very powerful even when working alone) and keep track of changes across a set of files.

View File

@ -15,7 +15,7 @@ We don't want to "reinvent the wheel" and rewrite everything from scratch for ea
However, it is important to draw a line between what dependencies are worth the cost and which are not. However, it is important to draw a line between what dependencies are worth the cost and which are not.
Most likely adding a [JavaScript npm package `is-odd`](https://www.npmjs.com/package/is-odd) to check if a number is odd or even for example, is not worth it. Writing it ourselves is easier and allows a better maintenance in the long term. Most likely adding a [JavaScript npm package `is-odd`](https://www.npmjs.com/package/is-odd) to check if a number is odd or even for example, is not worth it. Writing it ourselves allows a better maintenance in the long term.
Learning **how to solve problems** and how to write efficient code is very important and also a very broad and complicated topic, so this blog post will only be an **introduction to the subject**, and will not go in depth. Learning **how to solve problems** and how to write efficient code is very important and also a very broad and complicated topic, so this blog post will only be an **introduction to the subject**, and will not go in depth.
@ -240,7 +240,7 @@ Here is a list of classes of functions that are commonly encountered when analyz
### Estimating efficiency ### Estimating efficiency
By checking the time complexity of an algorithm, it is possible to check before implementing the algorithm,that it is efficient enough for the problem. By checking the time complexity of an algorithm, it is possible to check before implementing the algorithm, that it is efficient enough for the problem.
Example: assume that the time limit for a problem is 1 second and the input size is $n = 10^5$. If the time complexity is $O(n^2)$, the algorithm will perform about $(10^5)^2 = 10^{10}$ operations. Example: assume that the time limit for a problem is 1 second and the input size is $n = 10^5$. If the time complexity is $O(n^2)$, the algorithm will perform about $(10^5)^2 = 10^{10}$ operations.
@ -286,7 +286,7 @@ Contiguous subarray is any sub series of elements in a given array that are cont
**Explanation:** The subarray with the largest sum is `[2, 4, -3, 5, 2]` which has a sum of `10`. **Explanation:** The subarray with the largest sum is `[2, 4, -3, 5, 2]` which has a sum of `10`.
### Worst solution: Brute force ### Worst solution: Brute force ($O(n^3)$)
```python ```python
def maximum_subarray_sum_cubic(array: list[int]) -> int: def maximum_subarray_sum_cubic(array: list[int]) -> int:
@ -309,7 +309,7 @@ def maximum_subarray_sum_cubic(array: list[int]) -> int:
return best_sum return best_sum
``` ```
### Better solution: Linear time ### Better solution: Linear time ($O(n)$)
```python ```python
def maximum_subarray_sum_linear(array: list[int]) -> int: def maximum_subarray_sum_linear(array: list[int]) -> int:

View File

@ -1,32 +0,0 @@
import type { Plugin, Transformer } from "unified"
import type { Literal, Node } from "unist"
import { visit } from "unist-util-visit"
import type { Highlighter } from "shiki"
export interface RemarkSyntaxHighlightingPluginOptions {
highlighter: Highlighter
}
export interface RemarkSyntaxHighlightingNode extends Node {
lang: string
meta: string
children: undefined
value: string
data: Record<string, unknown>
}
export const remarkSyntaxHighlightingPlugin: Plugin<
[RemarkSyntaxHighlightingPluginOptions],
Literal
> = (options) => {
const transformer: Transformer<RemarkSyntaxHighlightingNode> = (tree) => {
visit<RemarkSyntaxHighlightingNode, string>(tree, "code", (node) => {
node.type = "html"
node.children = undefined
node.value = options.highlighter.codeToHtml(node.value, {
lang: node.lang,
})
})
}
return transformer
}

View File

@ -9,7 +9,7 @@ export const FooterText = (): JSX.Element => {
<p> <p>
<Link <Link
href="/" href="/"
className="font-semibold text-yellow hover:underline dark:text-yellow-dark" className="font-semibold text-primary hover:underline dark:text-primary-dark"
> >
Théo LUDWIG Théo LUDWIG
</Link>{" "} </Link>{" "}

View File

@ -16,7 +16,7 @@ export const FooterVersion = (props: FooterVersionProps): JSX.Element => {
Version{" "} Version{" "}
<a <a
data-cy="version-link" data-cy="version-link"
className="font-semibold text-yellow hover:underline dark:text-yellow-dark" className="font-semibold text-primary hover:underline dark:text-primary-dark"
href={versionLink} href={versionLink}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"

View File

@ -1,9 +1,10 @@
import { getVersion } from "@/utils/getVersion"
import { FooterText } from "./FooterText" import { FooterText } from "./FooterText"
import { FooterVersion } from "./FooterVersion" import { FooterVersion } from "./FooterVersion"
export const Footer = async (): Promise<JSX.Element> => { export const Footer = async (): Promise<JSX.Element> => {
const { readPackage } = await import("read-pkg") const version = await getVersion()
const { version } = await readPackage()
return ( return (
<footer className="flex flex-col items-center justify-center border-t-2 border-gray-600 bg-white py-6 text-lg dark:border-gray-400 dark:bg-black"> <footer className="flex flex-col items-center justify-center border-t-2 border-gray-600 bg-white py-6 text-lg dark:border-gray-400 dark:bg-black">

View File

@ -58,7 +58,7 @@ export const SwitchTheme = (props: SwitchThemeProps): JSX.Element => {
</div> </div>
<div <div
className={classNames( className={classNames(
"absolute top-[1px] box-border size-[22px] rounded-[50%] bg-[#fafafa] text-white transition-all duration-[250ms] ease-in-out", "absolute top-px box-border size-[22px] rounded-[50%] bg-[#fafafa] text-white transition-all duration-[250ms] ease-in-out",
{ {
"left-[27px]": theme === "dark", "left-[27px]": theme === "dark",
"left-0": theme === "light", "left-0": theme === "light",
@ -70,7 +70,7 @@ export const SwitchTheme = (props: SwitchThemeProps): JSX.Element => {
data-cy="switch-theme-input" data-cy="switch-theme-input"
type="checkbox" type="checkbox"
aria-label="Dark mode toggle" aria-label="Dark mode toggle"
className="absolute m-[-1px] hidden size-[1px] overflow-hidden border-0 p-0" className="absolute -m-px hidden size-px overflow-hidden border-0 p-0"
defaultChecked defaultChecked
/> />
</div> </div>

View File

@ -14,8 +14,11 @@ export const Header = (): JSX.Element => {
return ( return (
<header className="sticky top-0 z-50 flex w-full justify-between border-b-2 border-gray-600 bg-white px-6 py-2 dark:border-gray-400 dark:bg-black"> <header className="sticky top-0 z-50 flex w-full justify-between border-b-2 border-gray-600 bg-white px-6 py-2 dark:border-gray-400 dark:bg-black">
<Link href="/"> <h1>
<h1 className="flex items-center justify-center"> <Link
href="/"
className="flex items-center justify-center transition-all duration-300 ease-in-out hover:scale-105"
>
<Image <Image
quality={100} quality={100}
className="size-16" className="size-16"
@ -23,17 +26,17 @@ export const Header = (): JSX.Element => {
alt="Théo LUDWIG" alt="Théo LUDWIG"
priority priority
/> />
<strong className="ml-1 hidden font-headline font-semibold text-yellow dark:text-yellow-dark sm:block sm:text-xl"> <strong className="ml-1 hidden font-headline font-semibold text-primary dark:text-primary-dark sm:block sm:text-xl">
Théo LUDWIG Théo LUDWIG
</strong> </strong>
</h1> </Link>
</Link> </h1>
<div className="flex justify-between"> <div className="flex justify-between">
<div className="flex flex-col items-center justify-center px-6"> <div className="flex flex-col items-center justify-center px-6">
<Link <Link
href="/blog" href="/blog"
data-cy="header-blog-link" data-cy="header-blog-link"
className="font-semibold text-yellow hover:underline dark:text-yellow-dark" className="font-semibold text-primary hover:underline dark:text-primary-dark"
> >
Blog Blog
</Link> </Link>

View File

@ -20,14 +20,11 @@ export const InterestParagraph = (
const { title, description } = props const { title, description } = props
return ( return (
<> <div className="my-6 text-center text-gray dark:text-gray-dark">
<p className="my-6 text-center text-gray dark:text-gray-dark"> <h3 className="text-lg font-semibold text-primary dark:text-primary-dark">
<strong className="text-lg font-semibold text-yellow dark:text-yellow-dark"> {title}
{title} </h3>
</strong> <p className="my-2">{htmlParser(description)}</p>
<br /> </div>
<span>{htmlParser(description)}</span>
</p>
</>
) )
} }

View File

@ -12,7 +12,7 @@ export const InterestItem = (props: InterestItemProps): JSX.Element => {
return ( return (
<li className="m-2 size-8" title={title}> <li className="m-2 size-8" title={title}>
<FontAwesomeIcon <FontAwesomeIcon
className="block size-full text-yellow dark:text-yellow-dark" className="block size-full text-primary dark:text-primary-dark"
icon={fontAwesomeIcon} icon={fontAwesomeIcon}
/> />
</li> </li>

View File

@ -16,8 +16,8 @@ export const Interests = (): JSX.Element => {
return ( return (
<div className="max-w-full"> <div className="max-w-full">
{paragraphs.map((paragraph, index) => { {paragraphs.map((paragraph) => {
return <InterestParagraph key={index} {...paragraph} /> return <InterestParagraph key={paragraph.id} {...paragraph} />
})} })}
<InterestsList /> <InterestsList />
</div> </div>

View File

@ -11,16 +11,18 @@ export const Repository = (props: RepositoryProps): JSX.Element => {
const { name, description, href } = props const { name, description, href } = props
return ( return (
<ShadowContainer className="relative !mb-4 max-h-32 cursor-pointer p-6 transition-transform duration-200 ease-in-out hover:-translate-y-2"> <li>
<a href={href} target="_blank" rel="noopener noreferrer"> <a href={href} target="_blank" rel="noopener noreferrer">
<div className="flex"> <ShadowContainer className="relative !mb-4 max-h-32 cursor-pointer p-6 transition-all duration-300 ease-in-out hover:scale-[1.03]">
<GitHubIcon className="mr-2 h-6" /> <h3 className="flex">
<span className="font-semibold text-yellow dark:text-yellow-dark"> <GitHubIcon className="mr-2 h-6" />
{name} <span className="font-semibold text-primary dark:text-primary-dark">
</span> {name}
</div> </span>
<p className="my-4">{description}</p> </h3>
<p className="my-4">{description}</p>
</ShadowContainer>
</a> </a>
</ShadowContainer> </li>
) )
} }

View File

@ -10,7 +10,7 @@ export const OpenSource = (): JSX.Element => {
<p className="text-center"> <p className="text-center">
{i18n.translate("home.open-source.description")} {i18n.translate("home.open-source.description")}
</p> </p>
<div className="my-6 grid grid-cols-1 gap-6 md:w-10/12 md:grid-cols-2"> <ul className="my-6 grid grid-cols-1 gap-6 md:w-10/12 md:grid-cols-2">
<Repository <Repository
name="nodejs/node" name="nodejs/node"
description="Node.js JavaScript runtime ✨🐢🚀✨" description="Node.js JavaScript runtime ✨🐢🚀✨"
@ -31,7 +31,7 @@ export const OpenSource = (): JSX.Element => {
description="The React Framework" description="The React Framework"
href="https://github.com/vercel/next.js/commits?author=theoludwig" href="https://github.com/vercel/next.js/commits?author=theoludwig"
/> />
</div> </ul>
</div> </div>
) )
} }

View File

@ -13,7 +13,7 @@ export const PortfolioItem = (props: PortfolioItemProps): JSX.Element => {
const { title, description, link, image } = props const { title, description, link, image } = props
return ( return (
<ShadowContainer className="relative cursor-pointer items-center sm:ml-10"> <li>
<a <a
className="group inline-flex justify-center" className="group inline-flex justify-center"
target="_blank" target="_blank"
@ -21,23 +21,25 @@ export const PortfolioItem = (props: PortfolioItemProps): JSX.Element => {
href={link} href={link}
aria-label={title} aria-label={title}
> >
<div className="flex justify-center"> <ShadowContainer className="relative cursor-pointer items-center sm:ml-10">
<Image <div className="flex justify-center">
quality={100} <Image
className="size-auto transition-opacity duration-500 group-hover:opacity-20 dark:group-hover:opacity-5" quality={100}
width={300} className="size-auto transition-opacity duration-500 group-hover:opacity-20 dark:group-hover:opacity-5"
height={300} width={300}
src={image} height={300}
alt={title} src={image}
/> alt={title}
</div> />
<div className="absolute bottom-0 h-auto overflow-hidden text-center opacity-0 transition-opacity duration-500 group-hover:opacity-100"> </div>
<h3 className="my-6 text-2xl font-semibold text-yellow dark:text-yellow-dark"> <div className="absolute bottom-0 h-auto overflow-hidden text-center opacity-0 transition-opacity duration-500 group-hover:opacity-100">
{title} <h3 className="my-6 text-2xl font-semibold text-primary dark:text-primary-dark">
</h3> {title}
<p className="mx-4 my-6 font-semibold">{description}</p> </h3>
</div> <p className="mx-4 my-6 font-semibold">{description}</p>
</div>
</ShadowContainer>
</a> </a>
</ShadowContainer> </li>
) )
} }

View File

@ -12,10 +12,10 @@ export const Portfolio = (): JSX.Element => {
} }
return ( return (
<div className="flex w-full flex-wrap justify-center px-3"> <ul className="flex w-full flex-wrap justify-center px-3">
{items.map((item, index) => { {items.map((item) => {
return <PortfolioItem key={index} {...item} /> return <PortfolioItem key={item.title} {...item} />
})} })}
</div> </ul>
) )
} }

View File

@ -12,7 +12,7 @@ export const ProfileDescriptionBottom = (): JSX.Element => {
<br /> <br />
<a <a
href="/curriculum-vitae/index.html" href="/curriculum-vitae/index.html"
className="font-semibold text-yellow hover:underline dark:text-yellow-dark" className="font-semibold text-primary hover:underline dark:text-primary-dark"
> >
Curriculum vitæ ({i18n.translate("common.fr-FR")}) Curriculum vitæ ({i18n.translate("common.fr-FR")})
</a> </a>

View File

@ -5,7 +5,7 @@ export const ProfileInformation = (): JSX.Element => {
return ( return (
<div className="mb-6 border-b-2 border-gray-600 pb-2 font-headline dark:border-gray-400"> <div className="mb-6 border-b-2 border-gray-600 pb-2 font-headline dark:border-gray-400">
<h1 className="mb-2 text-4xl font-semibold text-yellow dark:text-yellow-dark"> <h1 className="mb-2 text-4xl font-semibold text-primary dark:text-primary-dark">
Théo LUDWIG Théo LUDWIG
</h1> </h1>
<h2 className="mb-3 text-base"> <h2 className="mb-3 text-base">

View File

@ -5,6 +5,7 @@ import { useMemo } from "react"
import { useI18n } from "@/i18n/i18n.client" import { useI18n } from "@/i18n/i18n.client"
import { BIRTH_DATE, BIRTH_DATE_STRING, getAge } from "@/utils/getAge" import { BIRTH_DATE, BIRTH_DATE_STRING, getAge } from "@/utils/getAge"
import type { CookiesStore } from "@/utils/constants" import type { CookiesStore } from "@/utils/constants"
import { useIsMounted } from "@/hooks/useIsMounted"
import { ProfileItem } from "./ProfileItem" import { ProfileItem } from "./ProfileItem"
@ -21,6 +22,8 @@ export const ProfileList = (props: ProfileListProps): JSX.Element => {
return getAge(BIRTH_DATE) return getAge(BIRTH_DATE)
}, []) }, [])
const { isMounted } = useIsMounted()
return ( return (
<ul className="m-0 list-none p-0"> <ul className="m-0 list-none p-0">
<ProfileItem <ProfileItem
@ -29,10 +32,15 @@ export const ProfileList = (props: ProfileListProps): JSX.Element => {
/> />
<ProfileItem <ProfileItem
title={i18n.translate("home.about.birth-date")} title={i18n.translate("home.about.birth-date")}
value={`${BIRTH_DATE_STRING} (${age} ${i18n.translate( value={
"home.about.years-old", isMounted
)})`} ? `${BIRTH_DATE_STRING} (${age} ${i18n.translate(
"home.about.years-old",
)})`
: BIRTH_DATE_STRING
}
/> />
<ProfileItem <ProfileItem
title={i18n.translate("home.about.nationality")} title={i18n.translate("home.about.nationality")}
value="Alsace, France" value="Alsace, France"

View File

@ -13,7 +13,7 @@ export const SocialMediaItem = (props: SocialMediaItemProps): JSX.Element => {
aria-label={ariaLabel} aria-label={ariaLabel}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="relative inline-block bg-transparent" className="relative inline-block bg-transparent transition-all duration-300 ease-in-out hover:scale-110"
> >
{children} {children}
</a> </a>

View File

@ -27,13 +27,13 @@ export const SkillComponent = (props: SkillComponentProps): JSX.Element => {
} }
return ( return (
<a <li>
href={skillProperties.link} <a
className="mx-2 max-w-xl text-yellow hover:underline dark:text-yellow-dark" href={skillProperties.link}
target="_blank" className="mx-2 flex max-w-xl flex-col items-center justify-center text-center text-primary hover:underline dark:text-primary-dark"
rel="noopener noreferrer" target="_blank"
> rel="noopener noreferrer"
<div className="text-center"> >
<Image <Image
className="inline size-16" className="inline size-16"
quality={100} quality={100}
@ -43,7 +43,7 @@ export const SkillComponent = (props: SkillComponentProps): JSX.Element => {
src={getImage()} src={getImage()}
/> />
<p className="mt-1 font-semibold">{skill}</p> <p className="mt-1 font-semibold">{skill}</p>
</div> </a>
</a> </li>
) )
} }

View File

@ -14,11 +14,11 @@ export const SkillsSection = (props: SkillsSectionProps): JSX.Element => {
<div className="flex flex-wrap px-4 py-6"> <div className="flex flex-wrap px-4 py-6">
<div className="flex-1"> <div className="flex-1">
<div className="mb-8 border-b border-gray-600 dark:border-white/10"> <div className="mb-8 border-b border-gray-600 dark:border-white/10">
<h3 className="my-3 text-xl font-semibold text-yellow dark:text-yellow-dark"> <h3 className="my-3 text-xl font-semibold text-primary dark:text-primary-dark">
{title} {title}
</h3> </h3>
</div> </div>
<div className="flex flex-wrap justify-around">{children}</div> <ul className="flex flex-wrap justify-around">{children}</ul>
</div> </div>
</div> </div>
</div> </div>

View File

@ -16,7 +16,7 @@ export const Loader = (props: LoaderProps): JSX.Element => {
height, height,
}} }}
className={classNames( className={classNames(
"inline-block animate-spin rounded-full border-[3px] border-current border-t-transparent text-yellow dark:text-yellow-dark", "inline-block animate-spin rounded-full border-[3px] border-current border-t-transparent text-primary dark:text-primary-dark",
className, className,
)} )}
role="status" role="status"

View File

@ -6,7 +6,7 @@ export const SectionHeading = (props: SectionHeadingProps): JSX.Element => {
return ( return (
<h2 <h2
{...rest} {...rest}
className="mb-3 mt-1 text-center text-4xl font-semibold text-yellow dark:text-yellow-dark" className="mb-3 mt-1 text-center text-4xl font-semibold text-primary dark:text-primary-dark"
> >
{children} {children}
</h2> </h2>

View File

@ -57,8 +57,8 @@ export const Section = (props: SectionProps): JSX.Element => {
</p> </p>
) : null} ) : null}
<div className="w-full px-3"> <div className="w-full px-3">
<ShadowContainer> <ShadowContainer className="w-full px-2 py-4 leading-8 sm:px-16">
<div className="w-full px-16 py-4 leading-8">{children}</div> {children}
</ShadowContainer> </ShadowContainer>
</div> </div>
</section> </section>

File diff suppressed because it is too large Load Diff

View File

@ -13,9 +13,9 @@
"modern-normalize": "2.0.0" "modern-normalize": "2.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "20.11.8", "@types/node": "20.12.12",
"date-and-time": "3.1.1", "date-and-time": "3.3.0",
"vite": "5.0.12", "vite": "5.2.11",
"vite-plugin-html": "3.2.2" "vite-plugin-html": "3.2.2"
} }
} }

View File

@ -3,7 +3,6 @@ describe("Page /blog/[slug]", () => {
cy.visit("/blog/hello-world") cy.visit("/blog/hello-world")
cy.get("[data-cy=locale-flag-text]").should("not.exist") cy.get("[data-cy=locale-flag-text]").should("not.exist")
cy.get("main h1").should("have.text", "👋 Hello, world!") cy.get("main h1").should("have.text", "👋 Hello, world!")
cy.get(".prose a:visible").should("have.attr", "target", "_blank")
}) })
it("should redirect to /404 if the blog post doesn't exist", () => { it("should redirect to /404 if the blog post doesn't exist", () => {

15
hooks/useIsMounted.ts Normal file
View File

@ -0,0 +1,15 @@
import { useEffect, useState } from "react"
export interface UseIsMountedResult {
isMounted: boolean
}
export const useIsMounted = (): UseIsMountedResult => {
const [isMounted, setIsMounted] = useState(false)
useEffect(() => {
setIsMounted(true)
}, [])
return { isMounted }
}

View File

@ -25,6 +25,6 @@ const translations = {
export const i18n = new I18n(translations, { export const i18n = new I18n(translations, {
defaultLocale: DEFAULT_LOCALE, defaultLocale: DEFAULT_LOCALE,
availableLocales: LOCALES.slice(), availableLocales: [...LOCALES],
enableFallback: true, enableFallback: true,
}) })

View File

@ -18,7 +18,7 @@
}, },
{ {
"title": "Open-Source Enthusiast", "title": "Open-Source Enthusiast",
"description": "I value the <strong>sharing of knowledge and collaboration</strong> to collectively resolve problems. <br /> The source code of the website is available on <a class='text-yellow dark:text-yellow-dark hover:underline font-semibold' href='https://github.com/theoludwig/theoludwig' target='_blank' rel='noopener noreferrer'>GitHub</a>.", "description": "I value the <strong>sharing of knowledge and collaboration</strong> to collectively resolve problems. <br /> The source code of the website is available on <a class='text-primary dark:text-primary-dark hover:underline font-semibold' href='https://github.com/theoludwig/theoludwig' target='_blank' rel='noopener noreferrer'>GitHub</a>.",
"id": "open-source" "id": "open-source"
} }
] ]

View File

@ -18,7 +18,7 @@
}, },
{ {
"title": "Enthousiaste de l'Open-Source", "title": "Enthousiaste de l'Open-Source",
"description": "J'apprécie le <strong>partage des connaissances et la collaboration</strong> pour résoudre des défis collectivement. <br /> Le code source du site est accessible sur <a class='text-yellow dark:text-yellow-dark hover:underline font-semibold' href='https://github.com/theoludwig/theoludwig' target='_blank' rel='noopener noreferrer'>GitHub</a>.", "description": "J'apprécie le <strong>partage des connaissances et la collaboration</strong> pour résoudre des défis collectivement. <br /> Le code source du site est accessible sur <a class='text-primary dark:text-primary-dark hover:underline font-semibold' href='https://github.com/theoludwig/theoludwig' target='_blank' rel='noopener noreferrer'>GitHub</a>.",
"id": "open-source" "id": "open-source"
} }
] ]

11505
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "theoludwig", "name": "theoludwig",
"version": "3.2.1", "version": "3.3.0",
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
@ -13,7 +13,8 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"start": "next start", "start": "next start",
"build": "npm run curriculum-vitae:build && next build", "build": "npm run build:curriculum-vitae && next build",
"build:curriculum-vitae": "node ./curriculum-vitae/build.js",
"lint:commit": "commitlint", "lint:commit": "commitlint",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint-cli2", "lint:markdown": "markdownlint-cli2",
@ -24,79 +25,74 @@
"test:html-w3c-validator": "start-server-and-test \"start\" \"http://127.0.0.1:3000\" \"html-w3c-validator\"", "test:html-w3c-validator": "start-server-and-test \"start\" \"http://127.0.0.1:3000\" \"html-w3c-validator\"",
"test:e2e": "start-server-and-test \"start\" http://127.0.0.1:3000 \"cypress run\"", "test:e2e": "start-server-and-test \"start\" http://127.0.0.1:3000 \"cypress run\"",
"test:dev": "start-server-and-test \"dev\" \"http://127.0.0.1:3000\" \"cypress open\"", "test:dev": "start-server-and-test \"dev\" \"http://127.0.0.1:3000\" \"cypress open\"",
"curriculum-vitae:build": "node ./curriculum-vitae/build.js",
"release": "semantic-release", "release": "semantic-release",
"postinstall": "husky" "postinstall": "husky"
}, },
"dependencies": { "dependencies": {
"@fontsource/montserrat": "5.0.16", "@fontsource/montserrat": "5.0.18",
"@formatjs/intl-localematcher": "0.5.4", "@formatjs/intl-localematcher": "0.5.4",
"@fortawesome/fontawesome-svg-core": "6.5.1", "@fortawesome/fontawesome-svg-core": "6.5.2",
"@fortawesome/free-brands-svg-icons": "6.5.1", "@fortawesome/free-brands-svg-icons": "6.5.2",
"@fortawesome/free-solid-svg-icons": "6.5.1", "@fortawesome/free-solid-svg-icons": "6.5.2",
"@fortawesome/react-fontawesome": "0.2.0", "@fortawesome/react-fontawesome": "0.2.2",
"@giscus/react": "2.4.0", "@giscus/react": "3.0.0",
"clsx": "2.1.0", "@shikijs/rehype": "1.6.0",
"date-and-time": "3.1.1", "clsx": "2.1.1",
"date-and-time": "3.3.0",
"gray-matter": "4.0.3", "gray-matter": "4.0.3",
"html-react-parser": "5.1.1", "html-react-parser": "5.1.10",
"i18n-js": "4.3.2", "i18n-js": "4.4.3",
"katex": "0.16.9", "katex": "0.16.10",
"negotiator": "0.6.3", "negotiator": "0.6.3",
"next": "14.1.0", "next": "14.1.0",
"next-mdx-remote": "4.4.1", "next-mdx-remote": "5.0.0",
"react": "18.2.0", "react": "18.3.1",
"react-dom": "18.2.0", "react-dom": "18.3.1",
"read-pkg": "9.0.1", "read-pkg": "9.0.1",
"rehype-katex": "6.0.3", "rehype-katex": "7.0.0",
"rehype-raw": "6.1.1", "rehype-raw": "7.0.0",
"rehype-slug": "5.1.0", "rehype-slug": "6.0.0",
"remark-gfm": "3.0.1", "remark-gfm": "4.0.0",
"remark-math": "5.1.1", "remark-math": "6.0.0",
"sharp": "0.33.2", "sharp": "0.33.4",
"shiki": "0.14.7", "shiki": "1.6.0",
"unified": "10.1.2", "universal-cookie": "7.1.4"
"unist-util-visit": "5.0.0",
"universal-cookie": "7.0.2"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "18.6.0", "@commitlint/cli": "19.2.2",
"@commitlint/config-conventional": "18.6.0", "@commitlint/config-conventional": "19.2.2",
"@saithodev/semantic-release-backmerge": "4.0.1", "@saithodev/semantic-release-backmerge": "4.0.1",
"@semantic-release/git": "10.0.1", "@semantic-release/git": "10.0.1",
"@tailwindcss/typography": "0.5.10", "@tailwindcss/typography": "0.5.13",
"@total-typescript/ts-reset": "0.5.1", "@total-typescript/ts-reset": "0.5.1",
"@tsconfig/strictest": "2.0.2", "@tsconfig/strictest": "2.0.5",
"@types/negotiator": "0.6.3", "@types/negotiator": "0.6.3",
"@types/node": "20.11.8", "@types/node": "20.12.12",
"@types/react": "18.2.48", "@types/react": "18.3.2",
"@types/unist": "3.0.2", "@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/eslint-plugin": "6.19.1", "@typescript-eslint/parser": "7.10.0",
"@typescript-eslint/parser": "6.19.1", "autoprefixer": "10.4.19",
"autoprefixer": "10.4.17",
"curriculum-vitae": "file:./curriculum-vitae", "curriculum-vitae": "file:./curriculum-vitae",
"cypress": "13.6.3", "cypress": "13.10.0",
"editorconfig-checker": "5.1.2", "editorconfig-checker": "5.1.5",
"eslint": "8.56.0", "eslint": "8.57.0",
"eslint-config-conventions": "13.1.0", "eslint-config-conventions": "14.2.0",
"eslint-config-next": "14.1.0", "eslint-config-next": "14.1.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-promise": "6.1.1", "eslint-plugin-promise": "6.1.1",
"eslint-plugin-tailwindcss": "3.14.1", "eslint-plugin-tailwindcss": "3.17.0",
"eslint-plugin-unicorn": "50.0.1", "eslint-plugin-unicorn": "53.0.0",
"html-w3c-validator": "1.5.1", "html-w3c-validator": "1.6.2",
"husky": "9.0.6", "husky": "9.0.11",
"lint-staged": "15.2.0", "lint-staged": "15.2.4",
"markdownlint-cli2": "0.12.1", "markdownlint-cli2": "0.13.0",
"markdownlint-rule-relative-links": "2.2.0", "markdownlint-rule-relative-links": "2.3.2",
"postcss": "8.4.33", "postcss": "8.4.38",
"prettier": "3.2.4", "prettier": "3.2.5",
"prettier-plugin-tailwindcss": "0.5.11", "prettier-plugin-tailwindcss": "0.5.14",
"semantic-release": "23.0.0", "semantic-release": "23.1.1",
"start-server-and-test": "2.0.3", "start-server-and-test": "2.0.3",
"tailwindcss": "3.4.1", "tailwindcss": "3.4.3",
"typescript": "5.3.3" "typescript": "5.4.5"
} }
} }

View File

@ -14,7 +14,7 @@ const tailwindConfig = {
DEFAULT: "#333333", DEFAULT: "#333333",
dark: "#b7c0c9", dark: "#b7c0c9",
}, },
yellow: { primary: {
DEFAULT: "#006cff", DEFAULT: "#006cff",
dark: "#00aeff", dark: "#00aeff",
}, },

View File

@ -8,7 +8,7 @@
"allowJs": true, "allowJs": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./*"], "@/*": ["./*"]
}, },
"types": ["@total-typescript/ts-reset", "cypress"], "types": ["@total-typescript/ts-reset", "cypress"],
"noEmit": true, "noEmit": true,
@ -20,10 +20,10 @@
"isolatedModules": true, "isolatedModules": true,
"plugins": [ "plugins": [
{ {
"name": "next", "name": "next"
}, }
], ]
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", ".next"], "exclude": ["node_modules", ".next"]
} }

View File

@ -1,6 +1,6 @@
export const BIRTH_DATE_DAY = "31" as const export const BIRTH_DATE_DAY = "31"
export const BIRTH_DATE_MONTH = "03" as const export const BIRTH_DATE_MONTH = "03"
export const BIRTH_DATE_YEAR = "2003" as const export const BIRTH_DATE_YEAR = "2003"
export const BIRTH_DATE_STRING = export const BIRTH_DATE_STRING =
`${BIRTH_DATE_DAY}/${BIRTH_DATE_MONTH}/${BIRTH_DATE_YEAR}` as const `${BIRTH_DATE_DAY}/${BIRTH_DATE_MONTH}/${BIRTH_DATE_YEAR}` as const
export const BIRTH_DATE_ISO_8601 = export const BIRTH_DATE_ISO_8601 =

8
utils/getVersion.ts Normal file
View File

@ -0,0 +1,8 @@
export const getVersion = async (): Promise<string> => {
if (process.env.NODE_ENV === "development") {
return "0.0.0-development"
}
const { readPackage } = await import("read-pkg")
const { version } = await readPackage()
return version
}