Repository navigation
Add Vite script component (salvage of #2334) - #2351
Merged
Merged
Conversation
# Conflicts: # CHANGES.rdoc
# Conflicts: # CHANGES.rdoc
The Vite component wrote `gem 'activesupport', '>= 3.1', require: ...`, which differs from padrino-admin's `gem 'activesupport', '>= 3.1'`, so a project with both got Bundler's "listed more than once" warning in either order. Declare it with require_dependencies so the line is identical and Thor's inject skips the second copy, and require Object#try from config/boot.rb after Bundler.require (vite_padrino 3.0.0 needs it until vite_ruby#635 ships). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
The Vite component skipped Procfile.dev when the project already had one, so `vite dev` was never started. Append the vite line instead, unless the file already declares a vite process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
Running `padrino g component --script=vite` again without a terminal overwrote vite.config.ts, config/vite.json and the application entrypoint, because Thor treats an unanswered conflict prompt as "overwrite". Skip them when they exist, as package.json already was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
- Start Procfile.dev and .gitignore additions on a new line when the file lacks a trailing newline; otherwise 'web: ...puma' became '...pumavite: ...' and '.env' became '.env/public/vite*', un-ignoring it. - Keep an activesupport line the Gemfile already has instead of adding a second one Bundler rejects. - Say how to add the Object#try require when config/boot.rb has no matching Bundler.require line, and link vite_ruby#635 in the comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
# Conflicts: # CHANGES.rdoc
# Conflicts: # CHANGES.rdoc
…ile edits
Read component files as UTF-8, so the Vite component (whose entrypoint text
isn't ASCII) no longer fails with a SyntaxError when the locale is C or POSIX.
Treat gem('activesupport', ...) as an existing activesupport line, and skip
the Rakefile tasks when a project has no Rakefile instead of stopping halfway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD
This was referenced Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This carries @osbre's commits from #2334 unchanged, plus review polish. When squash-merged, it will credit @osbre with a
Co-authored-bytrailer.The component (by @osbre): it adds Vite as a script component via
vite_padrino, for bothpadrino g project demo --script=viteandpadrino g component --script=vitein an existing project. It:vite_padrinoandregister VitePadrino;config/vite.json,vite.config.ts,package.json, anapp/frontend/entrypoints/application.jsentrypoint, the Vite rake tasks, and aviteprocess inProcfile.dev.It doesn't run npm; it tells you to run
npm installand addvite_client_tag/vite_javascript_tag 'application'to your layout.The
Object#tryworkaround:vite_padrino3.0.0 calls ActiveSupport'sObject#tryand crashes without it when entrypoints share a chunk. The upstream fix, ElMassimo/vite_ruby#635, is still pending. So for now the component:gem 'activesupport', '>= 3.1', the same line padrino-admin uses, so the two never duplicate it;active_support/core_ext/object/tryinconfig/boot.rb, with a comment pointing at Reloading makes image requests take increasingly longer on successive page requests #635. Ifconfig/boot.rbhas noBundler.requireline, it prints how to add the require instead.Drop both once a fixed release ships.
Polish added in this salvage, each with a regression test that fails before the change:
gem 'activesupport'orgem('activesupport', ...)line is kept as is.Procfile.devgets thevite:process appended, or left alone if it's already there, instead of being skipped.Procfile.devand.gitignorestart on a new line. Before, a file without a trailing newline glued the first appended line onto its last line, which could un-ignore.env.vite.config.ts,config/vite.jsonor entrypoint.GemfileorRakefileno longer stop halfway.apply_component_for), so--script=vite, whose entrypoint text isn't ASCII, no longer fails with a SyntaxError under a C/POSIX locale.Verification:
bundle exec rake testpasses in an isolated environment, plain and with--enable-frozen-string-literal(gen 261 runs, admin 67, 0 failures).Object#tryloaded,VitePadrinoregistered;LC_ALL=C;Closes #2334.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JWpdhd1LepyfkNRGx9kwrD