| #!/bin/bash |
|
|
| |
| |
|
|
| echo "π¦ Setting up template repositories..." |
|
|
| |
| declare -A templates=( |
| ["devforge"]="../devtool" |
| ["mobilefirst"]="../mobile" |
| ["saasify"]="../saas" |
| ["startupkit"]="../startup" |
| ["analyticsdash"]="../analytics" |
| ["blog"]="../blog" |
| ["changelog"]="../changelog" |
| ["portfolio"]="../portfolio" |
| ) |
|
|
| |
| mkdir -p templates-repos |
|
|
| |
| for template in "${!templates[@]}"; do |
| src="${templates[$template]}" |
| dest="templates-repos/$template" |
|
|
| echo "π Setting up $template..." |
|
|
| if [ -d "$src" ]; then |
| |
| if [ ! -d "$dest" ]; then |
| echo " Copying from $src to $dest..." |
| cp -r "$src" "$dest" |
|
|
| |
| cd "$dest" |
| git init |
| echo "# $template Template" > README.md |
| echo "" >> README.md |
| echo "A Hanzo template for building modern applications." >> README.md |
| echo "" >> README.md |
| echo "## Installation" >> README.md |
| echo '```bash' >> README.md |
| echo "npx create-hanzo-app --template $template" >> README.md |
| echo '```' >> README.md |
|
|
| |
| cat > .gitignore << EOF |
| node_modules |
| .next |
| .env.local |
| .DS_Store |
| *.log |
| dist |
| build |
| EOF |
|
|
| git add . |
| git commit -m "Initial commit for $template template" |
| cd ../.. |
| else |
| echo " β $template already exists" |
| fi |
| else |
| echo " β οΈ Source $src not found, creating placeholder..." |
| mkdir -p "$dest" |
| cd "$dest" |
|
|
| |
| cat > package.json << EOF |
| { |
| "name": "@hanzo/template-$template", |
| "version": "1.0.0", |
| "description": "Hanzo $template template", |
| "scripts": { |
| "dev": "next dev", |
| "build": "next build", |
| "start": "next start" |
| }, |
| "dependencies": { |
| "next": "^15.3.5", |
| "react": "^19.0.0", |
| "react-dom": "^19.0.0", |
| "@hanzo/ui": "latest" |
| } |
| } |
| EOF |
|
|
| |
| mkdir -p app |
| cat > app/page.tsx << EOF |
| export default function HomePage() { |
| return ( |
| <div className="min-h-screen flex items-center justify-center"> |
| <h1 className="text-4xl font-bold">$template Template</h1> |
| </div> |
| ) |
| } |
| EOF |
|
|
| git init |
| git add . |
| git commit -m "Initial placeholder for $template template" |
| cd ../.. |
| fi |
| done |
|
|
| |
| echo "π Setting up new AI templates..." |
|
|
| |
| if [ ! -d "templates-repos/ai-chat" ]; then |
| echo " Creating AI Chat template..." |
| cp -r "../ai-chat-interface" "templates-repos/ai-chat" 2>/dev/null || mkdir -p "templates-repos/ai-chat" |
| fi |
|
|
| |
| if [ ! -d "templates-repos/search" ]; then |
| echo " Creating Search template..." |
| mkdir -p "templates-repos/search" |
| fi |
|
|
| |
| if [ ! -d "templates-repos/ecommerce" ]; then |
| echo " Creating E-commerce template..." |
| cp -r "../ecommerce-storefront" "templates-repos/ecommerce" 2>/dev/null || mkdir -p "templates-repos/ecommerce" |
| fi |
|
|
| |
| if [ ! -d "templates-repos/api-docs" ]; then |
| echo " Creating API Docs template..." |
| mkdir -p "templates-repos/api-docs" |
| fi |
|
|
| echo "" |
| echo "β
Template repositories setup complete!" |
| echo "" |
| echo "π Next steps:" |
| echo "1. Push each template to Hugging Face Spaces:" |
| echo " ./push-to-huggingface.sh" |
| echo "" |
| echo "2. Or manually push individual templates:" |
| echo " cd templates-repos/[template-name]" |
| echo " git remote add hf https://huggingface.co/spaces/hanzo-community/template-[name]" |
| echo " git push hf main" |
| echo "" |
| echo "3. Add as submodules to gallery:" |
| echo " git submodule add https://huggingface.co/spaces/hanzo-community/template-[name] templates-repos/[name]" |
| echo "" |
| echo "4. Gallery will automatically load from templates-repos/" |