Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to add to Alchemy's importmap from Rails application #2884

Merged
merged 1 commit into from
May 23, 2024

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented May 22, 2024

What is this pull request for?

Rails applications are technically engines, but not really. For example the engine_name is the config/application.rb modularized class name. Which makes it not nice for this interface from an app developers perspective.

Let's make the interface more explicit by using a options hash with readable keys.

Example

Rails.application.config.before_initialize do
  Alchemy.admin_importmaps.add({
    importmap_path: Rails.application.root.join("config/alchemy/importmap.rb"),
    source_paths: [
      Rails.application.root.join("app/javascript/components/product_select.js")
    ],
    name: "product_select"
  })
end

Notable changes

Previously introduced Alchemy.engine_importmaps gets renamed into Alchemy.admin_importmaps

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen added this to the 7.2 milestone May 22, 2024
@tvdeyen tvdeyen requested a review from a team as a code owner May 22, 2024 17:35
@tvdeyen tvdeyen changed the title Allow to add to Alchemys importmap from Rails application Allow to add to Alchemy's importmap from Rails application May 22, 2024
tvdeyen added a commit to AlchemyCMS/alchemy-solidus that referenced this pull request May 22, 2024
We need this PR

AlchemyCMS/alchemy_cms#2884

for now to be able to use the `Alchemy.importmap`
for the `alchemy-product-select`.
Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.95%. Comparing base (a1e0391) to head (4e6f189).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2884      +/-   ##
==========================================
+ Coverage   95.94%   95.95%   +0.01%     
==========================================
  Files         230      230              
  Lines        6260     6258       -2     
==========================================
- Hits         6006     6005       -1     
+ Misses        254      253       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tvdeyen added a commit to AlchemyCMS/alchemy-solidus that referenced this pull request May 22, 2024
We need this PR

AlchemyCMS/alchemy_cms#2884

for now to be able to use the `Alchemy.importmap`
for the `alchemy-product-select`.
Rails applications are technically engines, but not really. For example
the `engine_name` is the `config/application.rb` modularized class
name. Which makes it not nice for this interface from an app developers
perspective.

Let's make the interface more explicit by using a options hash with readable keys.

    Rails.application.config.before_initialize do
      Alchemy.admin_importmaps.add({
        importmap_path: Rails.application.root.join("config/alchemy/importmap.rb"),
        source_paths: [
          Rails.application.root.join("app/javascript/components/product_select.js")
        ],
        name: "product_select"
      })
    end
@tvdeyen tvdeyen enabled auto-merge May 22, 2024 20:17
@tvdeyen tvdeyen disabled auto-merge May 22, 2024 20:17
tvdeyen added a commit to AlchemyCMS/alchemy-solidus that referenced this pull request May 23, 2024
We need this PR

AlchemyCMS/alchemy_cms#2884

for now to be able to use the `Alchemy.importmap`
for the `alchemy-product-select`.
@tvdeyen tvdeyen merged commit f4bbbd4 into main May 23, 2024
36 checks passed
@tvdeyen tvdeyen deleted the admin_importmaps branch May 23, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants