diff --git a/lib/generators/spotlight/assets/generator_common_utilities.rb b/lib/generators/spotlight/assets/generator_common_utilities.rb index 771ef3d79..237a36f3e 100644 --- a/lib/generators/spotlight/assets/generator_common_utilities.rb +++ b/lib/generators/spotlight/assets/generator_common_utilities.rb @@ -31,15 +31,6 @@ def bootstrap_version def bootstrap_yarn_version bootstrap_version.match(/(\d+(\.\d+)*)/)[0] end - - # Yarn link was including so many files (and a circular reference) that Propshaft was having a bad time. - def link_spotlight_frontend - empty_directory 'node_modules/spotlight-frontend' - empty_directory 'node_modules/spotlight-frontend/app' - File.symlink Spotlight::Engine.root.join('package.json'), 'node_modules/spotlight-frontend/package.json' - File.symlink Spotlight::Engine.root.join('vendor'), 'node_modules/spotlight-frontend/vendor' - File.symlink Spotlight::Engine.root.join('app/assets'), 'node_modules/spotlight-frontend/app/assets' - end end end end diff --git a/lib/generators/spotlight/assets/importmap_generator.rb b/lib/generators/spotlight/assets/importmap_generator.rb index 361e7b24c..740f99585 100644 --- a/lib/generators/spotlight/assets/importmap_generator.rb +++ b/lib/generators/spotlight/assets/importmap_generator.rb @@ -36,7 +36,7 @@ def add_frontend if ENV['CI'] run "yarn add file:#{Spotlight::Engine.root}" elsif options[:test] - link_spotlight_frontend + run 'yarn link spotlight-frontend' # If a branch was specified (e.g. you are running a template.rb build # against a test branch), use the latest version available on npm diff --git a/lib/generators/spotlight/assets/propshaft_generator.rb b/lib/generators/spotlight/assets/propshaft_generator.rb index bcb069bf7..198684e20 100644 --- a/lib/generators/spotlight/assets/propshaft_generator.rb +++ b/lib/generators/spotlight/assets/propshaft_generator.rb @@ -46,7 +46,7 @@ def add_frontend if ENV['CI'] run "yarn add file:#{Spotlight::Engine.root}" elsif options[:test] - link_spotlight_frontend + run 'yarn link spotlight-frontend' # If a branch was specified (e.g. you are running a template.rb build # against a test branch), use the latest version available on npm diff --git a/spec/test_app_templates/lib/generators/test_app_generator.rb b/spec/test_app_templates/lib/generators/test_app_generator.rb index 2ffe0add9..ac5708779 100644 --- a/spec/test_app_templates/lib/generators/test_app_generator.rb +++ b/spec/test_app_templates/lib/generators/test_app_generator.rb @@ -27,6 +27,12 @@ def add_gems end end + # This makes the assets available in the test app so that changes made in + # local development can be picked up automatically + def link_frontend + run 'yarn link' + end + def run_blacklight_generator say_status('warning', 'GENERATING BL', :yellow)