Skip to content

Migrate from JSON to YAML configuration format#112

Merged
akesson merged 16 commits into
mainfrom
asset-gen
Oct 2, 2025
Merged

Migrate from JSON to YAML configuration format#112
akesson merged 16 commits into
mainfrom
asset-gen

Conversation

@akesson

@akesson akesson commented Oct 2, 2025

Copy link
Copy Markdown
Member

Summary

This PR migrates the builder tool from JSON to YAML configuration format for better readability and a more standard configuration file format.

Breaking Changes

  • Configuration files must now be in YAML format - The builder binary now only accepts .yaml/.yml files, not JSON
  • Default config filename changed from builder.toml to builder.yaml

Key Changes

YAML Migration

  • Added serde_yaml to workspace dependencies
  • Updated builder binary to parse YAML configuration files (removed JSON conversion logic)
  • Modified BuilderCmd::exec() and run() methods to write YAML instead of JSON
  • Changed default config filename from builder.toml to builder.yaml
  • Updated documentation references from JSON to YAML

Build System Fixes

  • Fixed cargo deadlock in crates/examples/build.rs by removing nested cargo build -r -p builder call
  • Build script now looks for existing builder binary instead of building it
  • Generates stub assets.rs when builder binary doesn't exist, allowing clean workspace builds
  • Prevents infinite hang during cargo build --release

Code Quality

  • Fixed clippy warnings: needless_borrows_for_generic_args, len_zero
  • Ran cargo fmt for consistency
  • All 87 tests pass

Bug Fixes

  • Create parent directories when writing debug symbols (wasm crate)
  • Create parent directories when writing site files (site_fs)
  • Fix manifest_path to point to Cargo.toml instead of directory (swift_package)

Test Plan

  • ✅ Clean build from scratch works: cargo clean && cargo build
  • ✅ Release build works without hanging: cargo build --release
  • ✅ All 87 tests pass: cargo nextest run
  • ✅ Clippy passes with -D warnings
  • ✅ YAML serialization/deserialization works correctly with tagged enums

Example YAML Configuration

log_level: Normal
log_destination: Terminal
release: false
builder_toml: ./builder.yaml
in_cargo: true
cmds:
- !Copy
  src_dir: assets
  recursive: true
  file_extensions: []
  output:
  - dir: dist
    brotli: true
    checksum: true
- !Wasm
  package: my-wasm-package
  profile: Release

🤖 Generated with Claude Code

akesson and others added 16 commits September 13, 2025 15:18
- Replace JSON config with YAML for better readability and standard format
- Add serde_yaml to workspace dependencies
- Update builder binary to only accept YAML files (no format conversion)
- Change default config filename from builder.toml to builder.yaml
- Update BuilderCmd::exec() and run() to write YAML instead of JSON
- Fix build.rs cargo deadlock by removing nested cargo build
- Generate stub assets.rs when builder binary doesn't exist yet
- Fix clippy warnings (needless_borrows, len_zero)
- Run cargo fmt for consistency

Bug fixes:
- Create parent directories when writing debug symbols (wasm)
- Create parent directories when writing files (site_fs)
- Fix manifest_path to point to Cargo.toml (swift_package)

Breaking change: Configuration files must now be in YAML format.
The builder binary now only accepts .yaml/.yml files.

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Add rerun-if-changed directives for builder binaries
- Simplify binary lookup logic (check debug first, then release)
- Create stub assets when builder binary doesn't exist
- Provide clear instructions: cargo build -p builder && cargo build
- Avoid trying to build builder from build.rs (causes deadlocks)

This allows clean builds to succeed, though users need to build
the builder binary first, then rebuild examples to get real assets.
The multi-provider-examples crate has a build.rs that requires the builder
binary to exist before it can build. This causes issues in CI and during
clean builds when running tests.

Changes:
- Added `exclude = ["crates/examples"]` to workspace Cargo.toml
- Modified CI workflow to build builder binary before running tests
- Tests now pass with `cargo clean && cargo nextest run`

The examples crate can still be built explicitly with
`cargo build -p multi-provider-examples` after building the builder binary.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@akesson akesson merged commit 5c1396f into main Oct 2, 2025
7 checks passed
@akesson akesson deleted the asset-gen branch October 2, 2025 19:44
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