- Before sending your first change to the moonbitlang/core project, you must have completed one of the following two CLAs, depending on who owns the copyright to your work:
- To sign the Individual Contributor License Agreement, you can either sign it online by visiting https://moonbitlang.com/cla or download the CLA from ICLA-IDEA_IDEA Legal_202311.pdf , sign it, and send it to us at [email protected].
- To sign the Corporate Contributor License Agreement, download the CLA from CCLA-IDEA_IDEA Legal_202311.pdf , sign it, and send it to us at [email protected].
-
To start working on the project, you need a local copy of the repository. Currently,
moon
looks for moonbitlang/core at~/.moon/lib/core
. So, remove it if it exists:rm -rf ~/.moon/lib/core
-
Then, use the following command to get the latest version of moonbitlang/core:
git clone https://github.com/moonbitlang/core ~/.moon/lib/core
-
Run the following command to bundle moonbitlang/core:
moon bundle --source-dir ~/.moon/lib/core
-
If everything goes well, it will generate a bundled core file at
~/.moon/lib/core/target/bundle/core.core
. -
Now, you can create a new project and run it to check if everything is working as expected:
moon new hello cd hello echo """fn main { println(@list.reverse(@list.from_array([1, 2, 3]))) }""" > main/main.mbt moon run main # Output: List::Cons(3,List::Cons(2,List::Cons(1,Nil)))
Now it's time to make your changes to the codebase. Whether it's fixing a bug, adding a new feature, or improving documentation, your contributions are welcome. Ensure that your changes are clear and understandable to others who will review your code.
Currently there are some simple restrictions for naming convention and code formatting:
- All function names, method names, and variables should use
snake_case
, while all type names should usePascalCase
. - The code formatting should align with the result of moonfmt as much as possible.
- For public functions and types, tests and documentation should be provided.
After making your changes, it's important to test them to ensure they work as expected and do not introduce new issues. Run the following commands to test your changes:
moon check
moon test
moon bundle
moon info // Generate mbti files, these files should be tracked by git
Simply follow the standard GitHub flow to submit your pull request.
After submitting your pull request, request a review from the project maintainers or other contributors.