-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·84 lines (70 loc) · 2.78 KB
/
init.sh
File metadata and controls
executable file
·84 lines (70 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# IndieHackerStack - Minimal SaaS Bootstrap
# Powered by Svelte 5, Convex, Better Auth, and Tailwind v4
# --- PRE-FLIGHT ---
dependencies=("bun" "git")
for dep in "${dependencies[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo "❌ Missing: $dep. Install it first!"
exit 1
fi
done
PROJECT_NAME=$1
if [ -z "$PROJECT_NAME" ]; then
echo "Usage: ./init.sh <project-name>"
exit 1
fi
# Get the directory where init.sh is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CURRENT_DIR="$(pwd)"
# If we are running from inside the IndieHackerStack folder,
# create the project in the parent directory to avoid nesting.
if [ "$SCRIPT_DIR" == "$CURRENT_DIR" ]; then
PROJECT_PATH="../$PROJECT_NAME"
else
PROJECT_PATH="$PROJECT_NAME"
fi
# --- 1. SCAFFOLD ---
echo "🚀 Creating SvelteKit app (Svelte 5 + TS) in $PROJECT_PATH..."
bunx sv create "$PROJECT_PATH" --template minimal --types ts --no-install --no-add-ons
cd "$PROJECT_PATH" || exit
# --- 2. INSTALL STACK ---
echo "📦 Installing core dependencies..."
bun install
bun add convex convex-svelte better-auth autumn-js @useautumn/convex @convex-dev/better-auth @mmailaender/convex-better-auth-svelte zod
bun add -D @tailwindcss/vite tailwindcss @biomejs/biome concurrently lucide-svelte bits-ui clsx tailwind-merge tailwind-variants svelte-sonner vaul-svelte tw-animate-css @sveltejs/adapter-vercel
# --- 3. APPLY TEMPLATES ---
echo "📂 Copying templates from $SCRIPT_DIR/templates..."
cp -rv "$SCRIPT_DIR"/templates/* .
cp "$SCRIPT_DIR"/templates/.env.example .env
# Also copy documentation if it exists outside templates
if [ -d "$SCRIPT_DIR/docs" ]; then
echo "📄 Copying documentation..."
cp -rv "$SCRIPT_DIR/docs" .
fi
# --- 4. FINALIZE CONFIGURATION ---
echo "⚙️ Finalizing configuration..."
# Update package.json scripts
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.scripts.dev = \"concurrently \\\"bun --bun x convex dev\\\" \\\"vite dev\\\"\";
pkg.scripts.lint = \"biome check --write .\";
pkg.scripts.format = \"biome format --write .\";
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
# --- 5. INITIALIZE CONVEX ---
echo "☁️ Creating convex.json..."
echo '{ "functions": "src/convex" }' > convex.json
# --- 6. SHADCN SETUP (Instructional) ---
echo "🎨 Initializing Shadcn UI (bits-ui foundation)..."
# We've already added the dependencies and components.json.
echo "------------------------------------------------"
echo "✅ Project $PROJECT_NAME is ready!"
echo ""
echo "Next steps:"
echo " 1. cd $PROJECT_NAME"
echo " 2. Create a Convex project: bunx convex dev"
echo " 3. Fill out your .env file"
echo " 4. Start coding: bun dev"
echo "------------------------------------------------"