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

Add support for the Bun package manager #121

Merged
merged 3 commits into from
Aug 24, 2024
Merged

Add support for the Bun package manager #121

merged 3 commits into from
Aug 24, 2024

Conversation

raybrownco
Copy link

My team and I recently started using Bun instead of Yarn/NPM to manage JavaScript packages. The switch was quite painless, but our deploy to Heroku failed with the following error:

ActionView::Template::Error: Couldn't find the MJML 4. binary.. have you run $ npm install mjml? 

11  # @param input [String] The string to transform in html
12  def initialize(input)
13    raise Mjml.mjml_binary_error_string unless Mjml.valid_mjml_binary
14
15    @input = input

After some digging, I realized that we specifically check for MJML in each given package manager:

  def self.valid_mjml_binary
    self.valid_mjml_binary = @@valid_mjml_binary ||
                             check_for_custom_mjml_binary ||
                             check_for_yarn_mjml_binary ||
                             check_for_npm_mjml_binary ||
                             check_for_global_mjml_binary ||
                             check_for_mrml_binary

    return @@valid_mjml_binary if @@valid_mjml_binary

    puts Mjml.mjml_binary_error_string
  end

This PR adds a method to check for the Bun MJML binary.

@raybrownco
Copy link
Author

Hmm. Just a few notes:

  1. I'm in the process of testing this locally, so I wouldn't say it's completely ready for review yet.
  2. I see that adding the method to check for Bun has pushed the file over its line length limit. I'll try to abstract the methods related to finding the MJML binary into a utility module and then push my updates up here.

@raybrownco
Copy link
Author

@sighmon This one's ready for review!

@sighmon
Copy link
Owner

sighmon commented Aug 24, 2024

@raybrownco Sorry for the delay - I'm on holiday in Turkey.

Thanks for the updates, I'll get a release ready shortly.

@sighmon sighmon merged commit 93ecf8a into sighmon:master Aug 24, 2024
16 checks passed
@raybrownco raybrownco deleted the rb-add-bun-support branch August 26, 2024 15:12
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