create-croissant 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.husky/pre-commit +4 -0
- package/template/.husky/pre-push +11 -0
- package/template/apps/web/src/components/app-sidebar.tsx +4 -8
- package/template/apps/web/src/lib/auth-client.ts +1 -1
- package/template/package.json +4 -1
- package/template/apps/web/src/hooks/use-mobile.ts +0 -19
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
# Get the name of the branch being pushed
|
|
5
|
+
branch=$(git rev-parse --abbrev-ref HEAD)
|
|
6
|
+
|
|
7
|
+
# Only run if pushing to main
|
|
8
|
+
if [ "$branch" = "main" ]; then
|
|
9
|
+
echo "Pushing to main branch, running CI checks..."
|
|
10
|
+
npm run ci
|
|
11
|
+
fi
|
|
@@ -50,15 +50,11 @@ const data = {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
53
|
-
const
|
|
53
|
+
const {
|
|
54
|
+
data: session,
|
|
55
|
+
} = authClient.useSession()
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
const checkSession = async () => {
|
|
57
|
-
const { data: sessionData } = await authClient.getSession()
|
|
58
|
-
setUser(sessionData?.user || null)
|
|
59
|
-
}
|
|
60
|
-
checkSession()
|
|
61
|
-
}, [])
|
|
57
|
+
const user = session?.user || null
|
|
62
58
|
|
|
63
59
|
return (
|
|
64
60
|
<Sidebar {...props}>
|
package/template/package.json
CHANGED
|
@@ -8,15 +8,18 @@
|
|
|
8
8
|
"lint": "turbo lint",
|
|
9
9
|
"format": "turbo format",
|
|
10
10
|
"typecheck": "turbo typecheck",
|
|
11
|
+
"ci": "npm run lint && npm run typecheck && npm run build",
|
|
11
12
|
"db:up": "docker compose up -d",
|
|
12
13
|
"db:down": "docker compose down",
|
|
13
14
|
"db:logs": "docker compose logs -f",
|
|
14
|
-
"update-deps": "npx npm-check-updates -u -w --root && npm install"
|
|
15
|
+
"update-deps": "npx npm-check-updates -u -w --root && npm install",
|
|
16
|
+
"prepare": "husky"
|
|
15
17
|
},
|
|
16
18
|
"devDependencies": {
|
|
17
19
|
"@better-auth/core": "^1.6.7",
|
|
18
20
|
"@tanstack/eslint-config": "0.4.0",
|
|
19
21
|
"eslint": "10.2.1",
|
|
22
|
+
"husky": "^9.1.7",
|
|
20
23
|
"prettier": "^3.8.1",
|
|
21
24
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
22
25
|
"turbo": "^2.8.17",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
const MOBILE_BREAKPOINT = 768
|
|
4
|
-
|
|
5
|
-
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
|
-
|
|
8
|
-
React.useEffect(() => {
|
|
9
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
-
const onChange = () => {
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
-
}
|
|
13
|
-
mql.addEventListener("change", onChange)
|
|
14
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
-
return () => mql.removeEventListener("change", onChange)
|
|
16
|
-
}, [])
|
|
17
|
-
|
|
18
|
-
return !!isMobile
|
|
19
|
-
}
|