Skip to content

Commit 67896d6

Browse files
committed
feat!: upgrade node v22, next 15.4, ultracite
1 parent 184d1ca commit 67896d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4872
-1026
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@
3838
"files.associations": { "*.css": "tailwindcss" },
3939
"files.exclude": { "specialized": true },
4040
"terminal.integrated.defaultProfile.linux": "zsh",
41-
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
41+
"eslint.validate": [
42+
"javascript",
43+
"javascriptreact",
44+
"typescript",
45+
"typescriptreact"
46+
],
4247
"typescript.tsdk": "homepage/node_modules/typescript/lib",
4348
"typescript.updateImportsOnFileMove.enabled": "always",
4449
"typescript.inlayHints.functionLikeReturnTypes.enabled": true,

.github/copilot-instructions.md

Lines changed: 331 additions & 0 deletions
Large diffs are not rendered by default.

.husky/pre-commit

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
11
pnpm lint-staged
2+
3+
#!/bin/sh
4+
# Exit on any error
5+
set -e
6+
7+
# Check if there are any staged files
8+
if [ -z "$(git diff --cached --name-only)" ]; then
9+
echo "No staged files to format"
10+
exit 0
11+
fi
12+
13+
# Store the hash of staged changes to detect modifications
14+
STAGED_HASH=$(git diff --cached | sha256sum | cut -d' ' -f1)
15+
16+
# Save list of staged files (handling all file states)
17+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
18+
PARTIALLY_STAGED=$(git diff --name-only)
19+
20+
# Stash unstaged changes to preserve working directory
21+
# --keep-index keeps staged changes in working tree
22+
git stash push --quiet --keep-index --message "pre-commit-stash" || true
23+
STASHED=$?
24+
25+
# Run formatter on the staged files
26+
pnpm dlx ultracite fix
27+
FORMAT_EXIT_CODE=$?
28+
29+
# Restore working directory state
30+
if [ $STASHED -eq 0 ]; then
31+
# Re-stage the formatted files
32+
if [ -n "$STAGED_FILES" ]; then
33+
echo "$STAGED_FILES" | while IFS= read -r file; do
34+
if [ -f "$file" ]; then
35+
git add "$file"
36+
fi
37+
done
38+
fi
39+
40+
# Restore unstaged changes
41+
git stash pop --quiet || true
42+
43+
# Restore partial staging if files were partially staged
44+
if [ -n "$PARTIALLY_STAGED" ]; then
45+
for file in $PARTIALLY_STAGED; do
46+
if [ -f "$file" ] && echo "$STAGED_FILES" | grep -q "^$file$"; then
47+
# File was partially staged - need to unstage the unstaged parts
48+
git restore --staged "$file" 2>/dev/null || true
49+
git add -p "$file" < /dev/null 2>/dev/null || git add "$file"
50+
fi
51+
done
52+
fi
53+
else
54+
# No stash was created, just re-add the formatted files
55+
if [ -n "$STAGED_FILES" ]; then
56+
echo "$STAGED_FILES" | while IFS= read -r file; do
57+
if [ -f "$file" ]; then
58+
git add "$file"
59+
fi
60+
done
61+
fi
62+
fi
63+
64+
# Check if staged files actually changed
65+
NEW_STAGED_HASH=$(git diff --cached | sha256sum | cut -d' ' -f1)
66+
if [ "$STAGED_HASH" != "$NEW_STAGED_HASH" ]; then
67+
echo "✨ Files formatted by Ultracite"
68+
fi
69+
70+
exit $FORMAT_EXIT_CODE

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.15.1
1+
v22.20.0

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome"]
3+
}

.vscode/settings.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"[javascript]": {
4+
"editor.defaultFormatter": "biomejs.biome"
5+
},
6+
"[typescript]": {
7+
"editor.defaultFormatter": "biomejs.biome"
8+
},
9+
"[javascriptreact]": {
10+
"editor.defaultFormatter": "biomejs.biome"
11+
},
12+
"[typescriptreact]": {
13+
"editor.defaultFormatter": "biomejs.biome"
14+
},
15+
"[json]": {
16+
"editor.defaultFormatter": "biomejs.biome"
17+
},
18+
"[jsonc]": {
19+
"editor.defaultFormatter": "biomejs.biome"
20+
},
21+
"[css]": {
22+
"editor.defaultFormatter": "biomejs.biome"
23+
},
24+
"[graphql]": {
25+
"editor.defaultFormatter": "biomejs.biome"
26+
},
27+
"typescript.tsdk": "node_modules/typescript/lib",
28+
"editor.formatOnSave": true,
29+
"editor.formatOnPaste": true,
30+
"emmet.showExpandedAbbreviation": "never",
31+
"editor.codeActionsOnSave": {
32+
"source.fixAll.biome": "explicit",
33+
"source.organizeImports.biome": "explicit"
34+
},
35+
"i18n-ally.keystyle": "nested"
36+
}

