diff --git a/.changeset/stupid-ties-try.md b/.changeset/stupid-ties-try.md new file mode 100644 index 0000000000..df8a6af096 --- /dev/null +++ b/.changeset/stupid-ties-try.md @@ -0,0 +1,5 @@ +--- +"@primer/view-components": patch +--- + +Move lookbook previews from the lookbook folder to the main project diff --git a/component_generator.thor b/component_generator.thor index e634ed9a94..64e23dd539 100644 --- a/component_generator.thor +++ b/component_generator.thor @@ -41,7 +41,7 @@ class ComponentGenerator < Thor::Group end def create_preview - template("templates/preview.tt", "lookbook/test/components/previews/#{status_path}#{underscore_name}_preview.rb") + template("templates/preview.tt", "test/components/previews/#{status_path}#{underscore_name}_preview.rb") end def add_to_docs_rakefile diff --git a/lookbook/config/environments/development.rb b/lookbook/config/environments/development.rb index a64a543bb9..5d6efae179 100644 --- a/lookbook/config/environments/development.rb +++ b/lookbook/config/environments/development.rb @@ -63,6 +63,8 @@ # Suppress logger output for asset requests. config.assets.quiet = true + config.view_component.preview_paths << Rails.root.join("../test/components/previews") + # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/lookbook/config/environments/production.rb b/lookbook/config/environments/production.rb index 1a01fd0d4b..5911f73e3e 100644 --- a/lookbook/config/environments/production.rb +++ b/lookbook/config/environments/production.rb @@ -92,4 +92,6 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + config.view_component.preview_paths << Rails.root.join("../test/components/previews") end diff --git a/lookbook/config/environments/test.rb b/lookbook/config/environments/test.rb deleted file mode 100644 index 28504a9e3e..0000000000 --- a/lookbook/config/environments/test.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/integer/time" - -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! - -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # Turn false under Spring and add config.action_view.cache_template_loading = true. - config.cache_classes = true - - # Eager loading loads your whole application. When running a single test locally, - # this probably isn't necessary. It's a good idea to do in a continuous integration - # system, or in some way before deploying your code. - config.eager_load = ENV["CI"].present? - - # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.enabled = true - config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{1.hour.to_i}" - } - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - config.cache_store = :null_store - - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment. - config.action_controller.allow_forgery_protection = false - - # Store uploaded files on the local file system in a temporary directory. - config.active_storage.service = :test - - config.action_mailer.perform_caching = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr - - # Raise exceptions for disallowed deprecations. - config.active_support.disallowed_deprecation = :raise - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - - # Raises error for missing translations. - # config.i18n.raise_on_missing_translations = true - - # Annotate rendered view with file names. - # config.action_view.annotate_rendered_view_with_filenames = true -end diff --git a/lookbook/test/application_system_test_case.rb b/lookbook/test/application_system_test_case.rb deleted file mode 100644 index c05709aff8..0000000000 --- a/lookbook/test/application_system_test_case.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] -end diff --git a/lookbook/test/test_helper.rb b/lookbook/test/test_helper.rb deleted file mode 100644 index a64c49d493..0000000000 --- a/lookbook/test/test_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -ENV["RAILS_ENV"] ||= "test" -require_relative "../config/environment" -require "rails/test_help" - -module ActiveSupport - class TestCase - # Run tests in parallel with specified workers - parallelize(workers: :number_of_processors) - - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... - end -end diff --git a/lookbook/test/components/previews/alpha/tab_panels_preview.rb b/test/components/previews/alpha/tab_panels_preview.rb similarity index 100% rename from lookbook/test/components/previews/alpha/tab_panels_preview.rb rename to test/components/previews/alpha/tab_panels_preview.rb diff --git a/lookbook/test/components/previews/alpha/tooltip_preview.rb b/test/components/previews/alpha/tooltip_preview.rb similarity index 100% rename from lookbook/test/components/previews/alpha/tooltip_preview.rb rename to test/components/previews/alpha/tooltip_preview.rb diff --git a/lookbook/test/components/previews/alpha/underline_panels_preview.rb b/test/components/previews/alpha/underline_panels_preview.rb similarity index 100% rename from lookbook/test/components/previews/alpha/underline_panels_preview.rb rename to test/components/previews/alpha/underline_panels_preview.rb diff --git a/lookbook/test/components/previews/beta/auto_complete_preview.rb b/test/components/previews/beta/auto_complete_preview.rb similarity index 100% rename from lookbook/test/components/previews/beta/auto_complete_preview.rb rename to test/components/previews/beta/auto_complete_preview.rb diff --git a/lookbook/test/components/previews/beta/avatar_stack_preview.rb b/test/components/previews/beta/avatar_stack_preview.rb similarity index 100% rename from lookbook/test/components/previews/beta/avatar_stack_preview.rb rename to test/components/previews/beta/avatar_stack_preview.rb diff --git a/lookbook/test/components/previews/beta/flash_preview.rb b/test/components/previews/beta/flash_preview.rb similarity index 100% rename from lookbook/test/components/previews/beta/flash_preview.rb rename to test/components/previews/beta/flash_preview.rb diff --git a/lookbook/test/components/previews/counter_component_preview.rb b/test/components/previews/counter_component_preview.rb similarity index 100% rename from lookbook/test/components/previews/counter_component_preview.rb rename to test/components/previews/counter_component_preview.rb diff --git a/lookbook/test/components/previews/local_time_preview.rb b/test/components/previews/local_time_preview.rb similarity index 100% rename from lookbook/test/components/previews/local_time_preview.rb rename to test/components/previews/local_time_preview.rb diff --git a/lookbook/test/components/previews/time_ago_component_preview.rb b/test/components/previews/time_ago_component_preview.rb similarity index 100% rename from lookbook/test/components/previews/time_ago_component_preview.rb rename to test/components/previews/time_ago_component_preview.rb