Skip to content

Commit b29e5fe

Browse files
authored
Support environment variable to skip Yarn install (#150)
Closes #130
1 parent fa4b346 commit b29e5fe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/tasks/jsbundling/build.rake

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
namespace :javascript do
2+
desc "Install JavaScript dependencies"
3+
task :install do
4+
unless system "yarn install"
5+
raise "jsbundling-rails: Command install failed, ensure yarn is installed"
6+
end
7+
end
8+
29
desc "Build your JavaScript bundle"
3-
task :build do
4-
unless system "yarn install && yarn build"
5-
raise "jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors"
10+
build_task = task :build do
11+
unless system "yarn build"
12+
raise "jsbundling-rails: Command build failed, ensure `yarn build` runs without errors"
613
end
714
end
15+
build_task.prereqs << :install unless ENV["SKIP_YARN_INSTALL"]
816
end
917

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

0 commit comments

Comments
 (0)