Skip to content

Support environment variable to skip Yarn install #150

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

Merged
merged 1 commit into from
Jun 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/tasks/jsbundling/build.rake
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
namespace :javascript do
desc "Install JavaScript dependencies"
task :install do
unless system "yarn install"
raise "jsbundling-rails: Command install failed, ensure yarn is installed"
end
end

desc "Build your JavaScript bundle"
task :build do
unless system "yarn install && yarn build"
raise "jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors"
build_task = task :build do
unless system "yarn build"
raise "jsbundling-rails: Command build failed, ensure `yarn build` runs without errors"
end
end
build_task.prereqs << :install unless ENV["SKIP_YARN_INSTALL"]
end

if Rake::Task.task_defined?("assets:precompile")
Expand Down