Skip to content

Commit

Permalink
Do not generate the application with a jquery dependency
Browse files Browse the repository at this point in the history
We don't use jquery, so there's no need to require it
  • Loading branch information
jcoyne committed Oct 11, 2022
1 parent 76b8425 commit 8e61fd7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions lib/generators/blacklight/assets_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,15 @@ def assets # rubocop:disable Metrics/MethodLength
<<~CONTENT
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.6/dist/umd/popper.min.js"
pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@5.2.2/dist/js/bootstrap.js"
pin "jquery", to: "https://ga.jspm.io/npm:jquery@3.6.1/dist/jquery.js"
pin "blacklight", to: "blacklight/blacklight.js"
pin "dialog-polyfill", to: "https://ga.jspm.io/npm:dialog-polyfill@0.5.6/dist/dialog-polyfill.js"
CONTENT
end

append_to_file 'app/javascript/application.js' do
<<~CONTENT
import $ from "jquery"
import bootstrap from "bootstrap"
window.bootstrap = bootstrap // Required for Blacklight 7 so it can manage the modals
window.$ = $ // required as long as blacklight requires jquery
import "blacklight"
import dialogPolyfill from "dialog-polyfill"
Blacklight.onLoad(() => {
Expand All @@ -55,12 +52,10 @@ def assets # rubocop:disable Metrics/MethodLength
CONTENT
end
else
gem 'jquery-rails'
create_file 'app/assets/javascripts/application.js' do
<<~CONTENT
//= require turbolinks
//= require rails-ujs
//= require jquery3
// Required by Blacklight
//= require popper
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"not IE 11"
],
"dependencies": {
"bootstrap": ">=4.3.1 <6.0.0",
"jquery": "^3.5.1"
"bootstrap": ">=4.3.1 <6.0.0"
}
}
1 change: 0 additions & 1 deletion spec/controllers/bookmarks_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
end
end

# jquery 1.9 ajax does error callback if 200 returns empty body. so use 204 instead.
describe "update" do
it "has a 200 status code when creating a new one" do
put :update, xhr: true, params: { id: '2007020969', format: :js }
Expand Down

0 comments on commit 8e61fd7

Please sign in to comment.