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

Clean up duplicated yarn install #238

Merged
merged 2 commits into from
Jan 16, 2023
Merged

Conversation

justin808
Copy link
Member

@justin808 justin808 commented Jan 15, 2023

  1. Redefinition of yarn:install caused yarn to run twice ALWAYS as Rails already does trigger a yarn install
  2. Removed code no longer needed as Rails 5.2 is the oldest version supported.

Closes #237

1. Redefinition of yarn:install caused yarn to run twice ALWAYS as Rails
   already does trigger a yarn install
2. Removed code no longer needed as Rails 5.2 is the oldest version
   supported.
Copy link
Collaborator

@tomdracz tomdracz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for v7 @justin808 ? I didn't add those files, just restored them. We've originally attempted this in https://github.com/shakacode/shakapacker/pull/131/files

But then I've rolled it back as a response to comments in #125

Happy with the changes but definitely breaking change for a major release

@tomdracz
Copy link
Collaborator

But I guess since we're just targeting 5.2 and above it makes sense with the changes that are here. Wondering how long yarn install tak will survive in rails itself though 🤔

Copy link
Contributor

@ahangarha ahangarha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
If we don't need to add a test for it, it can be merged.

@justin808 justin808 merged commit d94ab9d into master Jan 16, 2023
@justin808 justin808 deleted the stop-duplicated-yarn-installs branch January 16, 2023 23:27
@grncdr
Copy link

grncdr commented Feb 6, 2023

It seems like 6.5.6 was never published to Rubygems. Is that intentional?

@ahangarha
Copy link
Contributor

@grncdr Thanks for sharing this.
There were some concerns. It will be released soon.

@grncdr
Copy link

grncdr commented Feb 8, 2023

No problem, I've found a different workaround for my CI, so I'm fine to wait/use a 7.0 beta whenever that's available.

@januszm
Copy link

januszm commented May 11, 2023

this change breaks the CI pipeline in one of my apps that I upgraded from webpacker to shakapacker (Rails 5 => Rails 7). Why is it considered redundant? I don't have a separate yarn install step in my CI pipeline because until now assets:precompile was triggering it. After upgrading shakapacker from 6.5.4 it stopped working.

So, Rails does not provide this trigger and it was always coming from webpacker/shakapacker.

jsbundling-rails gem supports this by enhancing assets:precompile

if Rake::Task.task_defined?("assets:precompile")
  Rake::Task["assets:precompile"].enhance(["javascript:build"])
end

and as I mentioned, in many cases, e.g. on the AWS Elastic Beanstalk platform this is the desired behaviour. EB invokes assets:precompile automatically for Rails projects, but it won't call yarn install so now the deployments fail with this change in shakapacker (there are workarounds but they should not be necessary)

@januszm
Copy link

januszm commented May 11, 2023

Honestly, I think this feature should stay (as jsbundling-rails, a solution "competitive/alternative" to shakapacker provides this), but should be controlled with the config option that was present before (webpacker_compile ...), set to false by default

@ahangarha
Copy link
Contributor

ahangarha commented May 12, 2023

@januszm Is your problem similar to this issue?

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.

Clean up multiple runs of Yarn install
5 participants