Replace Handlebars templating with direct string rendering - #1468
Conversation
Replace the handlebars-based `.env`, `package.json`, and `schema.graphql` templating with direct Rust string generation, matching the previous rendered output byte-for-byte. - Drop the `handlebars` crate and the `HandleBarsDirGenerator`. - Delete the four `.hbs` templates (the whole `templates/dynamic` tree) and the now-dead template-dir plumbing that served them. - Generate the shared `.env` via `env_template`, `package.json` via `InitTemplates`, and `schema.graphql` via `AutoSchemaHandlerTemplate`. - Add unit/snapshot tests locking the generated output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kt8L8CRc3wjfiSoyXaUFeZ
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CLI removes dynamic Handlebars template generation and renders initialization and contract-import files directly. New helpers generate ChangesDirect template rendering
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Convert the inline exact-string assertions for the generated `.env` and `package.json` output to insta snapshots, matching the style already used for `schema.graphql` and the codegen templates. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kt8L8CRc3wjfiSoyXaUFeZ
Remove the Handlebars templating system and replace it with direct Rust string rendering for template generation. This simplifies the codebase by eliminating the need for
.hbstemplate files and thehandlebarsdependency.Changes
Removed Handlebars infrastructure:
hbs_dir_generator.rswhich recursively processed.hbstemplate fileshandlebarsdependency fromCargo.toml.hbstemplate files fromtemplates/dynamic/Implemented direct rendering methods:
env_template.rsmodule withrender()function for.envfile generation (used by both init and contract import)render_package_json()method toInitTemplatesstruct with comprehensive test coverage for ReScript, TypeScript, and extra dependenciesrender_schema_graphql()andrender_env()methods toAutoSchemaHandlerTemplatestructUpdated callers:
init.rs: ReplaceHandleBarsDirGeneratorwith directfs::write()calls to.envandpackage.jsoncontract_import_templates.rs: ReplaceHandleBarsDirGeneratorwith directfs::write()calls and inline rendering methodsget_dynamic_dir()and related methods fromTemplateDirsSerializederive fromInitTemplates(no longer needed for Handlebars)Cleanup:
system_config.rshbs_templating/mod.rsThe new approach is more maintainable: template logic is now explicit Rust code with full type safety and IDE support, rather than scattered across template files and Handlebars helpers.
https://claude.ai/code/session_01Kt8L8CRc3wjfiSoyXaUFeZ
Summary by CodeRabbit
New Features
envio initnow creates tailored.envandpackage.jsonfiles for ReScript and TypeScript projects.schema.graphqlfiles with event and field definitions..envfiles include clearer API token setup guidance or the provided token.Refactor