Update the warning message when wasm-opt fails

Suggest to install binaryen if wasm-opt is not installed
This commit is contained in:
Yuta Saito 2024-03-09 11:59:26 +00:00
parent 7afcf00626
commit 21b37376d1
1 changed files with 8 additions and 2 deletions

View File

@ -110,9 +110,15 @@ struct Bundle: AsyncParsableCommand {
try await optimize(mainWasmPath, outputPath: wasmOutputFilePath, terminal: terminal)
} catch {
terminal.write(
"Warning: wasm-opt failed to optimize the binary, falling back to the original binary\n",
"""
Warning: wasm-opt failed to optimize the binary, falling back to the original binary.
If you don't have wasm-opt installed, you can install wasm-opt by running `brew install binaryen`, `apt-get install binaryen` or `npm install -g binaryen`
""",
inColor: .yellow)
try localFileSystem.move(from: mainWasmPath, to: wasmOutputFilePath)
if mainWasmPath != wasmOutputFilePath {
try localFileSystem.move(from: mainWasmPath, to: wasmOutputFilePath)
}
}
} else {
if mainWasmPath != wasmOutputFilePath {