Skip to content

Commit

Permalink
Update the warning message when wasm-opt fails
Browse files Browse the repository at this point in the history
Suggest to install binaryen if wasm-opt is not installed
  • Loading branch information
kateinoigakukun committed Mar 9, 2024
1 parent 7afcf00 commit 21b3737
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/CartonCLI/Commands/Bundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 21b3737

Please sign in to comment.