Integrate examples into tests

This commit is contained in:
dcodeIO
2017-12-14 12:30:58 +01:00
parent c6c36613e6
commit 6bea116b3e
13 changed files with 522 additions and 314 deletions

View File

@ -6,10 +6,10 @@ An AssemblyScript example.
Instructions
------------
To build `assembly/i64.ts` to `i64.wasm`, run:
To build [assembly/i64.ts](./assembly/i64.ts) to an untouched and an optimized `.wasm` including their respective `.wast` representations, run:
```
$> npm run build
```
Afterwards, `require` the node module as usual (entry point is `index.js`).
Afterwards, `require` the node module as usual (CommonJS entry point is [index.js](./index.js)).

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
var fs = require("fs");
// Instantiate the module
var mod = new WebAssembly.Module(fs.readFileSync(__dirname + "/i64.wasm"));
var mod = new WebAssembly.Module(fs.readFileSync(__dirname + "/i64.optimized.wasm"));
var ins = new WebAssembly.Instance(mod, { /* no imports */ });
// Export its exports

View File

@ -3,6 +3,8 @@
"version": "1.0.0",
"private": true,
"scripts": {
"build": "asc assembly/i64.ts -t assembly/i64.wast -c && asc assembly/i64.ts -b i64.wasm -t assembly/i64.optimized.wast -O -c"
"build": "npm run build:untouched && npm run build:optimized",
"build:untouched": "asc assembly/i64.ts -t i64.untouched.wast -b i64.untouched.wasm --validate",
"build:optimized": "asc -O assembly/i64.ts -b i64.optimized.wasm -t i64.optimized.wast --validdate"
}
}