app/[locale]/(private)/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const Layout = async ({ children }: { children: React.ReactNode }) => {
2-
return <section className='flex h-full justify-center items-center'>{children}</section>;
3-
};
1+
const Layout = async ({ children }: { children: React.ReactNode }) => (
2+
<section className='flex h-full items-center justify-center'>{children}</section>
3+
);
44

55
export default Layout;

app/[locale]/(private)/profile/actions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"use server";
22

3-
import { prisma } from "@/configs/prisma/db";
4-
import { handleErrorServerWithAuth } from "@/utils/handleErrorServer";
53
import { revalidateTag, unstable_cache } from "next/cache";
4+
import { prisma } from "@/configs/prisma/db";
5+
import { handleErrorServerWithAuth } from "@/utils/handle-error-server";
66

77
const getProfile = async () =>
88
handleErrorServerWithAuth({
@@ -15,8 +15,6 @@ const getProfile = async () =>
1515
}
1616
});
1717

18-
console.info("[actions.ts:18] ", "refetch user profile", user?.email);
19-
2018
return {
2119
...user,
2220
nickname: nickname?.content
@@ -30,7 +28,9 @@ const getProfile = async () =>
3028
const updateNickname = async (nickname: string) =>
3129
handleErrorServerWithAuth({
3230
cb: async ({ user }) => {
33-
if (!user) throw new Error("User Not Found!");
31+
if (!user) {
32+
throw new Error("User Not Found!");
33+
}
3434

3535
const existingNickname = await prisma.nickname.findFirst({
3636
where: { content: nickname }

app/[locale]/(private)/profile/dynamic.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
2-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
31
import type { User } from "@supabase/supabase-js";
42
import { getTranslations } from "next-intl/server";
3+
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
4+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
55

66
const Profile = async ({ user }: { user: User }) => {
77
const t = await getTranslations("profile");
88

99
return (
1010
<Card>
1111
<CardHeader>
12-
<CardTitle className='uppercase font-bold text-xl'>{t("title")}</CardTitle>
12+
<CardTitle className='font-bold text-xl uppercase'>{t("title")}</CardTitle>
1313
<CardDescription className='text-muted-foreground'>{t("description")}</CardDescription>
1414
</CardHeader>
1515
<CardContent className='space-y-4'>
1616
<div className='flex items-center space-x-4'>
17-
<Avatar className='w-20 h-20'>
18-
<AvatarImage src={user?.user_metadata.avatar_url} alt={user?.user_metadata.full_name} />
17+
<Avatar className='h-20 w-20'>
18+
<AvatarImage alt={user?.user_metadata.full_name} src={user?.user_metadata.avatar_url} />
1919
<AvatarFallback>{user?.user_metadata.full_name?.charAt(0)}</AvatarFallback>
2020
</Avatar>
2121
<div>
22-
<h2 className='text-2xl font-bold'>{user?.user_metadata.full_name}</h2>
22+
<h2 className='font-bold text-2xl'>{user?.user_metadata.full_name}</h2>
2323
<p className='text-muted-foreground'>{user?.email}</p>
2424
</div>
2525
</div>

app/[locale]/(private)/profile/form.client.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"use client";
22

3-
import { Button } from "@/components/ui/button";
4-
import { Input } from "@/components/ui/input";
5-
import { useHandleError } from "@/hooks/useHandleError";
63
import { useTranslations } from "next-intl";
74
import { useState } from "react";
5+
import { Button } from "@/components/ui/button";
6+
import { Input } from "@/components/ui/input";
7+
import { useHandleError } from "@/hooks/use-handle-error";
88
import { updateNickname } from "./actions";
99

1010
type FormClientType = { nickname: string };
@@ -28,13 +28,13 @@ const FormClient = ({ nickname }: FormClientType) => {
2828
};
2929

3030
return (
31-
<form onSubmit={handleSubmit} className='flex items-center space-x-2'>
31+
<form className='flex items-center space-x-2' onSubmit={handleSubmit}>
3232
<Input
33-
value={value}
34-
onChange={(e) => setValue(e.target.value)}
33+
className='text-center'
3534
name='nickname'
35+
onChange={(e) => setValue(e.target.value)}
3636
placeholder={t("placeholer")}
37-
className='text-center'
37+
value={value}
3838
/>
3939
<Button type='submit'>{t("submit")}</Button>
4040
</form>

0 commit comments

Comments
 (0)