From 5b436f3326f517d72b83e0739cafee4243cbbae8 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 10 Oct 2025 08:59:36 +0200 Subject: [PATCH 1/8] Update to Alchemy 8.0 --- .github/workflows/test.yml | 9 ++------- Gemfile | 5 ++--- alchemy-solidus.gemspec | 2 +- config/initializers/alchemy.rb | 2 +- lib/alchemy/solidus/engine.rb | 2 +- spec/features/alchemy/link_overlay_spec.rb | 4 ++-- .../alchemy/ingredients/spree_product_editor_spec.rb | 4 ++-- .../views/alchemy/ingredients/spree_taxon_editor_spec.rb | 4 ++-- .../alchemy/ingredients/spree_variant_editor_spec.rb | 4 ++-- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3604d72a..2c9b2fa8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,17 +17,12 @@ jobs: fail-fast: false matrix: ruby-version: - - "3.1" - "3.2" - "3.3" + - "3.4" alchemy: - - "7.2-stable" - - "7.3-stable" - - "7.4-stable" + - "8.0-stable" solidus: - - "v4.1" - - "v4.2" - - "v4.3" - "v4.4" env: ALCHEMY_BRANCH: ${{ matrix.alchemy }} diff --git a/Gemfile b/Gemfile index 8e906387..299d4e7e 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,9 @@ gem "solidus_core", github: "solidusio/solidus", branch: solidus_branch gem "solidus_backend", github: "solidusio/solidus", branch: solidus_branch gem "solidus_frontend", github: "solidusio/solidus_frontend", branch: "main" -alchemy_branch = ENV.fetch("ALCHEMY_BRANCH", "7.4-stable") +alchemy_branch = ENV.fetch("ALCHEMY_BRANCH", "8.0-stable") gem "alchemy_cms", github: "AlchemyCMS/alchemy_cms", branch: alchemy_branch - -gem "alchemy-devise", github: "AlchemyCMS/alchemy-devise", branch: "7.4-stable" +gem "alchemy-devise", github: "AlchemyCMS/alchemy-devise", branch: alchemy_branch # Specify your gem's dependencies in alchemy-solidus.gemspec gemspec diff --git a/alchemy-solidus.gemspec b/alchemy-solidus.gemspec index 9fe734a8..15582410 100644 --- a/alchemy-solidus.gemspec +++ b/alchemy-solidus.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |gem| gem.require_paths = ["lib"] gem.version = Alchemy::Solidus::VERSION - gem.add_dependency("alchemy_cms", [">= 7.2.0", "< 8"]) + gem.add_dependency("alchemy_cms", [">= 7.2.0", "< 9"]) gem.add_dependency("solidus_core", [">= 4.0.0", "< 5"]) gem.add_dependency("solidus_backend", [">= 4.0.0", "< 5"]) gem.add_dependency("solidus_support", [">= 0.14.0", "< 1"]) diff --git a/config/initializers/alchemy.rb b/config/initializers/alchemy.rb index 1619fab9..1f5cbded 100644 --- a/config/initializers/alchemy.rb +++ b/config/initializers/alchemy.rb @@ -47,5 +47,5 @@ Rails.application.config.after_initialize do Alchemy::Modules.register_module(alchemy_module) - Alchemy.link_dialog_tabs.add(Alchemy::Admin::LinkDialog::ProductTab) + Alchemy.config.link_dialog_tabs.add("Alchemy::Admin::LinkDialog::ProductTab") end diff --git a/lib/alchemy/solidus/engine.rb b/lib/alchemy/solidus/engine.rb index 075f2186..6cefa9b4 100644 --- a/lib/alchemy/solidus/engine.rb +++ b/lib/alchemy/solidus/engine.rb @@ -17,7 +17,7 @@ class Engine < ::Rails::Engine engine_name "alchemy_solidus" initializer "alchemy_solidus.assets", before: "alchemy.importmap" do |app| - Alchemy.admin_importmaps.add({ + Alchemy.config.admin_importmaps.add({ importmap_path: root.join("config/importmap.rb"), source_paths: [ root.join("app/javascript") diff --git a/spec/features/alchemy/link_overlay_spec.rb b/spec/features/alchemy/link_overlay_spec.rb index 6378bdbb..3faabd17 100644 --- a/spec/features/alchemy/link_overlay_spec.rb +++ b/spec/features/alchemy/link_overlay_spec.rb @@ -26,12 +26,12 @@ authorize_user admin_user allow(element).to receive(:definition) do - { + Alchemy::ElementDefinition.new( name: "article", ingredients: [ {role: "headline", type: "Text", settings: {linkable: true}} ] - } + ) end element.save! diff --git a/spec/views/alchemy/ingredients/spree_product_editor_spec.rb b/spec/views/alchemy/ingredients/spree_product_editor_spec.rb index 39c6ce11..79adcfc4 100644 --- a/spec/views/alchemy/ingredients/spree_product_editor_spec.rb +++ b/spec/views/alchemy/ingredients/spree_product_editor_spec.rb @@ -9,7 +9,7 @@ before do allow(element).to receive(:definition) do - { + Alchemy::ElementDefinition.new( name: "all_you_can_eat", ingredients: [ {role: "product", @@ -19,7 +19,7 @@ {role: "taxon", type: "SpreeTaxon"} ] - } + ) end allow(element_editor).to receive(:ingredients) { [Alchemy::IngredientEditor.new(ingredient)] } diff --git a/spec/views/alchemy/ingredients/spree_taxon_editor_spec.rb b/spec/views/alchemy/ingredients/spree_taxon_editor_spec.rb index bfdaa0b2..5703a5f5 100644 --- a/spec/views/alchemy/ingredients/spree_taxon_editor_spec.rb +++ b/spec/views/alchemy/ingredients/spree_taxon_editor_spec.rb @@ -9,7 +9,7 @@ before do allow(element).to receive(:definition) do - { + Alchemy::ElementDefinition.new( name: "all_you_can_eat", ingredients: [ {role: "product", @@ -19,7 +19,7 @@ {role: "taxon", type: "SpreeTaxon"} ] - } + ) end allow(element_editor).to receive(:ingredients) { [Alchemy::IngredientEditor.new(ingredient)] } diff --git a/spec/views/alchemy/ingredients/spree_variant_editor_spec.rb b/spec/views/alchemy/ingredients/spree_variant_editor_spec.rb index 58765977..04d4960c 100644 --- a/spec/views/alchemy/ingredients/spree_variant_editor_spec.rb +++ b/spec/views/alchemy/ingredients/spree_variant_editor_spec.rb @@ -9,7 +9,7 @@ before do allow(element).to receive(:definition) do - { + Alchemy::ElementDefinition.new( name: "all_you_can_eat", ingredients: [ {role: "product", @@ -19,7 +19,7 @@ {role: "taxon", type: "SpreeTaxon"} ] - } + ) end allow(element_editor).to receive(:ingredients) { [Alchemy::IngredientEditor.new(ingredient)] } From 71441c002129c080848300460d77ec816ef25ded Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 9 Oct 2025 15:19:32 +0200 Subject: [PATCH 2/8] Add solidus_api to dependencies We fetch products from it in the alchemy-product-select --- alchemy-solidus.gemspec | 1 + lib/alchemy/solidus/engine.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/alchemy-solidus.gemspec b/alchemy-solidus.gemspec index 15582410..fa00c78b 100644 --- a/alchemy-solidus.gemspec +++ b/alchemy-solidus.gemspec @@ -15,6 +15,7 @@ Gem::Specification.new do |gem| gem.version = Alchemy::Solidus::VERSION gem.add_dependency("alchemy_cms", [">= 7.2.0", "< 9"]) + gem.add_dependency("solidus_api", [">= 4.0.0", "< 5"]) gem.add_dependency("solidus_core", [">= 4.0.0", "< 5"]) gem.add_dependency("solidus_backend", [">= 4.0.0", "< 5"]) gem.add_dependency("solidus_support", [">= 0.14.0", "< 1"]) diff --git a/lib/alchemy/solidus/engine.rb b/lib/alchemy/solidus/engine.rb index 6cefa9b4..fb6218d8 100644 --- a/lib/alchemy/solidus/engine.rb +++ b/lib/alchemy/solidus/engine.rb @@ -1,5 +1,6 @@ require "alchemy_cms" require "alchemy/version" +require "solidus_api" require "solidus_core" require "solidus_backend" require "solidus_support" From e03e993a768ea97dcd6043c267d20d0b3c8151ab Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 9 Oct 2025 21:00:37 +0200 Subject: [PATCH 3/8] rspec-rails 8.0 The version for rails 7.2 and 8.0 --- alchemy-solidus.gemspec | 2 +- spec/rails_helper.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/alchemy-solidus.gemspec b/alchemy-solidus.gemspec index fa00c78b..e022bcd6 100644 --- a/alchemy-solidus.gemspec +++ b/alchemy-solidus.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |gem| gem.add_dependency("solidus_support", [">= 0.14.0", "< 1"]) gem.add_dependency("deface", ["~> 1.0"]) - gem.add_development_dependency("rspec-rails", ["~> 6.0"]) + gem.add_development_dependency("rspec-rails", ["~> 8.0"]) gem.add_development_dependency("shoulda-matchers", ["~> 4.0"]) gem.add_development_dependency("capybara", ["~> 3.0"]) gem.add_development_dependency("capybara-screenshot", ["~> 1.0"]) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index caa96607..ffb559b9 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -75,8 +75,6 @@ Capybara.server = :puma, {Silent: true} RSpec.configure do |config| - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" config.include Alchemy::TestSupport::IntegrationHelpers, type: :feature config.include Alchemy::TestSupport::CapybaraHelpers, type: :feature config.include ActiveSupport::Testing::TimeHelpers, type: :model From 40f3303bfc513f10c3b862eae6ae618a6d6da73f Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 9 Oct 2025 21:01:18 +0200 Subject: [PATCH 4/8] Use sqlite3 2.7 locally This is the version for Rails 7.2 and 8.0 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 299d4e7e..35dee63c 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem "alchemy-devise", github: "AlchemyCMS/alchemy-devise", branch: alchemy_branc # Specify your gem's dependencies in alchemy-solidus.gemspec gemspec -gem "sqlite3", "~> 1.4" +gem "sqlite3", "~> 2.7" gem "pry-rails" gem "sprockets", "~> 4.0" gem "jsbundling-rails", "~> 1.1" From d5f7cde603f43d1723f76dd0cee66c349f906cd0 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 9 Oct 2025 21:02:12 +0200 Subject: [PATCH 5/8] Add ruby-lsp-rspec Convinience for Ruby LSP users --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index 35dee63c..27651174 100644 --- a/Gemfile +++ b/Gemfile @@ -35,3 +35,5 @@ group :lint do gem "rubocop", require: false gem "standard", "~> 1.25", require: false end + +gem "ruby-lsp-rspec", "~> 0.1.28" From d32511e0fb445d365f1ce91bff7cca52a3ab7d70 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 9 Oct 2025 21:12:10 +0200 Subject: [PATCH 6/8] chore: fix syntax --- lib/alchemy/solidus/engine.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/alchemy/solidus/engine.rb b/lib/alchemy/solidus/engine.rb index fb6218d8..76c2812d 100644 --- a/lib/alchemy/solidus/engine.rb +++ b/lib/alchemy/solidus/engine.rb @@ -15,6 +15,7 @@ module Alchemy module Solidus class Engine < ::Rails::Engine include SolidusSupport::EngineExtensions + engine_name "alchemy_solidus" initializer "alchemy_solidus.assets", before: "alchemy.importmap" do |app| From 42a3b6d2728f19aa312fbc8cf18c6b1ebdeb32a4 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 9 Oct 2025 21:17:34 +0200 Subject: [PATCH 7/8] test: Skip Solidus migrations check This is cluttering the test logs. --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c9b2fa8..be1ef061 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,7 @@ jobs: env: ALCHEMY_BRANCH: ${{ matrix.alchemy }} SOLIDUS_BRANCH: ${{ matrix.solidus }} + SOLIDUS_SKIP_MIGRATIONS_CHECK: true steps: - uses: actions/checkout@v4 - name: Set up Ruby From 622e9e8c98838531a052172e567e83a9ded23b55 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Tue, 14 Oct 2025 15:46:10 +0200 Subject: [PATCH 8/8] Add `spree.js` to alchemy_solidus.js bundle We need `Spree.mountedAt` in the product select, and with the move to importmaps we've lost the ability to add stuff successfully to `vendor/assets/alchemy/admin/all.js`. This does the same thing, just a little bit hacky. --- app/assets/config/alchemy_solidus/manifest.js | 1 + app/assets/javascripts/alchemy/solidus/admin.js | 1 - app/javascript/alchemy_solidus.js | 1 + config/importmap.rb | 1 + lib/generators/alchemy/solidus/install/install_generator.rb | 5 ----- 5 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 app/assets/javascripts/alchemy/solidus/admin.js diff --git a/app/assets/config/alchemy_solidus/manifest.js b/app/assets/config/alchemy_solidus/manifest.js index 00cfa018..6d70eb23 100644 --- a/app/assets/config/alchemy_solidus/manifest.js +++ b/app/assets/config/alchemy_solidus/manifest.js @@ -1 +1,2 @@ //= link_tree ../../../javascript .js +//= link spree.js diff --git a/app/assets/javascripts/alchemy/solidus/admin.js b/app/assets/javascripts/alchemy/solidus/admin.js deleted file mode 100644 index 52e9ebc1..00000000 --- a/app/assets/javascripts/alchemy/solidus/admin.js +++ /dev/null @@ -1 +0,0 @@ -//= require spree diff --git a/app/javascript/alchemy_solidus.js b/app/javascript/alchemy_solidus.js index a4a46100..ad35541b 100644 --- a/app/javascript/alchemy_solidus.js +++ b/app/javascript/alchemy_solidus.js @@ -1,3 +1,4 @@ +import "spree" import "alchemy_solidus/components/product_select" import "alchemy_solidus/components/taxon_select" import "alchemy_solidus/components/variant_select" diff --git a/config/importmap.rb b/config/importmap.rb index f70e9a73..000e22e0 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,3 +1,4 @@ Alchemy.importmap.pin "alchemy_solidus", to: "alchemy_solidus.js", preload: true Alchemy.importmap.pin_all_from Alchemy::Solidus::Engine.root.join("app/javascript/alchemy_solidus"), under: "alchemy_solidus", preload: true +Alchemy.importmap.pin "spree", to: "spree.js", preload: true diff --git a/lib/generators/alchemy/solidus/install/install_generator.rb b/lib/generators/alchemy/solidus/install/install_generator.rb index 946e1598..a3734e4b 100644 --- a/lib/generators/alchemy/solidus/install/install_generator.rb +++ b/lib/generators/alchemy/solidus/install/install_generator.rb @@ -149,11 +149,6 @@ def set_root_route end end - def append_assets - append_file "vendor/assets/javascripts/alchemy/admin/all.js", - "//= require alchemy/solidus/admin.js" - end - private def alchemy_devise_present?