Skip to content

Lay out generated Scratch scripts - #366

Merged
aspizu merged 2 commits into
mainfrom
apz/cleanup-script-layout
Aug 15, 2026
Merged

Lay out generated Scratch scripts#366
aspizu merged 2 commits into
mainfrom
apz/cleanup-script-layout

Conversation

@aspizu

@aspizu aspizu commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • arrange generated Scratch scripts by hat priority on a consistent grid
  • account for nested stacks, reporters, and C-shaped blocks when spacing scripts
  • generate and clean project.json before assembling the .sb3 archive
  • move ZIP and asset writing out of Sb3, leaving it as a focused JSON generator

Why

Generated scripts previously retained incidental coordinates instead of receiving a predictable, readable layout. Cleaning the completed JSON requires buffering it before archive creation, which exposed that Sb3 was unnecessarily coupled to the ZIP writer.

The build layer now owns archive assembly while Sb3 owns only project JSON generation and asset collection.

Impact

Compiled Scratch projects open with consistently ordered, non-overlapping script stacks. Archive contents and asset deduplication remain unchanged.

Validation

  • cargo +nightly fmt --check
  • cargo test --lib (12 passed)
  • built tests/vars successfully
  • verified the generated ZIP with unzip -t
  • parsed the generated project.json with jq

@aspizu
aspizu marked this pull request as ready for review August 15, 2026 15:13
@aspizu
aspizu merged commit 2314691 into main Aug 15, 2026
7 checks passed
@aspizu
aspizu deleted the apz/cleanup-script-layout branch August 15, 2026 15:16
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