Hanzo Dev commited on
Commit ·
366fe97
1
Parent(s): dca4444
Add git submodule architecture for templates with Hugging Face integration
Browse files- .gitmodules +36 -0
- app/api/download/[template]/route.ts +2 -2
- app/template/[id]/page.tsx +5 -15
- build-templates.sh +71 -0
- create-hf-spaces.sh +49 -0
- create-huggingface-spaces.sh +48 -0
- fix-docker-simple.sh +70 -0
- fix-docker-startup.sh +76 -0
- fix-permissions.sh +56 -0
- fix-readme-metadata.sh +84 -0
- fix-start-scripts.sh +46 -0
- fix-templates-minimal.sh +211 -0
- package.json +5 -1
- push-to-huggingface.sh +171 -0
- setup-template-repos.sh +151 -0
- simplify-all-docker.sh +55 -0
- templates-repos/ai-chat +1 -0
- templates-repos/analyticsdash +1 -0
- templates-repos/api-docs +1 -0
- templates-repos/blog +1 -0
- templates-repos/changelog +1 -0
- templates-repos/devforge +1 -0
- templates-repos/ecommerce +1 -0
- templates-repos/fix-dependencies.sh +102 -0
- templates-repos/fix-infinite-loop.sh +62 -0
- templates-repos/mobilefirst +1 -0
- templates-repos/saasify +1 -0
- templates-repos/search +1 -0
- templates-repos/startupkit +1 -0
.gitmodules
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[submodule "templates-repos/devforge"]
|
| 2 |
+
path = templates-repos/devforge
|
| 3 |
+
url = https://huggingface.co/spaces/hanzo-community/devforge
|
| 4 |
+
[submodule "templates-repos/mobilefirst"]
|
| 5 |
+
path = templates-repos/mobilefirst
|
| 6 |
+
url = https://huggingface.co/spaces/hanzo-community/mobilefirst
|
| 7 |
+
[submodule "templates-repos/saasify"]
|
| 8 |
+
path = templates-repos/saasify
|
| 9 |
+
url = https://huggingface.co/spaces/hanzo-community/saasify
|
| 10 |
+
[submodule "templates-repos/startupkit"]
|
| 11 |
+
path = templates-repos/startupkit
|
| 12 |
+
url = https://huggingface.co/spaces/hanzo-community/startupkit
|
| 13 |
+
[submodule "templates-repos/analyticsdash"]
|
| 14 |
+
path = templates-repos/analyticsdash
|
| 15 |
+
url = https://huggingface.co/spaces/hanzo-community/analyticsdash
|
| 16 |
+
[submodule "templates-repos/blog"]
|
| 17 |
+
path = templates-repos/blog
|
| 18 |
+
url = https://huggingface.co/spaces/hanzo-community/blog
|
| 19 |
+
[submodule "templates-repos/changelog"]
|
| 20 |
+
path = templates-repos/changelog
|
| 21 |
+
url = https://huggingface.co/spaces/hanzo-community/changelog
|
| 22 |
+
[submodule "templates-repos/portfolio"]
|
| 23 |
+
path = templates-repos/portfolio
|
| 24 |
+
url = https://huggingface.co/spaces/hanzo-community/portfolio
|
| 25 |
+
[submodule "templates-repos/ai-chat"]
|
| 26 |
+
path = templates-repos/ai-chat
|
| 27 |
+
url = https://huggingface.co/spaces/hanzo-community/ai-chat
|
| 28 |
+
[submodule "templates-repos/search"]
|
| 29 |
+
path = templates-repos/search
|
| 30 |
+
url = https://huggingface.co/spaces/hanzo-community/search
|
| 31 |
+
[submodule "templates-repos/ecommerce"]
|
| 32 |
+
path = templates-repos/ecommerce
|
| 33 |
+
url = https://huggingface.co/spaces/hanzo-community/ecommerce
|
| 34 |
+
[submodule "templates-repos/api-docs"]
|
| 35 |
+
path = templates-repos/api-docs
|
| 36 |
+
url = https://huggingface.co/spaces/hanzo-community/api-docs
|
app/api/download/[template]/route.ts
CHANGED
|
@@ -20,8 +20,8 @@ export async function GET(
|
|
| 20 |
)
|
| 21 |
}
|
| 22 |
|
| 23 |
-
// Path to the template directory
|
| 24 |
-
const templatePath = join(process.cwd(), '
|
| 25 |
|
| 26 |
// Check if the template directory exists
|
| 27 |
if (!existsSync(templatePath)) {
|
|
|
|
| 20 |
)
|
| 21 |
}
|
| 22 |
|
| 23 |
+
// Path to the template directory - now using templates-repos for submodules
|
| 24 |
+
const templatePath = join(process.cwd(), 'templates-repos', template.templatePath || template.id)
|
| 25 |
|
| 26 |
// Check if the template directory exists
|
| 27 |
if (!existsSync(templatePath)) {
|
app/template/[id]/page.tsx
CHANGED
|
@@ -292,21 +292,11 @@ export default function TemplatePage() {
|
|
| 292 |
</div>
|
| 293 |
</CardHeader>
|
| 294 |
<CardContent className="p-0">
|
| 295 |
-
<div className={`bg-muted/10 ${isFullscreen ? 'min-h-screen' : getViewportHeight()}
|
| 296 |
-
<div className={`${getViewportWidth()} mx-auto bg-
|
| 297 |
-
{/* Template Preview
|
| 298 |
-
<div className="relative h-full min-h-[
|
| 299 |
-
<
|
| 300 |
-
<span className="text-8xl opacity-10 mb-4 block">{template.icon}</span>
|
| 301 |
-
<h2 className="text-xl sm:text-2xl font-bold mb-2">{template.name}</h2>
|
| 302 |
-
<p className="text-sm sm:text-base text-muted-foreground mb-4">{template.description}</p>
|
| 303 |
-
<Button variant="outline" asChild className="text-sm">
|
| 304 |
-
<a href={template.demoUrl || '#'} target="_blank" rel="noopener noreferrer">
|
| 305 |
-
<ExternalLink className="w-4 h-4 mr-2" />
|
| 306 |
-
Open Live Demo
|
| 307 |
-
</a>
|
| 308 |
-
</Button>
|
| 309 |
-
</div>
|
| 310 |
</div>
|
| 311 |
</div>
|
| 312 |
</div>
|
|
|
|
| 292 |
</div>
|
| 293 |
</CardHeader>
|
| 294 |
<CardContent className="p-0">
|
| 295 |
+
<div className={`bg-muted/10 ${isFullscreen ? 'min-h-screen' : getViewportHeight()} overflow-auto`}>
|
| 296 |
+
<div className={`${getViewportWidth()} mx-auto bg-background border border-border rounded-lg overflow-hidden shadow-xl`}>
|
| 297 |
+
{/* Template Preview - Render actual component */}
|
| 298 |
+
<div className="relative h-full min-h-[600px]">
|
| 299 |
+
<TemplateComponent />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
</div>
|
| 301 |
</div>
|
| 302 |
</div>
|
build-templates.sh
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Build script for template submodules
|
| 4 |
+
# This script builds all templates and prepares them for the gallery
|
| 5 |
+
|
| 6 |
+
echo "🏗️ Building all template submodules..."
|
| 7 |
+
|
| 8 |
+
# Check if templates-repos exists
|
| 9 |
+
if [ ! -d "templates-repos" ]; then
|
| 10 |
+
echo "⚠️ templates-repos directory not found. Creating it..."
|
| 11 |
+
mkdir -p templates-repos
|
| 12 |
+
fi
|
| 13 |
+
|
| 14 |
+
# Function to setup and build a template
|
| 15 |
+
build_template() {
|
| 16 |
+
local name=$1
|
| 17 |
+
local dir="templates-repos/$name"
|
| 18 |
+
|
| 19 |
+
echo "📦 Building $name..."
|
| 20 |
+
|
| 21 |
+
if [ -d "$dir" ]; then
|
| 22 |
+
cd "$dir"
|
| 23 |
+
|
| 24 |
+
# Check if package.json exists
|
| 25 |
+
if [ -f "package.json" ]; then
|
| 26 |
+
# Install dependencies if node_modules doesn't exist
|
| 27 |
+
if [ ! -d "node_modules" ]; then
|
| 28 |
+
echo " Installing dependencies..."
|
| 29 |
+
npm install --silent
|
| 30 |
+
fi
|
| 31 |
+
|
| 32 |
+
# Run build if build script exists
|
| 33 |
+
if grep -q '"build"' package.json; then
|
| 34 |
+
echo " Building..."
|
| 35 |
+
npm run build --silent 2>/dev/null || echo " Build not required"
|
| 36 |
+
fi
|
| 37 |
+
else
|
| 38 |
+
echo " No package.json found, skipping..."
|
| 39 |
+
fi
|
| 40 |
+
|
| 41 |
+
cd ../..
|
| 42 |
+
else
|
| 43 |
+
echo " ⚠️ Directory $dir not found"
|
| 44 |
+
fi
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
# List of templates to build
|
| 48 |
+
templates=(
|
| 49 |
+
"devforge"
|
| 50 |
+
"mobilefirst"
|
| 51 |
+
"saasify"
|
| 52 |
+
"startupkit"
|
| 53 |
+
"analyticsdash"
|
| 54 |
+
"blog"
|
| 55 |
+
"changelog"
|
| 56 |
+
"portfolio"
|
| 57 |
+
"ai-chat"
|
| 58 |
+
"search"
|
| 59 |
+
"ecommerce"
|
| 60 |
+
"api-docs"
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
# Build each template
|
| 64 |
+
for template in "${templates[@]}"; do
|
| 65 |
+
build_template "$template"
|
| 66 |
+
done
|
| 67 |
+
|
| 68 |
+
echo ""
|
| 69 |
+
echo "✅ All templates built successfully!"
|
| 70 |
+
echo ""
|
| 71 |
+
echo "📝 Templates are ready to be loaded from templates-repos/"
|
create-hf-spaces.sh
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Create Hugging Face Spaces for all templates using Python API
|
| 4 |
+
# Prerequisites:
|
| 5 |
+
# - huggingface-hub python package installed
|
| 6 |
+
# - Logged in to Hugging Face CLI
|
| 7 |
+
|
| 8 |
+
echo "🤗 Creating Hugging Face Spaces for templates..."
|
| 9 |
+
|
| 10 |
+
python3 << 'PYTHON_SCRIPT'
|
| 11 |
+
from huggingface_hub import HfApi
|
| 12 |
+
import sys
|
| 13 |
+
|
| 14 |
+
api = HfApi()
|
| 15 |
+
|
| 16 |
+
templates = [
|
| 17 |
+
"devforge",
|
| 18 |
+
"mobilefirst",
|
| 19 |
+
"saasify",
|
| 20 |
+
"startupkit",
|
| 21 |
+
"analyticsdash",
|
| 22 |
+
"blog",
|
| 23 |
+
"changelog",
|
| 24 |
+
"portfolio",
|
| 25 |
+
"ai-chat",
|
| 26 |
+
"search",
|
| 27 |
+
"ecommerce",
|
| 28 |
+
"api-docs"
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
for template in templates:
|
| 32 |
+
repo_id = f"Hanzo-Community/{template}"
|
| 33 |
+
print(f"📦 Creating space: {repo_id}...")
|
| 34 |
+
|
| 35 |
+
try:
|
| 36 |
+
# Create the space
|
| 37 |
+
api.create_repo(
|
| 38 |
+
repo_id=repo_id,
|
| 39 |
+
repo_type="space",
|
| 40 |
+
space_sdk="docker",
|
| 41 |
+
private=False,
|
| 42 |
+
exist_ok=True
|
| 43 |
+
)
|
| 44 |
+
print(f" ✅ Created or already exists: {repo_id}")
|
| 45 |
+
except Exception as e:
|
| 46 |
+
print(f" ⚠️ Error creating {repo_id}: {str(e)}")
|
| 47 |
+
|
| 48 |
+
print("\n✅ Done! Now you can run ./push-to-huggingface.sh to push templates")
|
| 49 |
+
PYTHON_SCRIPT
|
create-huggingface-spaces.sh
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Create Hugging Face Spaces for all templates
|
| 4 |
+
# Prerequisites:
|
| 5 |
+
# - huggingface-cli installed and logged in
|
| 6 |
+
|
| 7 |
+
echo "🤗 Creating Hugging Face Spaces for templates..."
|
| 8 |
+
echo ""
|
| 9 |
+
echo "Note: You need to be logged in to Hugging Face CLI"
|
| 10 |
+
echo "Run: huggingface-cli login"
|
| 11 |
+
echo ""
|
| 12 |
+
|
| 13 |
+
# List of templates
|
| 14 |
+
templates=(
|
| 15 |
+
"devforge"
|
| 16 |
+
"mobilefirst"
|
| 17 |
+
"saasify"
|
| 18 |
+
"startupkit"
|
| 19 |
+
"analyticsdash"
|
| 20 |
+
"blog"
|
| 21 |
+
"changelog"
|
| 22 |
+
"portfolio"
|
| 23 |
+
"ai-chat"
|
| 24 |
+
"search"
|
| 25 |
+
"ecommerce"
|
| 26 |
+
"api-docs"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
# Create spaces
|
| 30 |
+
for template in "${templates[@]}"; do
|
| 31 |
+
echo "📦 Creating space: hanzo-community/$template..."
|
| 32 |
+
|
| 33 |
+
# Create the space using huggingface-cli
|
| 34 |
+
huggingface-cli repo create "hanzo-community/$template" \
|
| 35 |
+
--type space \
|
| 36 |
+
--space-sdk docker \
|
| 37 |
+
--private false \
|
| 38 |
+
2>/dev/null
|
| 39 |
+
|
| 40 |
+
if [ $? -eq 0 ]; then
|
| 41 |
+
echo " ✅ Created successfully!"
|
| 42 |
+
else
|
| 43 |
+
echo " ⚠️ Space may already exist or creation failed"
|
| 44 |
+
fi
|
| 45 |
+
done
|
| 46 |
+
|
| 47 |
+
echo ""
|
| 48 |
+
echo "✅ Done! Now you can run ./push-to-huggingface.sh to push templates"
|
fix-docker-simple.sh
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Fix Docker with simpler startup
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"devforge"
|
| 7 |
+
"mobilefirst"
|
| 8 |
+
"saasify"
|
| 9 |
+
"startupkit"
|
| 10 |
+
"analyticsdash"
|
| 11 |
+
"blog"
|
| 12 |
+
"changelog"
|
| 13 |
+
"ai-chat"
|
| 14 |
+
"search"
|
| 15 |
+
"ecommerce"
|
| 16 |
+
"api-docs"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
for template in "${templates[@]}"; do
|
| 20 |
+
dir="templates-repos/$template"
|
| 21 |
+
|
| 22 |
+
if [ -d "$dir" ]; then
|
| 23 |
+
echo "📦 Fixing $template Docker..."
|
| 24 |
+
cd "$dir"
|
| 25 |
+
|
| 26 |
+
# Create simpler Dockerfile
|
| 27 |
+
cat > Dockerfile << 'EOF'
|
| 28 |
+
FROM node:20-slim
|
| 29 |
+
|
| 30 |
+
WORKDIR /app
|
| 31 |
+
|
| 32 |
+
# Copy everything
|
| 33 |
+
COPY . .
|
| 34 |
+
|
| 35 |
+
# Install dependencies
|
| 36 |
+
RUN npm ci --legacy-peer-deps
|
| 37 |
+
|
| 38 |
+
# Build the app
|
| 39 |
+
RUN npm run build
|
| 40 |
+
|
| 41 |
+
# Expose port
|
| 42 |
+
EXPOSE 3000
|
| 43 |
+
|
| 44 |
+
# Start with npm start
|
| 45 |
+
CMD ["npm", "start"]
|
| 46 |
+
EOF
|
| 47 |
+
|
| 48 |
+
# Ensure package.json has proper start script
|
| 49 |
+
if ! grep -q '"start":' package.json; then
|
| 50 |
+
# Update package.json to add start script
|
| 51 |
+
sed -i '' 's/"scripts": {/"scripts": {\n "start": "next start -H 0.0.0.0 -p 3000",/' package.json
|
| 52 |
+
fi
|
| 53 |
+
|
| 54 |
+
# Remove standalone config from next.config.js
|
| 55 |
+
if [ -f next.config.js ]; then
|
| 56 |
+
sed -i '' "/output: 'standalone'/d" next.config.js
|
| 57 |
+
fi
|
| 58 |
+
|
| 59 |
+
# Commit and push
|
| 60 |
+
git add -A
|
| 61 |
+
git commit -m "Simplify Docker startup" 2>/dev/null || true
|
| 62 |
+
git push hf main --force
|
| 63 |
+
|
| 64 |
+
cd ../..
|
| 65 |
+
echo " ✅ Fixed $template"
|
| 66 |
+
fi
|
| 67 |
+
done
|
| 68 |
+
|
| 69 |
+
echo ""
|
| 70 |
+
echo "✅ All templates fixed with simple Docker!"
|
fix-docker-startup.sh
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Fix Docker startup for all templates - make them start faster
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"devforge"
|
| 7 |
+
"mobilefirst"
|
| 8 |
+
"saasify"
|
| 9 |
+
"startupkit"
|
| 10 |
+
"analyticsdash"
|
| 11 |
+
"blog"
|
| 12 |
+
"changelog"
|
| 13 |
+
"ai-chat"
|
| 14 |
+
"search"
|
| 15 |
+
"ecommerce"
|
| 16 |
+
"api-docs"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
for template in "${templates[@]}"; do
|
| 20 |
+
dir="templates-repos/$template"
|
| 21 |
+
|
| 22 |
+
if [ -d "$dir" ]; then
|
| 23 |
+
echo "📦 Fixing $template Docker..."
|
| 24 |
+
cd "$dir"
|
| 25 |
+
|
| 26 |
+
# Create optimized Dockerfile
|
| 27 |
+
cat > Dockerfile << 'EOF'
|
| 28 |
+
FROM node:20-slim
|
| 29 |
+
|
| 30 |
+
WORKDIR /app
|
| 31 |
+
|
| 32 |
+
# Copy only package files first for better caching
|
| 33 |
+
COPY package*.json ./
|
| 34 |
+
|
| 35 |
+
# Install dependencies with legacy peer deps
|
| 36 |
+
RUN npm ci --legacy-peer-deps
|
| 37 |
+
|
| 38 |
+
# Copy the rest of the application
|
| 39 |
+
COPY . .
|
| 40 |
+
|
| 41 |
+
# Build the Next.js app
|
| 42 |
+
RUN npm run build
|
| 43 |
+
|
| 44 |
+
# Expose the port
|
| 45 |
+
EXPOSE 3000
|
| 46 |
+
|
| 47 |
+
# Use Node directly to avoid npm overhead
|
| 48 |
+
CMD ["node", ".next/standalone/server.js"]
|
| 49 |
+
EOF
|
| 50 |
+
|
| 51 |
+
# Update next.config.js to enable standalone build
|
| 52 |
+
if ! grep -q "output: 'standalone'" next.config.js 2>/dev/null; then
|
| 53 |
+
cat > next.config.js << 'EOF'
|
| 54 |
+
/** @type {import('next').NextConfig} */
|
| 55 |
+
const nextConfig = {
|
| 56 |
+
output: 'standalone',
|
| 57 |
+
reactStrictMode: true,
|
| 58 |
+
swcMinify: true,
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
module.exports = nextConfig
|
| 62 |
+
EOF
|
| 63 |
+
fi
|
| 64 |
+
|
| 65 |
+
# Commit and push
|
| 66 |
+
git add Dockerfile next.config.js
|
| 67 |
+
git commit -m "Optimize Docker for faster startup" 2>/dev/null || true
|
| 68 |
+
git push hf main --force
|
| 69 |
+
|
| 70 |
+
cd ../..
|
| 71 |
+
echo " ✅ Fixed $template"
|
| 72 |
+
fi
|
| 73 |
+
done
|
| 74 |
+
|
| 75 |
+
echo ""
|
| 76 |
+
echo "✅ All Dockerfiles optimized!"
|
fix-permissions.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Fix permission issues in Docker
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"search"
|
| 7 |
+
"api-docs"
|
| 8 |
+
"changelog"
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
for template in "${templates[@]}"; do
|
| 12 |
+
dir="templates-repos/$template"
|
| 13 |
+
|
| 14 |
+
if [ -d "$dir" ]; then
|
| 15 |
+
echo "📦 Fixing $template permissions..."
|
| 16 |
+
cd "$dir"
|
| 17 |
+
|
| 18 |
+
# Create Dockerfile with proper permissions
|
| 19 |
+
cat > Dockerfile << 'EOF'
|
| 20 |
+
FROM node:20-slim
|
| 21 |
+
|
| 22 |
+
WORKDIR /app
|
| 23 |
+
|
| 24 |
+
# Copy and install dependencies first
|
| 25 |
+
COPY package*.json ./
|
| 26 |
+
RUN npm install --legacy-peer-deps
|
| 27 |
+
|
| 28 |
+
# Copy the rest of the app
|
| 29 |
+
COPY . .
|
| 30 |
+
|
| 31 |
+
# Create .next directory with proper permissions
|
| 32 |
+
RUN mkdir -p .next && chmod -R 777 .next
|
| 33 |
+
|
| 34 |
+
# Ensure node user owns the app
|
| 35 |
+
RUN chown -R node:node /app
|
| 36 |
+
|
| 37 |
+
# Switch to node user
|
| 38 |
+
USER node
|
| 39 |
+
|
| 40 |
+
EXPOSE 3000
|
| 41 |
+
|
| 42 |
+
CMD ["npm", "run", "dev"]
|
| 43 |
+
EOF
|
| 44 |
+
|
| 45 |
+
# Commit and push
|
| 46 |
+
git add Dockerfile
|
| 47 |
+
git commit -m "Fix Docker permissions" 2>/dev/null || true
|
| 48 |
+
git push hf main --force
|
| 49 |
+
|
| 50 |
+
cd ../..
|
| 51 |
+
echo " ✅ Fixed $template"
|
| 52 |
+
fi
|
| 53 |
+
done
|
| 54 |
+
|
| 55 |
+
echo ""
|
| 56 |
+
echo "✅ All permission issues fixed!"
|
fix-readme-metadata.sh
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Fix README metadata for all templates
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"devforge"
|
| 7 |
+
"mobilefirst"
|
| 8 |
+
"saasify"
|
| 9 |
+
"startupkit"
|
| 10 |
+
"analyticsdash"
|
| 11 |
+
"blog"
|
| 12 |
+
"changelog"
|
| 13 |
+
"ai-chat"
|
| 14 |
+
"search"
|
| 15 |
+
"ecommerce"
|
| 16 |
+
"api-docs"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
for template in "${templates[@]}"; do
|
| 20 |
+
dir="templates-repos/$template"
|
| 21 |
+
|
| 22 |
+
if [ -d "$dir" ]; then
|
| 23 |
+
echo "📦 Fixing $template..."
|
| 24 |
+
cd "$dir"
|
| 25 |
+
|
| 26 |
+
# Backup current README
|
| 27 |
+
cp README.md README.bak.md
|
| 28 |
+
|
| 29 |
+
# Create new README with proper frontmatter
|
| 30 |
+
cat > README.md << EOF
|
| 31 |
+
---
|
| 32 |
+
title: $template
|
| 33 |
+
emoji: 🚀
|
| 34 |
+
colorFrom: gray
|
| 35 |
+
colorTo: gray
|
| 36 |
+
sdk: docker
|
| 37 |
+
pinned: false
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
# $template Template
|
| 41 |
+
|
| 42 |
+
A Hanzo template for building modern applications.
|
| 43 |
+
|
| 44 |
+
## Features
|
| 45 |
+
- Built with @hanzo/ui
|
| 46 |
+
- Fully responsive
|
| 47 |
+
- TypeScript support
|
| 48 |
+
- Tailwind CSS styling
|
| 49 |
+
- shadcn/ui components
|
| 50 |
+
|
| 51 |
+
## Installation
|
| 52 |
+
|
| 53 |
+
\`\`\`bash
|
| 54 |
+
npx create-hanzo-app --template $template
|
| 55 |
+
\`\`\`
|
| 56 |
+
|
| 57 |
+
## Development
|
| 58 |
+
|
| 59 |
+
\`\`\`bash
|
| 60 |
+
npm install
|
| 61 |
+
npm run dev
|
| 62 |
+
\`\`\`
|
| 63 |
+
|
| 64 |
+
## Build
|
| 65 |
+
|
| 66 |
+
\`\`\`bash
|
| 67 |
+
npm run build
|
| 68 |
+
\`\`\`
|
| 69 |
+
|
| 70 |
+
Check out the [Hanzo Template Gallery](https://huggingface.co/spaces/hanzoai/gallery) for more templates.
|
| 71 |
+
EOF
|
| 72 |
+
|
| 73 |
+
# Commit and push
|
| 74 |
+
git add README.md
|
| 75 |
+
git commit -m "Add proper YAML frontmatter to README"
|
| 76 |
+
git push origin main --force
|
| 77 |
+
|
| 78 |
+
cd ../..
|
| 79 |
+
echo " ✅ Fixed $template"
|
| 80 |
+
fi
|
| 81 |
+
done
|
| 82 |
+
|
| 83 |
+
echo ""
|
| 84 |
+
echo "✅ All READMEs updated!"
|
fix-start-scripts.sh
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Fix start scripts for all templates
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"devforge"
|
| 7 |
+
"mobilefirst"
|
| 8 |
+
"saasify"
|
| 9 |
+
"startupkit"
|
| 10 |
+
"analyticsdash"
|
| 11 |
+
"blog"
|
| 12 |
+
"changelog"
|
| 13 |
+
"ai-chat"
|
| 14 |
+
"search"
|
| 15 |
+
"ecommerce"
|
| 16 |
+
"api-docs"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
for template in "${templates[@]}"; do
|
| 20 |
+
dir="templates-repos/$template"
|
| 21 |
+
|
| 22 |
+
if [ -d "$dir" ]; then
|
| 23 |
+
echo "📦 Fixing $template start script..."
|
| 24 |
+
cd "$dir"
|
| 25 |
+
|
| 26 |
+
# Update start script in package.json if it exists
|
| 27 |
+
if [ -f package.json ]; then
|
| 28 |
+
# Update start script to bind to all interfaces
|
| 29 |
+
sed -i '' 's/"start": "next start"/"start": "next start -H 0.0.0.0 -p 3000"/' package.json 2>/dev/null || true
|
| 30 |
+
|
| 31 |
+
# Commit and push
|
| 32 |
+
git add package.json
|
| 33 |
+
git commit -m "Fix start script to bind to all interfaces" 2>/dev/null || true
|
| 34 |
+
git push hf main --force
|
| 35 |
+
|
| 36 |
+
echo " ✅ Fixed $template"
|
| 37 |
+
else
|
| 38 |
+
echo " ⚠️ No package.json in $template"
|
| 39 |
+
fi
|
| 40 |
+
|
| 41 |
+
cd ../..
|
| 42 |
+
fi
|
| 43 |
+
done
|
| 44 |
+
|
| 45 |
+
echo ""
|
| 46 |
+
echo "✅ All start scripts fixed!"
|
fix-templates-minimal.sh
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Create minimal working templates that will actually build and run
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"search"
|
| 7 |
+
"api-docs"
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
for template in "${templates[@]}"; do
|
| 11 |
+
dir="templates-repos/$template"
|
| 12 |
+
|
| 13 |
+
if [ -d "$dir" ]; then
|
| 14 |
+
echo "📦 Creating minimal $template..."
|
| 15 |
+
cd "$dir"
|
| 16 |
+
|
| 17 |
+
# Create minimal app directory if missing
|
| 18 |
+
mkdir -p app
|
| 19 |
+
|
| 20 |
+
# Create minimal page.tsx
|
| 21 |
+
cat > app/page.tsx << 'EOF'
|
| 22 |
+
export default function HomePage() {
|
| 23 |
+
return (
|
| 24 |
+
<div style={{
|
| 25 |
+
minHeight: '100vh',
|
| 26 |
+
display: 'flex',
|
| 27 |
+
alignItems: 'center',
|
| 28 |
+
justifyContent: 'center',
|
| 29 |
+
fontFamily: 'system-ui, -apple-system, sans-serif'
|
| 30 |
+
}}>
|
| 31 |
+
<div style={{ textAlign: 'center' }}>
|
| 32 |
+
<h1 style={{ fontSize: '3rem', fontWeight: 'bold', marginBottom: '1rem' }}>
|
| 33 |
+
Template
|
| 34 |
+
</h1>
|
| 35 |
+
<p style={{ fontSize: '1.25rem', color: '#666' }}>
|
| 36 |
+
A Hanzo template for building modern applications
|
| 37 |
+
</p>
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
)
|
| 41 |
+
}
|
| 42 |
+
EOF
|
| 43 |
+
|
| 44 |
+
# Replace Template with actual name
|
| 45 |
+
sed -i '' "s/Template/${template^}/" app/page.tsx 2>/dev/null || true
|
| 46 |
+
|
| 47 |
+
# Create minimal layout.tsx
|
| 48 |
+
cat > app/layout.tsx << 'EOF'
|
| 49 |
+
export default function RootLayout({
|
| 50 |
+
children,
|
| 51 |
+
}: {
|
| 52 |
+
children: React.ReactNode
|
| 53 |
+
}) {
|
| 54 |
+
return (
|
| 55 |
+
<html lang="en">
|
| 56 |
+
<body>{children}</body>
|
| 57 |
+
</html>
|
| 58 |
+
)
|
| 59 |
+
}
|
| 60 |
+
EOF
|
| 61 |
+
|
| 62 |
+
# Create tsconfig.json if missing
|
| 63 |
+
if [ ! -f tsconfig.json ]; then
|
| 64 |
+
cat > tsconfig.json << 'EOF'
|
| 65 |
+
{
|
| 66 |
+
"compilerOptions": {
|
| 67 |
+
"target": "es5",
|
| 68 |
+
"lib": ["dom", "dom.iterable", "esnext"],
|
| 69 |
+
"allowJs": true,
|
| 70 |
+
"skipLibCheck": true,
|
| 71 |
+
"strict": false,
|
| 72 |
+
"forceConsistentCasingInFileNames": true,
|
| 73 |
+
"noEmit": true,
|
| 74 |
+
"esModuleInterop": true,
|
| 75 |
+
"module": "esnext",
|
| 76 |
+
"moduleResolution": "node",
|
| 77 |
+
"resolveJsonModule": true,
|
| 78 |
+
"isolatedModules": true,
|
| 79 |
+
"jsx": "preserve",
|
| 80 |
+
"incremental": true,
|
| 81 |
+
"plugins": [
|
| 82 |
+
{
|
| 83 |
+
"name": "next"
|
| 84 |
+
}
|
| 85 |
+
],
|
| 86 |
+
"paths": {
|
| 87 |
+
"@/*": ["./*"]
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
| 91 |
+
"exclude": ["node_modules"]
|
| 92 |
+
}
|
| 93 |
+
EOF
|
| 94 |
+
fi
|
| 95 |
+
|
| 96 |
+
# Create next.config.js if missing
|
| 97 |
+
if [ ! -f next.config.js ]; then
|
| 98 |
+
cat > next.config.js << 'EOF'
|
| 99 |
+
/** @type {import('next').NextConfig} */
|
| 100 |
+
const nextConfig = {
|
| 101 |
+
reactStrictMode: true,
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
module.exports = nextConfig
|
| 105 |
+
EOF
|
| 106 |
+
fi
|
| 107 |
+
|
| 108 |
+
# Create simpler Dockerfile without build step
|
| 109 |
+
cat > Dockerfile << 'EOF'
|
| 110 |
+
FROM node:20-slim
|
| 111 |
+
|
| 112 |
+
WORKDIR /app
|
| 113 |
+
|
| 114 |
+
# Copy everything
|
| 115 |
+
COPY . .
|
| 116 |
+
|
| 117 |
+
# Install dependencies
|
| 118 |
+
RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
|
| 119 |
+
|
| 120 |
+
# Expose port
|
| 121 |
+
EXPOSE 3000
|
| 122 |
+
|
| 123 |
+
# Start in dev mode for simplicity
|
| 124 |
+
CMD ["npm", "run", "dev"]
|
| 125 |
+
EOF
|
| 126 |
+
|
| 127 |
+
# Update package.json to ensure dev script works
|
| 128 |
+
if [ -f package.json ]; then
|
| 129 |
+
# Ensure dev script binds to all interfaces
|
| 130 |
+
sed -i '' 's/"dev": "next dev"/"dev": "next dev -H 0.0.0.0 -p 3000"/' package.json 2>/dev/null || true
|
| 131 |
+
fi
|
| 132 |
+
|
| 133 |
+
# Commit and push
|
| 134 |
+
git add -A
|
| 135 |
+
git commit -m "Create minimal working template" 2>/dev/null || true
|
| 136 |
+
git push hf main --force
|
| 137 |
+
|
| 138 |
+
cd ../..
|
| 139 |
+
echo " ✅ Fixed $template"
|
| 140 |
+
fi
|
| 141 |
+
done
|
| 142 |
+
|
| 143 |
+
# Also fix changelog which was missing files
|
| 144 |
+
cd templates-repos/changelog
|
| 145 |
+
echo "📦 Fixing changelog..."
|
| 146 |
+
|
| 147 |
+
# Create minimal app files
|
| 148 |
+
mkdir -p app
|
| 149 |
+
cat > app/page.tsx << 'EOF'
|
| 150 |
+
export default function HomePage() {
|
| 151 |
+
return (
|
| 152 |
+
<div style={{
|
| 153 |
+
minHeight: '100vh',
|
| 154 |
+
display: 'flex',
|
| 155 |
+
alignItems: 'center',
|
| 156 |
+
justifyContent: 'center',
|
| 157 |
+
fontFamily: 'system-ui, -apple-system, sans-serif'
|
| 158 |
+
}}>
|
| 159 |
+
<div style={{ textAlign: 'center' }}>
|
| 160 |
+
<h1 style={{ fontSize: '3rem', fontWeight: 'bold', marginBottom: '1rem' }}>
|
| 161 |
+
Changelog
|
| 162 |
+
</h1>
|
| 163 |
+
<p style={{ fontSize: '1.25rem', color: '#666' }}>
|
| 164 |
+
Track your project updates
|
| 165 |
+
</p>
|
| 166 |
+
</div>
|
| 167 |
+
</div>
|
| 168 |
+
)
|
| 169 |
+
}
|
| 170 |
+
EOF
|
| 171 |
+
|
| 172 |
+
cat > app/layout.tsx << 'EOF'
|
| 173 |
+
export default function RootLayout({
|
| 174 |
+
children,
|
| 175 |
+
}: {
|
| 176 |
+
children: React.ReactNode
|
| 177 |
+
}) {
|
| 178 |
+
return (
|
| 179 |
+
<html lang="en">
|
| 180 |
+
<body>{children}</body>
|
| 181 |
+
</html>
|
| 182 |
+
)
|
| 183 |
+
}
|
| 184 |
+
EOF
|
| 185 |
+
|
| 186 |
+
# Simpler Dockerfile
|
| 187 |
+
cat > Dockerfile << 'EOF'
|
| 188 |
+
FROM node:20-slim
|
| 189 |
+
|
| 190 |
+
WORKDIR /app
|
| 191 |
+
|
| 192 |
+
COPY . .
|
| 193 |
+
|
| 194 |
+
RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
|
| 195 |
+
|
| 196 |
+
EXPOSE 3000
|
| 197 |
+
|
| 198 |
+
CMD ["npm", "run", "dev"]
|
| 199 |
+
EOF
|
| 200 |
+
|
| 201 |
+
# Update package.json
|
| 202 |
+
sed -i '' 's/"dev": "next dev"/"dev": "next dev -H 0.0.0.0 -p 3000"/' package.json 2>/dev/null || true
|
| 203 |
+
|
| 204 |
+
git add -A
|
| 205 |
+
git commit -m "Fix changelog with minimal template" 2>/dev/null || true
|
| 206 |
+
git push hf main --force
|
| 207 |
+
|
| 208 |
+
cd ../..
|
| 209 |
+
|
| 210 |
+
echo ""
|
| 211 |
+
echo "✅ Templates fixed with minimal working versions!"
|
package.json
CHANGED
|
@@ -8,7 +8,11 @@
|
|
| 8 |
"start": "next start -H 0.0.0.0 -p ${PORT:-7860}",
|
| 9 |
"lint": "next lint",
|
| 10 |
"screenshot": "node scripts/screenshot-templates.js",
|
| 11 |
-
"screenshot:prod": "SCREENSHOT_BASE_URL=https://huggingface.co/spaces/hanzoai/gallery node scripts/screenshot-templates.js"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
},
|
| 13 |
"dependencies": {
|
| 14 |
"@hanzo/ui": "^4.5.4",
|
|
|
|
| 8 |
"start": "next start -H 0.0.0.0 -p ${PORT:-7860}",
|
| 9 |
"lint": "next lint",
|
| 10 |
"screenshot": "node scripts/screenshot-templates.js",
|
| 11 |
+
"screenshot:prod": "SCREENSHOT_BASE_URL=https://huggingface.co/spaces/hanzoai/gallery node scripts/screenshot-templates.js",
|
| 12 |
+
"setup-templates": "./setup-template-repos.sh",
|
| 13 |
+
"build-templates": "./build-templates.sh",
|
| 14 |
+
"submodules:init": "git submodule update --init --recursive",
|
| 15 |
+
"submodules:update": "git submodule update --remote --merge"
|
| 16 |
},
|
| 17 |
"dependencies": {
|
| 18 |
"@hanzo/ui": "^4.5.4",
|
push-to-huggingface.sh
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Push templates to Hugging Face Spaces under hanzo-community
|
| 4 |
+
# Prerequisites:
|
| 5 |
+
# - Hugging Face CLI installed: pip install huggingface-hub
|
| 6 |
+
# - Logged in: huggingface-cli login
|
| 7 |
+
|
| 8 |
+
echo "🤗 Pushing templates to Hugging Face Spaces (hanzo-community)..."
|
| 9 |
+
|
| 10 |
+
# Function to create and push a template to Hugging Face
|
| 11 |
+
push_template() {
|
| 12 |
+
local name=$1
|
| 13 |
+
local dir="templates-repos/$name"
|
| 14 |
+
|
| 15 |
+
echo "📦 Processing $name..."
|
| 16 |
+
|
| 17 |
+
if [ -d "$dir" ]; then
|
| 18 |
+
cd "$dir"
|
| 19 |
+
|
| 20 |
+
# Add README if it doesn't exist
|
| 21 |
+
if [ ! -f "README.md" ]; then
|
| 22 |
+
cat > README.md << EOF
|
| 23 |
+
---
|
| 24 |
+
title: $name Template
|
| 25 |
+
emoji: 🚀
|
| 26 |
+
colorFrom: gray
|
| 27 |
+
colorTo: gray
|
| 28 |
+
sdk: docker
|
| 29 |
+
app_port: 3000
|
| 30 |
+
pinned: true
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
# $name Template
|
| 34 |
+
|
| 35 |
+
A Hanzo template for building modern applications.
|
| 36 |
+
|
| 37 |
+
## Features
|
| 38 |
+
- Built with @hanzo/ui
|
| 39 |
+
- Fully responsive
|
| 40 |
+
- TypeScript support
|
| 41 |
+
- Tailwind CSS styling
|
| 42 |
+
- shadcn/ui components
|
| 43 |
+
|
| 44 |
+
## Installation
|
| 45 |
+
|
| 46 |
+
\`\`\`bash
|
| 47 |
+
npx create-hanzo-app --template $name
|
| 48 |
+
\`\`\`
|
| 49 |
+
|
| 50 |
+
## Development
|
| 51 |
+
|
| 52 |
+
\`\`\`bash
|
| 53 |
+
npm install
|
| 54 |
+
npm run dev
|
| 55 |
+
\`\`\`
|
| 56 |
+
|
| 57 |
+
## Build
|
| 58 |
+
|
| 59 |
+
\`\`\`bash
|
| 60 |
+
npm run build
|
| 61 |
+
\`\`\`
|
| 62 |
+
|
| 63 |
+
Check out the [Hanzo Template Gallery](https://huggingface.co/spaces/hanzoai/gallery) for more templates.
|
| 64 |
+
EOF
|
| 65 |
+
fi
|
| 66 |
+
|
| 67 |
+
# Add Dockerfile if it doesn't exist
|
| 68 |
+
if [ ! -f "Dockerfile" ]; then
|
| 69 |
+
cat > Dockerfile << 'EOF'
|
| 70 |
+
FROM node:20-slim
|
| 71 |
+
|
| 72 |
+
WORKDIR /app
|
| 73 |
+
|
| 74 |
+
# Copy package files
|
| 75 |
+
COPY package*.json ./
|
| 76 |
+
|
| 77 |
+
# Install dependencies
|
| 78 |
+
RUN npm ci --only=production
|
| 79 |
+
|
| 80 |
+
# Copy application files
|
| 81 |
+
COPY . .
|
| 82 |
+
|
| 83 |
+
# Build the application
|
| 84 |
+
RUN npm run build
|
| 85 |
+
|
| 86 |
+
# Expose port
|
| 87 |
+
EXPOSE 3000
|
| 88 |
+
|
| 89 |
+
# Start the application
|
| 90 |
+
CMD ["npm", "start"]
|
| 91 |
+
EOF
|
| 92 |
+
fi
|
| 93 |
+
|
| 94 |
+
# Initialize git if not already
|
| 95 |
+
if [ ! -d ".git" ]; then
|
| 96 |
+
git init
|
| 97 |
+
|
| 98 |
+
# Add gitignore if missing
|
| 99 |
+
if [ ! -f ".gitignore" ]; then
|
| 100 |
+
cat > .gitignore << 'GITEOF'
|
| 101 |
+
node_modules
|
| 102 |
+
.next
|
| 103 |
+
.cache
|
| 104 |
+
dist
|
| 105 |
+
build
|
| 106 |
+
.DS_Store
|
| 107 |
+
*.log
|
| 108 |
+
.env.local
|
| 109 |
+
.env.*.local
|
| 110 |
+
*.tsbuildinfo
|
| 111 |
+
GITEOF
|
| 112 |
+
fi
|
| 113 |
+
|
| 114 |
+
git add .
|
| 115 |
+
git commit -m "Initial commit for $name template"
|
| 116 |
+
fi
|
| 117 |
+
|
| 118 |
+
# Add Hugging Face remote
|
| 119 |
+
git remote remove hf 2>/dev/null
|
| 120 |
+
git remote add hf https://huggingface.co/spaces/hanzo-community/$name
|
| 121 |
+
|
| 122 |
+
# Push to Hugging Face
|
| 123 |
+
echo " Pushing to Hugging Face..."
|
| 124 |
+
git push hf main --force
|
| 125 |
+
|
| 126 |
+
cd ../..
|
| 127 |
+
echo " ✅ $name pushed successfully!"
|
| 128 |
+
else
|
| 129 |
+
echo " ⚠️ Directory $dir not found"
|
| 130 |
+
fi
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
# List of templates
|
| 134 |
+
templates=(
|
| 135 |
+
"devforge"
|
| 136 |
+
"mobilefirst"
|
| 137 |
+
"saasify"
|
| 138 |
+
"startupkit"
|
| 139 |
+
"analyticsdash"
|
| 140 |
+
"blog"
|
| 141 |
+
"changelog"
|
| 142 |
+
"portfolio"
|
| 143 |
+
"ai-chat"
|
| 144 |
+
"search"
|
| 145 |
+
"ecommerce"
|
| 146 |
+
"api-docs"
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
# Check if huggingface-cli is installed
|
| 150 |
+
if ! command -v huggingface-cli &> /dev/null; then
|
| 151 |
+
echo "⚠️ huggingface-cli not found. Please install it:"
|
| 152 |
+
echo " pip install huggingface-hub"
|
| 153 |
+
echo " huggingface-cli login"
|
| 154 |
+
exit 1
|
| 155 |
+
fi
|
| 156 |
+
|
| 157 |
+
# Push each template
|
| 158 |
+
for template in "${templates[@]}"; do
|
| 159 |
+
push_template "$template"
|
| 160 |
+
done
|
| 161 |
+
|
| 162 |
+
echo ""
|
| 163 |
+
echo "✅ All templates pushed to Hugging Face Spaces!"
|
| 164 |
+
echo ""
|
| 165 |
+
echo "📝 View your templates at:"
|
| 166 |
+
echo " https://huggingface.co/hanzo-community"
|
| 167 |
+
echo ""
|
| 168 |
+
echo "🔗 Each template is available at:"
|
| 169 |
+
for template in "${templates[@]}"; do
|
| 170 |
+
echo " https://huggingface.co/spaces/hanzo-community/$template"
|
| 171 |
+
done
|
setup-template-repos.sh
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Setup Template Repositories as Git Submodules
|
| 4 |
+
# This allows each template to be managed independently while being included in the gallery
|
| 5 |
+
|
| 6 |
+
echo "📦 Setting up template repositories..."
|
| 7 |
+
|
| 8 |
+
# Array of template names and their source directories
|
| 9 |
+
declare -A templates=(
|
| 10 |
+
["devforge"]="../devtool"
|
| 11 |
+
["mobilefirst"]="../mobile"
|
| 12 |
+
["saasify"]="../saas"
|
| 13 |
+
["startupkit"]="../startup"
|
| 14 |
+
["analyticsdash"]="../analytics"
|
| 15 |
+
["blog"]="../blog"
|
| 16 |
+
["changelog"]="../changelog"
|
| 17 |
+
["portfolio"]="../portfolio"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# Create templates-repos directory if it doesn't exist
|
| 21 |
+
mkdir -p templates-repos
|
| 22 |
+
|
| 23 |
+
# Copy existing templates to repos directory for now (until proper GitHub repos are created)
|
| 24 |
+
for template in "${!templates[@]}"; do
|
| 25 |
+
src="${templates[$template]}"
|
| 26 |
+
dest="templates-repos/$template"
|
| 27 |
+
|
| 28 |
+
echo "📋 Setting up $template..."
|
| 29 |
+
|
| 30 |
+
if [ -d "$src" ]; then
|
| 31 |
+
# Copy template if source exists
|
| 32 |
+
if [ ! -d "$dest" ]; then
|
| 33 |
+
echo " Copying from $src to $dest..."
|
| 34 |
+
cp -r "$src" "$dest"
|
| 35 |
+
|
| 36 |
+
# Initialize as git repo
|
| 37 |
+
cd "$dest"
|
| 38 |
+
git init
|
| 39 |
+
echo "# $template Template" > README.md
|
| 40 |
+
echo "" >> README.md
|
| 41 |
+
echo "A Hanzo template for building modern applications." >> README.md
|
| 42 |
+
echo "" >> README.md
|
| 43 |
+
echo "## Installation" >> README.md
|
| 44 |
+
echo '```bash' >> README.md
|
| 45 |
+
echo "npx create-hanzo-app --template $template" >> README.md
|
| 46 |
+
echo '```' >> README.md
|
| 47 |
+
|
| 48 |
+
# Add gitignore
|
| 49 |
+
cat > .gitignore << EOF
|
| 50 |
+
node_modules
|
| 51 |
+
.next
|
| 52 |
+
.env.local
|
| 53 |
+
.DS_Store
|
| 54 |
+
*.log
|
| 55 |
+
dist
|
| 56 |
+
build
|
| 57 |
+
EOF
|
| 58 |
+
|
| 59 |
+
git add .
|
| 60 |
+
git commit -m "Initial commit for $template template"
|
| 61 |
+
cd ../..
|
| 62 |
+
else
|
| 63 |
+
echo " ✓ $template already exists"
|
| 64 |
+
fi
|
| 65 |
+
else
|
| 66 |
+
echo " ⚠️ Source $src not found, creating placeholder..."
|
| 67 |
+
mkdir -p "$dest"
|
| 68 |
+
cd "$dest"
|
| 69 |
+
|
| 70 |
+
# Create a minimal package.json
|
| 71 |
+
cat > package.json << EOF
|
| 72 |
+
{
|
| 73 |
+
"name": "@hanzo/template-$template",
|
| 74 |
+
"version": "1.0.0",
|
| 75 |
+
"description": "Hanzo $template template",
|
| 76 |
+
"scripts": {
|
| 77 |
+
"dev": "next dev",
|
| 78 |
+
"build": "next build",
|
| 79 |
+
"start": "next start"
|
| 80 |
+
},
|
| 81 |
+
"dependencies": {
|
| 82 |
+
"next": "^15.3.5",
|
| 83 |
+
"react": "^19.0.0",
|
| 84 |
+
"react-dom": "^19.0.0",
|
| 85 |
+
"@hanzo/ui": "latest"
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
EOF
|
| 89 |
+
|
| 90 |
+
# Create basic structure
|
| 91 |
+
mkdir -p app
|
| 92 |
+
cat > app/page.tsx << EOF
|
| 93 |
+
export default function HomePage() {
|
| 94 |
+
return (
|
| 95 |
+
<div className="min-h-screen flex items-center justify-center">
|
| 96 |
+
<h1 className="text-4xl font-bold">$template Template</h1>
|
| 97 |
+
</div>
|
| 98 |
+
)
|
| 99 |
+
}
|
| 100 |
+
EOF
|
| 101 |
+
|
| 102 |
+
git init
|
| 103 |
+
git add .
|
| 104 |
+
git commit -m "Initial placeholder for $template template"
|
| 105 |
+
cd ../..
|
| 106 |
+
fi
|
| 107 |
+
done
|
| 108 |
+
|
| 109 |
+
# Add new AI templates
|
| 110 |
+
echo "📋 Setting up new AI templates..."
|
| 111 |
+
|
| 112 |
+
# Create AI chat template
|
| 113 |
+
if [ ! -d "templates-repos/ai-chat" ]; then
|
| 114 |
+
echo " Creating AI Chat template..."
|
| 115 |
+
cp -r "../ai-chat-interface" "templates-repos/ai-chat" 2>/dev/null || mkdir -p "templates-repos/ai-chat"
|
| 116 |
+
fi
|
| 117 |
+
|
| 118 |
+
# Create search template
|
| 119 |
+
if [ ! -d "templates-repos/search" ]; then
|
| 120 |
+
echo " Creating Search template..."
|
| 121 |
+
mkdir -p "templates-repos/search"
|
| 122 |
+
fi
|
| 123 |
+
|
| 124 |
+
# Create e-commerce template
|
| 125 |
+
if [ ! -d "templates-repos/ecommerce" ]; then
|
| 126 |
+
echo " Creating E-commerce template..."
|
| 127 |
+
cp -r "../ecommerce-storefront" "templates-repos/ecommerce" 2>/dev/null || mkdir -p "templates-repos/ecommerce"
|
| 128 |
+
fi
|
| 129 |
+
|
| 130 |
+
# Create API docs template
|
| 131 |
+
if [ ! -d "templates-repos/api-docs" ]; then
|
| 132 |
+
echo " Creating API Docs template..."
|
| 133 |
+
mkdir -p "templates-repos/api-docs"
|
| 134 |
+
fi
|
| 135 |
+
|
| 136 |
+
echo ""
|
| 137 |
+
echo "✅ Template repositories setup complete!"
|
| 138 |
+
echo ""
|
| 139 |
+
echo "📝 Next steps:"
|
| 140 |
+
echo "1. Push each template to Hugging Face Spaces:"
|
| 141 |
+
echo " ./push-to-huggingface.sh"
|
| 142 |
+
echo ""
|
| 143 |
+
echo "2. Or manually push individual templates:"
|
| 144 |
+
echo " cd templates-repos/[template-name]"
|
| 145 |
+
echo " git remote add hf https://huggingface.co/spaces/hanzo-community/template-[name]"
|
| 146 |
+
echo " git push hf main"
|
| 147 |
+
echo ""
|
| 148 |
+
echo "3. Add as submodules to gallery:"
|
| 149 |
+
echo " git submodule add https://huggingface.co/spaces/hanzo-community/template-[name] templates-repos/[name]"
|
| 150 |
+
echo ""
|
| 151 |
+
echo "4. Gallery will automatically load from templates-repos/"
|
simplify-all-docker.sh
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Simplify all Docker files to use dev mode for faster startup
|
| 4 |
+
|
| 5 |
+
templates=(
|
| 6 |
+
"devforge"
|
| 7 |
+
"mobilefirst"
|
| 8 |
+
"saasify"
|
| 9 |
+
"startupkit"
|
| 10 |
+
"analyticsdash"
|
| 11 |
+
"ai-chat"
|
| 12 |
+
"ecommerce"
|
| 13 |
+
"blog"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
for template in "${templates[@]}"; do
|
| 17 |
+
dir="templates-repos/$template"
|
| 18 |
+
|
| 19 |
+
if [ -d "$dir" ]; then
|
| 20 |
+
echo "📦 Simplifying $template Docker..."
|
| 21 |
+
cd "$dir"
|
| 22 |
+
|
| 23 |
+
# Create super simple Dockerfile
|
| 24 |
+
cat > Dockerfile << 'EOF'
|
| 25 |
+
FROM node:20-slim
|
| 26 |
+
|
| 27 |
+
WORKDIR /app
|
| 28 |
+
|
| 29 |
+
COPY . .
|
| 30 |
+
|
| 31 |
+
RUN npm install --legacy-peer-deps
|
| 32 |
+
|
| 33 |
+
EXPOSE 3000
|
| 34 |
+
|
| 35 |
+
CMD ["npm", "run", "dev"]
|
| 36 |
+
EOF
|
| 37 |
+
|
| 38 |
+
# Ensure dev script binds to all interfaces
|
| 39 |
+
if [ -f package.json ]; then
|
| 40 |
+
sed -i '' 's/"dev": "next dev"/"dev": "next dev -H 0.0.0.0 -p 3000"/' package.json 2>/dev/null || true
|
| 41 |
+
sed -i '' 's/"dev": "next dev -p 3000"/"dev": "next dev -H 0.0.0.0 -p 3000"/' package.json 2>/dev/null || true
|
| 42 |
+
fi
|
| 43 |
+
|
| 44 |
+
# Commit and push
|
| 45 |
+
git add Dockerfile package.json
|
| 46 |
+
git commit -m "Use dev mode in Docker for faster startup" 2>/dev/null || true
|
| 47 |
+
git push hf main --force
|
| 48 |
+
|
| 49 |
+
cd ../..
|
| 50 |
+
echo " ✅ Simplified $template"
|
| 51 |
+
fi
|
| 52 |
+
done
|
| 53 |
+
|
| 54 |
+
echo ""
|
| 55 |
+
echo "✅ All templates simplified for faster startup!"
|
templates-repos/ai-chat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 31484f5d47f625ec07ac42d0dc0acd11b2d08fa5
|
templates-repos/analyticsdash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 32bc6edbd4a7aff6c11abf54c3911433b11e49b7
|
templates-repos/api-docs
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 5ae1198be0900e849c3dbde7f40856c3a005066a
|
templates-repos/blog
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 2c8a27307be3a1a89656c009d4ff692911f6d395
|
templates-repos/changelog
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 46fc3ab88b73feb9cd3f2ffd6ed323f80f82e580
|
templates-repos/devforge
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 9c5df0d43ede0a8210e2caf50a8a3f8ab1af43d9
|
templates-repos/ecommerce
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 4172f8b589e6a16fd0dddaae34df7251642d51ab
|
templates-repos/fix-dependencies.sh
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# List of all templates
|
| 4 |
+
TEMPLATES=(
|
| 5 |
+
"devforge"
|
| 6 |
+
"mobilefirst"
|
| 7 |
+
"saasify"
|
| 8 |
+
"startupkit"
|
| 9 |
+
"analyticsdash"
|
| 10 |
+
"blog"
|
| 11 |
+
"changelog"
|
| 12 |
+
"ai-chat"
|
| 13 |
+
"search"
|
| 14 |
+
"ecommerce"
|
| 15 |
+
"api-docs"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
# Base directory
|
| 19 |
+
BASE_DIR="/Users/z/work/hanzo/templates/gallery/templates-repos"
|
| 20 |
+
|
| 21 |
+
echo "Fixing dependency issues in all Hanzo templates..."
|
| 22 |
+
|
| 23 |
+
for template in "${TEMPLATES[@]}"; do
|
| 24 |
+
TEMPLATE_DIR="$BASE_DIR/$template"
|
| 25 |
+
|
| 26 |
+
if [ -d "$TEMPLATE_DIR" ]; then
|
| 27 |
+
echo "Processing template: $template"
|
| 28 |
+
|
| 29 |
+
# Update package.json to add --legacy-peer-deps to npm scripts
|
| 30 |
+
if [ -f "$TEMPLATE_DIR/package.json" ]; then
|
| 31 |
+
echo " - Updating package.json..."
|
| 32 |
+
# Use node to update package.json safely
|
| 33 |
+
node -e "
|
| 34 |
+
const fs = require('fs');
|
| 35 |
+
const path = '$TEMPLATE_DIR/package.json';
|
| 36 |
+
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
|
| 37 |
+
|
| 38 |
+
// Add install script with legacy-peer-deps
|
| 39 |
+
pkg.scripts = pkg.scripts || {};
|
| 40 |
+
pkg.scripts.install = 'npm install --legacy-peer-deps';
|
| 41 |
+
pkg.scripts.ci = 'npm ci --legacy-peer-deps';
|
| 42 |
+
|
| 43 |
+
// Update build script to ensure dependencies are installed properly
|
| 44 |
+
if (pkg.scripts.build && !pkg.scripts.build.includes('legacy-peer-deps')) {
|
| 45 |
+
pkg.scripts['prebuild'] = 'npm install --legacy-peer-deps || true';
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\\n');
|
| 49 |
+
console.log(' ✓ package.json updated');
|
| 50 |
+
"
|
| 51 |
+
fi
|
| 52 |
+
|
| 53 |
+
# Update Dockerfile to use --legacy-peer-deps
|
| 54 |
+
if [ -f "$TEMPLATE_DIR/Dockerfile" ]; then
|
| 55 |
+
echo " - Updating Dockerfile..."
|
| 56 |
+
# Create updated Dockerfile
|
| 57 |
+
cat > "$TEMPLATE_DIR/Dockerfile" << 'EOF'
|
| 58 |
+
FROM node:20-slim
|
| 59 |
+
|
| 60 |
+
WORKDIR /app
|
| 61 |
+
|
| 62 |
+
# Copy package files
|
| 63 |
+
COPY package*.json ./
|
| 64 |
+
|
| 65 |
+
# Install dependencies with legacy peer deps flag
|
| 66 |
+
RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
|
| 67 |
+
|
| 68 |
+
# Copy application files
|
| 69 |
+
COPY . .
|
| 70 |
+
|
| 71 |
+
# Build the application
|
| 72 |
+
RUN npm run build
|
| 73 |
+
|
| 74 |
+
# Expose port
|
| 75 |
+
EXPOSE 3000
|
| 76 |
+
|
| 77 |
+
# Start the application
|
| 78 |
+
CMD ["npm", "start"]
|
| 79 |
+
EOF
|
| 80 |
+
echo " ✓ Dockerfile updated"
|
| 81 |
+
fi
|
| 82 |
+
|
| 83 |
+
# Create or update .npmrc to set legacy-peer-deps by default
|
| 84 |
+
echo " - Creating/updating .npmrc..."
|
| 85 |
+
echo "legacy-peer-deps=true" > "$TEMPLATE_DIR/.npmrc"
|
| 86 |
+
echo " ✓ .npmrc created"
|
| 87 |
+
|
| 88 |
+
echo " ✓ Template $template fixed"
|
| 89 |
+
echo ""
|
| 90 |
+
else
|
| 91 |
+
echo " ⚠ Template directory not found: $template"
|
| 92 |
+
fi
|
| 93 |
+
done
|
| 94 |
+
|
| 95 |
+
echo "All templates have been updated!"
|
| 96 |
+
echo ""
|
| 97 |
+
echo "Summary of changes:"
|
| 98 |
+
echo "1. Added 'install' and 'ci' scripts with --legacy-peer-deps flag to package.json"
|
| 99 |
+
echo "2. Updated Dockerfile to use 'npm ci --legacy-peer-deps'"
|
| 100 |
+
echo "3. Created .npmrc file with legacy-peer-deps=true"
|
| 101 |
+
echo ""
|
| 102 |
+
echo "You can now build Docker images without peer dependency conflicts."
|
templates-repos/fix-infinite-loop.sh
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# List of all templates
|
| 4 |
+
TEMPLATES=(
|
| 5 |
+
"devforge"
|
| 6 |
+
"mobilefirst"
|
| 7 |
+
"saasify"
|
| 8 |
+
"startupkit"
|
| 9 |
+
"analyticsdash"
|
| 10 |
+
"blog"
|
| 11 |
+
"changelog"
|
| 12 |
+
"ai-chat"
|
| 13 |
+
"search"
|
| 14 |
+
"ecommerce"
|
| 15 |
+
"api-docs"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
# Base directory
|
| 19 |
+
BASE_DIR="/Users/z/work/hanzo/templates/gallery/templates-repos"
|
| 20 |
+
|
| 21 |
+
echo "Fixing infinite loop issue in all templates..."
|
| 22 |
+
|
| 23 |
+
for template in "${TEMPLATES[@]}"; do
|
| 24 |
+
TEMPLATE_DIR="$BASE_DIR/$template"
|
| 25 |
+
|
| 26 |
+
if [ -d "$TEMPLATE_DIR" ]; then
|
| 27 |
+
echo "Processing template: $template"
|
| 28 |
+
|
| 29 |
+
# Update package.json to remove the problematic install script
|
| 30 |
+
if [ -f "$TEMPLATE_DIR/package.json" ]; then
|
| 31 |
+
echo " - Updating package.json..."
|
| 32 |
+
# Use node to update package.json safely
|
| 33 |
+
node -e "
|
| 34 |
+
const fs = require('fs');
|
| 35 |
+
const path = '$TEMPLATE_DIR/package.json';
|
| 36 |
+
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
|
| 37 |
+
|
| 38 |
+
// Remove the problematic install script
|
| 39 |
+
if (pkg.scripts && pkg.scripts.install) {
|
| 40 |
+
delete pkg.scripts.install;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
// Keep the ci script for CI/CD
|
| 44 |
+
pkg.scripts = pkg.scripts || {};
|
| 45 |
+
pkg.scripts.ci = 'npm ci --legacy-peer-deps';
|
| 46 |
+
|
| 47 |
+
// Remove prebuild if it exists
|
| 48 |
+
if (pkg.scripts && pkg.scripts.prebuild) {
|
| 49 |
+
delete pkg.scripts.prebuild;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\\n');
|
| 53 |
+
console.log(' ✓ package.json fixed');
|
| 54 |
+
"
|
| 55 |
+
fi
|
| 56 |
+
|
| 57 |
+
echo " ✓ Template $template fixed"
|
| 58 |
+
echo ""
|
| 59 |
+
fi
|
| 60 |
+
done
|
| 61 |
+
|
| 62 |
+
echo "All templates have been fixed!"
|
templates-repos/mobilefirst
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 367ef5e766cb5fb0596586a0bd9a412008ab99c5
|
templates-repos/saasify
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 2c0e351b124c85417c3b24da88279df7d591365f
|
templates-repos/search
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit aa44244897828df196a444d04be276c6d59b5660
|
templates-repos/startupkit
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit 107dba003e904057dd84f25e563b58005aab328b
|