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 end
if EMBER_CLI && !(ENV["EMBER_CLI_COMPILE_DONE"] == "1") if EMBER_CLI && !(ENV["EMBER_CLI_COMPILE_DONE"] == "1")
# Using exec to free up Rails app memory during ember build compile_command = "NODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod"
exec <<~SH only_assets_precompile_remaining = (ARGV.last == "assets:precompile")
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 if only_assets_precompile_remaining
SH # 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 end
# Ensure we ALWAYS do a clean build # Ensure we ALWAYS do a clean build