Sure! Pl
This commit is contained in:
23
scripts/utils/cleanup.sh
Executable file
23
scripts/utils/cleanup.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧹 Cleaning up temporary files..."
|
||||
|
||||
# Remove node_modules (optional, comment out if you want to keep them)
|
||||
# find . -name "node_modules" -type d -prune -exec rm -rf {} \;
|
||||
|
||||
# Remove build artifacts
|
||||
find . -name "dist" -type d -prune -exec rm -rf {} \;
|
||||
find . -name ".next" -type d -prune -exec rm -rf {} \;
|
||||
find . -name "build" -type d -prune -exec rm -rf {} \;
|
||||
find . -name "*.tsbuildinfo" -type f -delete
|
||||
|
||||
# Remove logs
|
||||
find . -name "*.log" -type f -delete
|
||||
|
||||
# Remove cache
|
||||
find . -name ".turbo" -type d -prune -exec rm -rf {} \;
|
||||
find . -name ".cache" -type d -prune -exec rm -rf {} \;
|
||||
|
||||
echo "✅ Cleanup completed!"
|
||||
45
scripts/utils/create-service.sh
Executable file
45
scripts/utils/create-service.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SERVICE_NAME=$1
|
||||
|
||||
if [ -z "$SERVICE_NAME" ]; then
|
||||
echo "Usage: $0 <service-name>"
|
||||
echo "Example: $0 payment-service"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVICE_DIR="services/$SERVICE_NAME"
|
||||
|
||||
if [ -d "$SERVICE_DIR" ]; then
|
||||
echo "❌ Service $SERVICE_NAME already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Creating new service: $SERVICE_NAME..."
|
||||
|
||||
# Copy template
|
||||
cp -r services/_template "$SERVICE_DIR"
|
||||
|
||||
# Update package.json
|
||||
cd "$SERVICE_DIR"
|
||||
sed -i.bak "s/@goodgo\/service-template/@goodgo\/$SERVICE_NAME/g" package.json
|
||||
rm package.json.bak
|
||||
|
||||
# Update .env.example
|
||||
sed -i.bak "s/SERVICE_NAME=service-name/SERVICE_NAME=$SERVICE_NAME/g" .env.example 2>/dev/null || true
|
||||
rm .env.example.bak 2>/dev/null || true
|
||||
|
||||
# Update Dockerfile port if needed
|
||||
# (Keep default 5000, user can change later)
|
||||
|
||||
cd ../..
|
||||
|
||||
echo "✅ Service $SERVICE_NAME created!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Update $SERVICE_DIR/package.json if needed"
|
||||
echo "2. Update $SERVICE_DIR/.env.example with service-specific configs"
|
||||
echo "3. Implement your service logic in $SERVICE_DIR/src/"
|
||||
echo "4. Add Prisma schema if needed: $SERVICE_DIR/prisma/schema.prisma"
|
||||
Reference in New Issue
Block a user