Skip to content

Sync templates with Arizona breaking changes#24

Merged
williamthome merged 7 commits intomainfrom
feat/sync-with-arizona-breaking-changes
Oct 7, 2025
Merged

Sync templates with Arizona breaking changes#24
williamthome merged 7 commits intomainfrom
feat/sync-with-arizona-breaking-changes

Conversation

@williamthome
Copy link
Member

Update all rebar3 templates to be compatible with Arizona framework breaking changes:

  • Arizona Client v0.2.1: Updated API with named exports, logger refactoring, and new connect() signature
  • Arizona Template: New from_html and from_erl APIs for template rendering
  • Event API: Renamed sendEventTopushEventTo and sendEventpushEvent
  • Asset Routing: Standardized Arizona framework asset paths and route configuration
  • Template Structure: hello_world now uses inline layout instead of separate file
  • Documentation: Added clear "Getting Started" instructions with endpoint URLs to all template READMEs
  • Template Fixes: Removed non-existent built asset files from arizona.frontend template definition

All templates (hello_world, presence, frontend, svelte) now work with latest Arizona framework APIs.

Replace all arizona_template:from_string calls with arizona_template:from_html
across all templates to align with Arizona breaking changes.
Breaking changes in Arizona client API:
- Arizona is now a named export instead of default export
- Constructor now accepts { logger } instead of { logLevel }
- Logger must be instantiated separately (ArizonaConsoleLogger)
- connect() now takes path string directly instead of { wsPath }

Updated templates:
- arizona.frontend: Updated main.js and package.json
- arizona.svelte: Updated main.js and package.json
The Arizona client API has renamed the event method:
- sendEventTo() → pushEventTo()

Updated templates:
- arizona.presence: Updated counter.erl increment button
- arizona.svelte: Updated counter.erl decr/reset/incr buttons
The app.css and app.js files in priv/static/assets/ are build artifacts
generated by npm run build, not source files. Users should build these
after template generation using:
- npm run build:css (generates app.css with Tailwind)
- npm run build:js (generates app.js with esbuild)

This fixes the template generation issue where these files were missing.
Add clear "Getting Started" sections to all templates:
- Step-by-step instructions (npm install, npm run build, rebar3 shell)
- Application endpoint (http://localhost:1912)

This provides a consistent onboarding experience across all templates.
Breaking changes applied:
- Move layout from separate file into view.erl (layout/1 callback)
- Use arizona_template:from_erl instead of from_html
- Add handle_event/3 for interactive button
- Use new Arizona client initialization (from arizona assets)
- Update sys.config to use arizona static assets route
- Add websocket route configuration

Template now demonstrates:
- Inline layout definition
- Event handling with pushEvent
- Dynamic content updates based on state
Breaking changes applied:
- Update Arizona client import path to /assets/arizona/js/arizona.min.js
- Add arizona.connect('/live') with explicit path
- Reorganize sys.config routes (arizona assets first, then app assets)
- Fix asset route to use {{name}} static assets instead of arizona
- Update layout script src to use correct assets path

This aligns with Arizona framework's standardized asset serving.
@williamthome williamthome merged commit 80513de into main Oct 7, 2025
4 checks passed
@williamthome williamthome deleted the feat/sync-with-arizona-breaking-changes branch October 7, 2025 04:13
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