class ViteRuby::CLI::Install

def install_js_dependencies

Internal: Installs vite and vite-plugin-ruby at the project level.
def install_js_dependencies
  package_json = root.join("package.json")
  unless package_json.exist?
    write package_json, <<~JSON
      {
        "private": true,
        "type": "module"
      }
    JSON
  end
  if (JSON.parse(package_json.read)["type"] != "module" rescue nil)
    FileUtils.mv root.join("vite.config.ts"), root.join("vite.config.mts"), force: true, verbose: true
  end
  install_js_packages js_dependencies.join(" ")
end