Skip to content

Improve HTML site upload scripts#38

Merged
marcarl merged 3 commits intomainfrom
feature/add-r2-web-delete-script
Jan 7, 2026
Merged

Improve HTML site upload scripts#38
marcarl merged 3 commits intomainfrom
feature/add-r2-web-delete-script

Conversation

@marcarl
Copy link
Copy Markdown
Collaborator

@marcarl marcarl commented Jan 7, 2026

Summary

This PR adds and improves Cloudflare R2 utility scripts for managing HTML exports:

New script: delete_web_from_r2.py

  • Removes all files under the web/ prefix in Cloudflare R2 storage
  • Uses AWS CLI with Cloudflare R2 endpoint for deletion
  • Includes --force flag to skip confirmation prompt for automated usage

Improvements to upload_to_r2.py

  • Add automatic .env file loading with python-dotenv
  • Fix upload structure to sync entire output directory to R2 bucket root (not just eli/sfs/ subfolder)
  • Add automatic JSON directory detection (tries ../sfs-jsondata, sfs_json, data/sfs_json)
  • Add --json-dir argument for explicit JSON directory specification
  • Fix index page generation with absolute paths
  • Improve error messages and output logging
  • Make index page generation non-critical (warns instead of fails)

Use case

  • delete_web_from_r2.py: Clean up or remove all web-related files from R2 storage
  • upload_to_r2.py: Deploy HTML exports to Cloudflare R2 with proper structure

Test plan

  • Test upload_to_r2.py with .env file loading
  • Test upload_to_r2.py with automatic JSON directory detection
  • Test delete_web_from_r2.py dry-run (without --force)
  • Test delete_web_from_r2.py actual deletion with --force flag

🤖 Generated with Claude Code

marcarl and others added 3 commits January 7, 2026 10:46
This script allows deleting all files under the web/ prefix in
Cloudflare R2 storage using AWS CLI. Includes --force flag to skip
confirmation prompt for automated usage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add python-dotenv support to automatically load .env file
- Update requirements.txt with python-dotenv dependency
- Change upload to sync entire output directory to R2 bucket root
  (previously only synced eli/sfs/ subfolder)
- Fix index page generation with absolute paths to resolve subprocess issues
- Add automatic JSON directory detection (tries ../sfs-jsondata, sfs_json, data/sfs_json)
- Add --json-dir argument for explicit JSON directory specification
- Improve error messages and output logging
- Make index page generation non-critical (warns instead of fails)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@marcarl marcarl changed the title Add script to delete web/ folder from Cloudflare R2 Add and improve Cloudflare R2 utility scripts Jan 7, 2026
@marcarl marcarl changed the title Add and improve Cloudflare R2 utility scripts Add and improve HTML site upload scripts Jan 7, 2026
@marcarl marcarl changed the title Add and improve HTML site upload scripts Improve HTML site upload scripts Jan 7, 2026
@marcarl marcarl merged commit 2124ad6 into main Jan 7, 2026
5 checks passed
@marcarl marcarl deleted the feature/add-r2-web-delete-script branch January 7, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant