Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add turbo-rails #214

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
google: "writable",
gtag: "writable",
SETTINGS: "writable",
Turbolinks: "writable",
Turbo: "writable",
},
parser: "@typescript-eslint/parser",
parserOptions: {
Expand Down
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ gem 'sass-rails'
# Automatically add vendor prefixes to CSS rules
gem 'autoprefixer-rails'

# Turbolinks makes navigating your web application faster.
# Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Improves app performance by using Hotwire
gem 'turbo-rails', '~> 1.1.1'

# Application monitoring
gem 'newrelic_rpm'
Expand Down Expand Up @@ -131,3 +130,6 @@ group :test do
gem 'webdrivers'
gem 'webmock'
end

# Use Redis for Action Cable
gem 'redis', '~> 4.0'
13 changes: 9 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ GEM
thor (1.2.1)
tilt (2.0.10)
timeout (0.2.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
turbo-rails (1.1.1)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
Expand Down Expand Up @@ -423,6 +424,7 @@ DEPENDENCIES
rack-timeout
rails (~> 7)
react-rails
redis (~> 4.0)
rspec-rails
rspec_junit_formatter
rubocop
Expand All @@ -438,7 +440,10 @@ DEPENDENCIES
shoulda-matchers
sidekiq
simplecov
turbolinks (~> 5)
spring
spring-commands-rspec
spring-watcher-listen (~> 2.0.0)
turbo-rails (~> 1.1.1)
web-console (>= 3.3.0)
webdrivers
webmock
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require turbolinks
//= require jquery/dist/jquery
//= require jquery-ujs/src/rails
//= require popper.js/dist/umd/popper
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/google_analytics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(document).on("turbolinks:load", () => {
$(document).on("turbo:load", () => {
if (
typeof gtag === "function" &&
typeof SETTINGS.google_analytics_id !== "undefined"
Expand Down
1 change: 1 addition & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Sentry from "@sentry/browser";
import "@hotwired/turbo-rails";

// Support component names relative to this directory:
const componentRequireContext = require.context("views", true);
Expand Down
6 changes: 3 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<title><%= yield(:page_title).presence || t('app.default_title') %></title>

<%= render partial: 'layouts/js_setup' %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'application', media: 'all'%>
<%= render partial: 'layouts/google_analytics' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_packs_with_chunks_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application'%>
<%= javascript_packs_with_chunks_tag 'application' %>

<%= csrf_meta_tags %>
<%= render partial: 'layouts/favicon' %>
Expand Down
3 changes: 2 additions & 1 deletion config/cable.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
development:
adapter: async
adapter: redis
url: redis://localhost:6379/1

test:
adapter: test
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@hotwired/turbo-rails": "^7.1.3",
"@rails/webpacker": "^4.0.7",
"@sentry/browser": "^5.11.0",
"@testing-library/react-hooks": "^3.2.1",
Expand Down
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,19 @@
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==

"@hotwired/turbo-rails@^7.1.3":
version "7.1.3"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.1.3.tgz#a4e04ecb800a06e7f9aa6e298170fa4580b74216"
integrity sha512-6qKgn75bMWKx0bJgmSfrdC73EJkGLoSWZPAssvcd3nE7ZpDZff6f67j5OQNjjpRgNB7OFruom6VWguGQGu1fQg==
dependencies:
"@hotwired/turbo" "^7.1.0"
"@rails/actioncable" "^7.0"

"@hotwired/turbo@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.1.0.tgz#27e44e0e3dc5bd1d4bda0766d579cf5a14091cd7"
integrity sha512-Q8kGjqwPqER+CtpQudbH+3Zgs2X4zb6pBAlr6NsKTXadg45pAOvxI9i4QpuHbwSzR2+x87HUm+rot9F/Pe8rxA==

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
Expand Down Expand Up @@ -1246,6 +1259,11 @@
dependencies:
prettier ">=1.10"

"@rails/actioncable@^7.0":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.0.3.tgz#71f08e958883af64f6a20489318b5e95d2c6dc5b"
integrity sha512-Iefl21FZD+ck1di6xSHMYzSzRiNJTHV4NrAzCfDfqc/wPz4xncrP8f2/fJ+2jzwKIaDn76UVMsALh7R5OzsF8Q==

"@rails/webpacker@^4.0.7":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@rails/webpacker/-/webpacker-4.3.0.tgz#3793b3aed08ed0b661f1bed9de0739abacb6a834"
Expand Down