Skip to content

Developer Environment

Fernando Dodino edited this page Sep 19, 2024 · 11 revisions

Required skills

  • Typescript: Intermediate
  • NPM: Basic - install, run commands
  • Bash / Git Bash: Basic - run commands

Working Environment

Take a look at this page in order to install the required components for developing Wollok.

Unit tests

You can run the whole test suite by executing

npm test

In case you want to run a single file, type the following command:

npx mocha --parallel -r ts-node/register/transpile-only test/run.test.ts

(this runs only the run.test.ts file)

Testing CLI locally

Watch mode

After that, you are ready to start working. You can build the project by running npm run build; this will compile all assets to the /build folder, leaving everything ready to run but, if you are a developer, you will probably want to run npm run watch instead and leave it running in a separate window so it will update the /build folder whenever any code is changed (notice that this only works for TS changes, to update any other kind of file you have to restart the watch).

Build & test

Once the code has been built, you can run the CLI by running npm start. Remember that, while running through npm, you will need to add a -- before any non npm related flags. For example, to see the application manual you can run

npm start -- --help

Another example, opening REPL on a specific file in a Wollok project:

npm start -- repl /home/you/myWollokProject/birds.wlk -p /home/you/myWollokProject 
    # --skipValidations in case the file has errors

Testing the executable

Finally, you can generate wollok-ts-cli executable binaries (a.k.a. the distributable user-ready program) by running:

npm run pack

And checking the /dist folder. For example, in Linux you can do the following:

# in wollok-ts-cli root folder
sudo cp ./dist/wollok-ts-cli-linux-x64 /usr/bin/wollok
# then go to any Wollok project and do
wollok repl ...
wollok test ...
# or simply open VSC and run tests/REPL/programs inside the IDE

Another option could be

# only in Terminal
./dist/wollok-ts-cli-linux-x64 repl /home/you/myWollokProject/birds.wlk -p /home/you/myWollokProject 

Debugging

If you open a Terminal in Debug mode

image

you can add a breakpoint and run the tests:

debuggingWollokTsCLI

We, the People

If you need some human interaction, you're always welcome at our Discord channel. We also have a list of first good issues you can take a look and ask for help to get more information.