FIX: Skip ember-cli build memory optimisation for multiple rake tasks (#16198)

This commit is contained in:
David Taylor 2022-03-16 12:02:21 +00:00 committed by GitHub
parent 30a5c01f11
commit c58c2f53e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -14,11 +14,15 @@ task 'assets:precompile:before' do
end
if EMBER_CLI && !(ENV["EMBER_CLI_COMPILE_DONE"] == "1")
# Using exec to free up Rails app memory during ember build
exec <<~SH
NODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod && \
EMBER_CLI_COMPILE_DONE=1 bin/rake assets:precompile
SH
compile_command = "NODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod"
only_assets_precompile_remaining = (ARGV.last == "assets:precompile")
if only_assets_precompile_remaining
# Using exec to free up Rails app memory during ember build
exec "#{compile_command} && EMBER_CLI_COMPILE_DONE=1 bin/rake assets:precompile"
else
system compile_command
end
end
# Ensure we ALWAYS do a clean build