DEV: Use yarn-installed terser in assets.rake (#28422)

This was previously relying on a globally-installed terser, which comes from a time before Discourse had proper JS dependency management
This commit is contained in:
David Taylor 2024-08-19 16:45:15 +01:00 committed by GitHub
parent 3f5b0dc98d
commit 02678b3107
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -57,7 +57,7 @@ task "assets:precompile:before": %w[
# is recompiled
Emoji.clear_cache
$node_compress = `which terser`.present? && !ENV["SKIP_NODE_UGLIFY"]
$node_compress = !ENV["SKIP_NODE_UGLIFY"]
unless ENV["USE_SPROCKETS_UGLIFY"]
$bypass_sprockets_uglify = true
@ -158,7 +158,7 @@ def compress_node(from, to)
base_source_map = assets_path + assets_additional_path
cmd = <<~SH
terser '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}',includeSources=true"
yarn terser '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}',includeSources=true"
SH
STDERR.puts cmd

View File

@ -35,6 +35,7 @@
"prettier": "^2.8.8",
"puppeteer-core": "^23.1.0",
"squoosh": "discourse/squoosh#dc9649d",
"terser": "^5.31.6",
"typescript": "^5.5.4"
},
"scripts": {