Skip to content

Commit

Permalink
update CONTRIBUTING.md and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunchen committed Mar 7, 2024
1 parent f3edfe5 commit c236dc9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 73 deletions.
73 changes: 35 additions & 38 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,60 @@

## Step 0: Contributor License Agreement

Before sending your first change to the moonbitlang/core project you must have completed one of the following two CLAs. Which CLA you should sign depends on who owns the copyright to your work.

- Individual contributor license agreement.
- Corporate contributor license agreement.

- 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:
- Individual contributor license agreement.
- Corporate contributor license agreement.

## Step 1: Clone the repository

To start working on the project, you need to have a local copy of the repository. Currently, `moon` will look up `moonbitlang/core` at `~/.moon/lib/core`, remove it if it exists

```bash
rm -rf ~/.moon/lib/core
```
- 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:

Then, you can use the following command to get latest version of the `moonbitlang/core`:
```bash
rm -rf ~/.moon/lib/core
```

```bash
git clone https://github.com/moonbitlang/core ~/.moon/lib/core
```
- Then, use the following command to get the latest version of moonbitlang/core:

Run the following command to bundle `moonbitlang/core`
```bash
git clone https://github.com/moonbitlang/core ~/.moon/lib/core
```

```bash
moon bundle --source-dir ~/.moon/lib/core
```
- Run the following command to bundle moonbitlang/core:

If everything goes well, it will generate a bundled core file `~/.moon/lib/core/target/bundle/core.core`.
```bash
moon bundle --source-dir ~/.moon/lib/core
```

Now you can create a new moon project and run it to check if everything is working as expected:
- If everything goes well, it will generate a bundled core file at `~/.moon/lib/core/target/bundle/core.core`.

```bash
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, you can create a new project and run it to check if everything is working as expected:

```bash
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)))
```

## Step 2: Make your change

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 be reviewing your code.
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.

## Step 3: Test your change

After making your changes, it's important to test them to ensure they work as expected and do not introduce new issues. You can run the following commands to test your changes:
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:

```bash
moon check
moon test
moon bundle
```
```bash
moon check
moon test
moon bundle
```

## Step 4: Submit a pull request and request a review

Simply follow the standard [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow) to submit your pull request.
Simply follow the standard [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow) to submit your pull request.

After submitting your pull request, request a review from the project maintainers or other contributors.
After submitting your pull request, request a review from the project maintainers or other contributors.
40 changes: 5 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
# Core
# moonbitlang/core

MoonBit's standard library.
moonbitlang/core is the standard library of the MoonBit language. It is released alongside the compiler. You can view the documentation for the latest official release at <https://mooncakes.io/docs/#/moonbitlang/core/>. This repository serves as the development repository.

⚠️ **The standard library is still in experimental phase**.
## Contributing
We are actively developing moonbitlang/core and appreciate your help!

Developers who want to experience the standard library in advance can add the `--std` option after the `moon check`, `moon build`, `moon run` or `moon test` commands. This will link the standard library to the current project.

## Example

1. To create a new project, use the `moon new` command as shown below:

```bash
$ moon new
Enter the path to create the project (. for current directory): my-project
Select the create mode: exec
Enter your username: username
Enter your project name: hello
Enter your license: Apache-2.0
Created my-project
```

2. Replace the contents of `my-project/main/main.mbt` with the following code:

```rust
fn init {
println(@list.reverse(@list.of_array([1, 2, 3])))
}
```

The code snippet uses `reverse` and `of_array` from the standard library `moonbitlang/core/list`.

3. If everything is configured correctly, the output should be:

```bash
$ moon run main --std
of_array([3, 2, 1])
```
To contribute, please read the contribution guidelines at [CONTRIBUTING.md](./CONTRIBUTING.md).

0 comments on commit c236dc9

Please sign in to comment.