# Development

Instructions for setting up a development environment.


Please see our contribution guidelines (opens new window) before submitting your first pull request.

# Setting up a development environment

The following sets up a development environment of the compiler where editing the sources applies changes immediately without having to go through a build step:

git clone https://github.com/AssemblyScript/assemblyscript.git
cd assemblyscript
npm install
npm link

Note that a development environment runs the sources directly by default, but will use distributions files once built. Cleaning the distribution files again with npm run clean resets this. Whether asc is running the sources or distribution files can be determined by checking the displayed version number. If it states -dev, it runs the sources directly.

# Building distribution files

To build an UMD bundle to dist/assemblyscript.js (depends on binaryen.js (opens new window)), including a browser version of asc to dist/asc.js (depends on assemblyscript.js):

npm run build

Cleaning the distribution files (again):

npm run clean

Linting potential changes:

npm run check

Running the tests (opens new window):

npm test

Running everything in order (check, clean, test, build, test):

npm run all

# Creating tests

The test suite is composed of a set of tests for each component, like the parser, the compiler and runtime. For each pull request, all the tests are run automatically and the PR only goes green if it passes all of them. Please see the instructions within the repository (opens new window) for all the details.