Add --local-only flag to website-creator for local testing before deploy
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -25,5 +25,6 @@ gsc-credentials.json
|
|||||||
|
|
||||||
# Shodh Memory data (local persistent memory)
|
# Shodh Memory data (local persistent memory)
|
||||||
.shodh/
|
.shodh/
|
||||||
|
shodh_data/
|
||||||
shodh_memory_data/
|
shodh_memory_data/
|
||||||
*.db
|
*.db
|
||||||
|
|||||||
@@ -811,6 +811,12 @@ python3 scripts/create_astro_website.py \
|
|||||||
--features "blog,products,contact" \
|
--features "blog,products,contact" \
|
||||||
--umami-id "xxx-xxx-xxx" \
|
--umami-id "xxx-xxx-xxx" \
|
||||||
--output "./dealplustech-website"
|
--output "./dealplustech-website"
|
||||||
|
|
||||||
|
# Local only (skip Gitea/Easypanel):
|
||||||
|
python3 scripts/create_astro_website.py \
|
||||||
|
--name "My Website" \
|
||||||
|
--local-only \
|
||||||
|
--output "./my-website"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Refactor Existing Website
|
### Refactor Existing Website
|
||||||
|
|||||||
@@ -10,14 +10,20 @@ Creates complete Astro projects with:
|
|||||||
- Cookie consent management
|
- Cookie consent management
|
||||||
- Consent logging database (Astro DB)
|
- Consent logging database (Astro DB)
|
||||||
- PDPA-compliant legal pages
|
- PDPA-compliant legal pages
|
||||||
- Easypanel deployment
|
- Easypanel deployment (optional with --local-only)
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
python3 create_astro_website.py \
|
python3 create_astro_website.py \\
|
||||||
--name "Deal Plus Tech" \
|
--name "Deal Plus Tech" \\
|
||||||
--type "corporate" \
|
--type "corporate" \\
|
||||||
--languages "th,en" \
|
--languages "th,en" \\
|
||||||
--output "./dealplustech-website"
|
--output "./dealplustech-website"
|
||||||
|
|
||||||
|
# Local only (skip Gitea/Easypanel):
|
||||||
|
python3 create_astro_website.py \\
|
||||||
|
--name "My Website" \\
|
||||||
|
--local-only \\
|
||||||
|
--output "./my-website"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -254,6 +260,8 @@ def main():
|
|||||||
help='Output directory')
|
help='Output directory')
|
||||||
parser.add_argument('--no-interactive', action='store_true',
|
parser.add_argument('--no-interactive', action='store_true',
|
||||||
help='Skip interactive setup (use defaults)')
|
help='Skip interactive setup (use defaults)')
|
||||||
|
parser.add_argument('--local-only', action='store_true',
|
||||||
|
help='Create website locally only, skip Gitea sync and Easypanel deploy')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@@ -333,12 +341,39 @@ def main():
|
|||||||
print(" 3. Update .env with your credentials")
|
print(" 3. Update .env with your credentials")
|
||||||
print(" 4. npm run dev")
|
print(" 4. npm run dev")
|
||||||
|
|
||||||
# Auto-deploy (always on)
|
# Check if local-only mode
|
||||||
print("")
|
if args.local_only:
|
||||||
print("=" * 60)
|
print("")
|
||||||
print("🚀 AUTO-DEPLOY STARTING")
|
print("=" * 60)
|
||||||
print("=" * 60)
|
print("🏠 LOCAL MODE - No auto-deploy")
|
||||||
print("")
|
print("=" * 60)
|
||||||
|
print("")
|
||||||
|
print("Website created locally. To preview:")
|
||||||
|
print(f" cd {args.output}")
|
||||||
|
print(" npm install")
|
||||||
|
print(" npm run dev")
|
||||||
|
print("")
|
||||||
|
|
||||||
|
# Ask if they want to deploy (skip if no-interactive mode)
|
||||||
|
if args.no_interactive:
|
||||||
|
print("✅ Done! Website is ready at:", args.output)
|
||||||
|
return
|
||||||
|
|
||||||
|
deploy_choice = input("Do you want to sync to Gitea and deploy to Easypanel? (y/n): ").strip().lower()
|
||||||
|
|
||||||
|
if deploy_choice != 'y':
|
||||||
|
print("")
|
||||||
|
print("✅ Done! Website is ready at:", args.output)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
print("")
|
||||||
|
print("Proceeding with deployment...")
|
||||||
|
else:
|
||||||
|
print("")
|
||||||
|
print("=" * 60)
|
||||||
|
print("🚀 AUTO-DEPLOY STARTING")
|
||||||
|
print("=" * 60)
|
||||||
|
print("")
|
||||||
|
|
||||||
# Step 1: Sync to Gitea
|
# Step 1: Sync to Gitea
|
||||||
print("📦 Step 1/3: Syncing to Gitea...")
|
print("📦 Step 1/3: Syncing to Gitea...")
|
||||||
|
|||||||
Reference in New Issue
Block a user