Skip to content

Latest commit

 

History

History
117 lines (77 loc) · 2.71 KB

DEVELOPMENT.md

File metadata and controls

117 lines (77 loc) · 2.71 KB

Development

Repository Structure

This crate is split into 3 parts. The first one is the repository's root folder, which we'll be refering to as the "outer"-crate. The second and third are the "inner"-crates, which are in the "crates"-directory.


Of these the "definitions"-crate contains all code about tokens, what operators and expressions there are etc. If you need to make changes to these topics please do so in crates/definitions.


The "source_gen"-crate rarely needs any changes. It contains a build.rs file, which automatically builds new source code needed for the project from the definitions crate.

⚠️ The generated.rs files in the "source_gen"-crate needn't be touched (they'll be overwritten by the next build with changes anyways) ⚠️.


All code concerning AST, parsing and such topics can be found in the src directory of the "outer"-crate. Please make your changes there.

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
To contribute to this project, follow these steps:

  1. Fork the repository.

  2. Create a new branch for your feature or bug fix:

    git checkout -b feature/my-feature
  3. Make your changes and ensure that the code follows the project's coding conventions.

  4. Run the tests to ensure they pass:

    cargo test --features coverage-tests
  5. Commit your changes:

    git commit -m "Add my feature"
  6. Push to your branch:

    git push origin feature/my-feature
  7. Open a pull request on GitHub.

Requirements

  • A working Rust toolchain using rustup (at least 1.80.0)
  • wasm-pack (for building WebAssembly)

Getting started

To build the application and generate a full npm package in the pkg/ directory, use

wasm-pack build --target nodejs

Unit tests

To run all unit tests, use

cargo test

To run unit tests marked with #[ignore], use

cargo test -- --ignored

To run the coverage tests, use

cargo test -F coverage-tests

To run the TypeScript test suite, use

npm --prefix tests/typescript clean-install
npm --prefix tests/typescript test

Rustdoc

To generate the (public) rustdoc for this library, use:

cargo doc

To generate the full rustdoc for all items, including private ones, use:

cargo doc --document-private-items

Optional tools

It is endorsed to install the wasm-opt tool from the binaryen project, which wasm-pack will automatically use to optimize the generated WASM code.