AssemblyScript / examples

A collection of AssemblyScript examples.
https://assemblyscript.org
MIT License
287 stars 50 forks source link

The build flags are incorrect (-o instead of -b, -b instead of -d) #16

Closed Sakari369 closed 2 years ago

Sakari369 commented 2 years ago

The build flags specified in the examples are incorrect for asc version 0.20.6.

Currently the build scripts use "-b output.wasm" and "-d build/optimized.d.ts"

The correct flags are "-o output.wasm" and "-b esm"

Here is a diff:

diff --git a/mandelbrot/package.json b/mandelbrot/package.json
index 5b6c6b9..5165d15 100644
--- a/mandelbrot/package.json
+++ b/mandelbrot/package.json
@@ -4,8 +4,8 @@
   "license": "Apache-2.0",
   "private": true,
   "scripts": {
-    "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime stub --importMemory --sourceMap --debug --measure",
-    "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath --runtime stub -O3 --importMemory --sourceMap --measure",
+    "asbuild:untouched": "asc assembly/index.ts -o build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime stub --importMemory --sourceMap --debug --measure",
+    "asbuild:optimized": "asc assembly/index.ts -o build/optimized.wasm -t build/optimized.wat -b esm --use Math=JSMath --runtime stub -O3 --importMemory --sourceMap --measure",
     "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
     "start": "npx serve"
   },
sebpiq commented 2 years ago

Ping :bell: ! Same here :wink: I'm happy opening a pull request if someone tells me that there's nothing else to modify

MaxGraey commented 2 years ago

PR are welcomed! Better use asconfig like in n-body instead asc options: https://github.com/AssemblyScript/examples/blob/main/n-body/asconfig.json

sebpiq commented 2 years ago

Ah great ! Thanks for doing it @MaxGraey 😁