Created
November 29, 2020 21:16
-
-
Save p3nGu1nZz/91bf7a9de4cbaa8c505a572856b12f83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/code/as-boilerplater | |
➜ npm init | |
This utility will walk you through creating a package.json file. | |
It only covers the most common items, and tries to guess sensible defaults. | |
See `npm help json` for definitive documentation on these fields | |
and exactly what they do. | |
Use `npm install <pkg>` afterwards to install a package and | |
save it as a dependency in the package.json file. | |
Press ^C at any time to quit. | |
package name: (as-boilerplater) | |
version: (1.0.0) | |
description: | |
entry point: (index.js) | |
test command: | |
git repository: | |
keywords: | |
author: | |
license: (ISC) | |
About to write to /Users/zoe/code/as-boilerplater/package.json: | |
{ | |
"name": "as-boilerplater", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" | |
} | |
Is this OK? (yes) yes | |
~/code/as-boilerplater is 📦 v1.0.0 via ⬢ v11.15.0 took 13s | |
➜ npm install --save @assemblyscript/loader | |
npm notice created a lockfile as package-lock.json. You should commit this file. | |
npm WARN [email protected] No description | |
npm WARN [email protected] No repository field. | |
+ @assemblyscript/[email protected] | |
added 1 package from 1 contributor and audited 1 package in 1.293s | |
found 0 vulnerabilities | |
~/code/as-boilerplater is 📦 v1.0.0 via ⬢ v11.15.0 took 3s | |
➜ npm install --save-dev assemblyscript | |
npm WARN [email protected] No description | |
npm WARN [email protected] No repository field. | |
+ [email protected] | |
added 3 packages from 29 contributors and audited 4 packages in 0.946s | |
found 0 vulnerabilities | |
~/code/as-boilerplater is 📦 v1.0.0 via ⬢ v11.15.0 | |
➜ npx asinit . | |
Version: 0.17.3 | |
This command will make sure that the following files exist in the project | |
directory '/Users/zoe/code/as-boilerplater': | |
./assembly | |
Directory holding the AssemblyScript sources being compiled to WebAssembly. | |
./assembly/tsconfig.json | |
TypeScript configuration inheriting recommended AssemblyScript settings. | |
./assembly/index.ts | |
Example entry file being compiled to WebAssembly to get you started. | |
./build | |
Build artifact directory where compiled WebAssembly files are stored. | |
./build/.gitignore | |
Git configuration that excludes compiled binaries from source control. | |
./index.js | |
Main file loading the WebAssembly module and exporting its exports. | |
./tests/index.js | |
Example test to check that your module is indeed working. | |
./asconfig.json | |
Configuration file defining both a 'debug' and a 'release' target. | |
./package.json | |
Package info containing the necessary commands to compile to WebAssembly. | |
The command will try to update existing files to match the correct settings | |
for this instance of the compiler in '/Users/zoe/code/as-boilerplater/node_modules/assemblyscript'. | |
Do you want to proceed? [Y/n] Y | |
- Making sure that the project directory exists... | |
Exists: /Users/zoe/code/as-boilerplater | |
- Making sure that the 'assembly' directory exists... | |
Created: /Users/zoe/code/as-boilerplater/assembly | |
- Making sure that 'assembly/tsconfig.json' is set up... | |
Created: /Users/zoe/code/as-boilerplater/assembly/tsconfig.json | |
- Making sure that 'assembly/index.ts' exists... | |
Created: /Users/zoe/code/as-boilerplater/assembly/index.ts | |
- Making sure that the 'build' directory exists... | |
Created: /Users/zoe/code/as-boilerplater/build | |
- Making sure that 'build/.gitignore' is set up... | |
Created: /Users/zoe/code/as-boilerplater/build/.gitignore | |
- Making sure that 'package.json' contains the build commands... | |
Updated: /Users/zoe/code/as-boilerplater/package.json | |
- Making sure that 'index.js' exists... | |
Created: /Users/zoe/code/as-boilerplater/index.js | |
- Making sure that the 'tests' directory exists... | |
Created: /Users/zoe/code/as-boilerplater/tests | |
- Making sure that 'tests/index.js' exists... | |
Created: /Users/zoe/code/as-boilerplater/tests/index.js | |
- Making sure that 'asconfig.json' is set up... | |
Created: /Users/zoe/code/as-boilerplater/asconfig.json | |
Done! | |
Don't forget to install dependencies before you start: | |
npm install | |
To edit the entry file, open 'assembly/index.ts' in your editor of choice. | |
Create as many additional files as necessary and use them as imports. | |
To build the entry file to WebAssembly when you are ready, run: | |
npm run asbuild | |
Running the command above creates the following binaries incl. their respective | |
text format representations and source maps: | |
./build/untouched.wasm | |
./build/untouched.wasm.map | |
./build/untouched.wat | |
^ The untouched WebAssembly module as generated by the compiler. | |
This one matches your sources exactly, without any optimizations. | |
./build/optimized.wasm | |
./build/optimized.wasm.map | |
./build/optimized.wat | |
^ The optimized WebAssembly module using default optimization settings. | |
You can change the optimization settings in 'package.json'. | |
To run the tests, do: | |
npm test | |
The AssemblyScript documentation covers all the details: | |
https://docs.assemblyscript.org | |
Have a nice day! | |
~/code/as-boilerplater is 📦 v1.0.0 via ⬢ v11.15.0 took 5s | |
➜ npm run asbuild | |
> [email protected] asbuild /Users/zoe/code/as-boilerplater | |
> npm run asbuild:untouched && npm run asbuild:optimized | |
> [email protected] asbuild:untouched /Users/zoe/code/as-boilerplater | |
> asc assembly/index.ts --target debug | |
> [email protected] asbuild:optimized /Users/zoe/code/as-boilerplater | |
> asc assembly/index.ts --target release | |
~/code/as-boilerplater is 📦 v1.0.0 via ⬢ v11.15.0 took 8s | |
➜ npm test | |
> [email protected] test /Users/zoe/code/as-boilerplater | |
> node tests | |
/Users/zoe/code/as-boilerplater/node_modules/@assemblyscript/loader/index.js:298 | |
export async function instantiate(source, imports = {}) { | |
^^^^^^ | |
SyntaxError: Unexpected token export | |
at Module._compile (internal/modules/cjs/loader.js:760:23) | |
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10) | |
at Module.load (internal/modules/cjs/loader.js:685:32) | |
at Function.Module._load (internal/modules/cjs/loader.js:620:12) | |
at Module.require (internal/modules/cjs/loader.js:723:19) | |
at require (internal/modules/cjs/helpers.js:14:16) | |
at Object.<anonymous> (/Users/zoe/code/as-boilerplater/index.js:2:16) | |
at Module._compile (internal/modules/cjs/loader.js:816:30) | |
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10) | |
at Module.load (internal/modules/cjs/loader.js:685:32) | |
npm ERR! Test failed. See above for more details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my package