From c79d8654bb0417eb97d4d2a3e8398274d9af1cb8 Mon Sep 17 00:00:00 2001 From: Thomas Hutterer <thutterer@gitlab.com> Date: Mon, 5 Sep 2022 18:35:09 +0200 Subject: [PATCH] Upgrade lookbook gem to v1.0 This version contains my fix that disables CSP in development mode. So we can remove the class_eval we had before, and with that, the entire initializer file. Pages are not an experimental feature anymore, and the only remaining config can go into config/development.rb together with the view_component config. --- Gemfile | 2 +- Gemfile.lock | 8 +++++--- config/environments/development.rb | 1 + config/initializers/lookbook.rb | 14 -------------- 4 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 config/initializers/lookbook.rb diff --git a/Gemfile b/Gemfile index 6017dcd909302..cee93bd87a138 100644 --- a/Gemfile +++ b/Gemfile @@ -349,7 +349,7 @@ group :development do gem 'solargraph', '~> 0.46.0', require: false gem 'letter_opener_web', '~> 2.0.0' - gem 'lookbook' + gem 'lookbook', '~> 1.0' # Better errors handler gem 'better_errors', '~> 2.9.1' diff --git a/Gemfile.lock b/Gemfile.lock index 4ba19e79aeac8..a185a19276f80 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -815,9 +815,11 @@ GEM loofah (2.18.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lookbook (0.9.3) + lookbook (1.0.3) actioncable + css_parser htmlbeautifier (~> 1.3) + htmlentities (~> 4.3.4) listen (~> 3.0) railties (>= 5.0) redcarpet (~> 3.5) @@ -1095,7 +1097,7 @@ GEM randexp (0.1.7) rash_alt (0.4.12) hashie (>= 3.4) - rb-fsevent (0.11.1) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rbtrace (0.4.14) @@ -1648,7 +1650,7 @@ DEPENDENCIES lockbox (~> 0.6.2) lograge (~> 0.5) loofah (~> 2.18.0) - lookbook + lookbook (~> 1.0) lru_redux mail (= 2.7.1) mail-smtp_pool (~> 0.1.0)! diff --git a/config/environments/development.rb b/config/environments/development.rb index d475a2a664228..2b40657a7176e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -49,6 +49,7 @@ config.view_component.preview_paths << "#{config.root}/spec/components/previews" # Push preview path now to prevent FrozenError during view_component's initialzer config.autoload_paths.push("#{config.root}/spec/components/previews") + config.lookbook.page_paths = ["#{config.root}/spec/components/docs"] # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. diff --git a/config/initializers/lookbook.rb b/config/initializers/lookbook.rb deleted file mode 100644 index 4cb1b8272865f..0000000000000 --- a/config/initializers/lookbook.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -if Rails.env.development? - # :nocov: Lookbook is only available in development - Lookbook::ApplicationController.class_eval do - content_security_policy false - end - - Rails.application.configure do - config.lookbook.experimental_features = [:pages] - config.lookbook.page_paths = ["#{config.root}/spec/components/docs"] - end - # :nocov: -end -- GitLab