Replace vite_rails gem with our own vite integration (#40004)

This commit is contained in:
Juan Hernández authored and GitHub committed 2026-08-03 12:09:52 +00:00
1 parent b48468a345
commit 0c1e3aa807
34 files changed
+1577 -296

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# frozen_string_literal: true
module Vite
# Check the status of Vite's dev server
class DevServer
WAIT_TIME = 5 # seconds
attr_reader :config
def initialize(config:)
@config = config
end
# Original idea from vite_ruby gem
def running?
return @running if defined?(@running) && Time.now.to_i - @running_checked_at < WAIT_TIME
Socket.tcp(config.host, config.port).close
@running = true
rescue
@running = false
ensure
@running_checked_at = Time.now.to_i
end
end
end