|
1 | | -# Contributing to Recho |
| 1 | +# Recho - Contributing |
| 2 | + |
| 3 | +Recho is open source and released under the [ISC license](/LICENCE). You are welcome to contribute in different ways: open a [pull request](https://github.com/recho-dev/recho/pulls), participate in [issues](https://github.com/recho-dev/recho/issues) and [discussions](https://github.com/recho-dev/recho/discussions) or star this project! |
2 | 4 |
|
3 | 5 | ## Sharing Examples |
| 6 | + |
| 7 | +All the examples are located in `app/examples`. The quickest way to add an example is through GitHub's web editor: |
| 8 | + |
| 9 | +- Go to [new file](https://github.com/recho-dev/recho/new/main/app/examples). |
| 10 | +- Enter the filename in the format of `[SKETCH-NAME].recho.js`. |
| 11 | +- Add the metadata as doc strings at the top of the file. |
| 12 | +- Add the code below the metadata. |
| 13 | +- Click the "Commit changes" button. |
| 14 | + |
| 15 | +The following metadata are required: |
| 16 | + |
| 17 | +- **title** - the title of the sketch |
| 18 | +- **author** - the author of the sketch |
| 19 | +- **created** - the date of the creation of the sketch |
| 20 | +- **github** - the GitHub username of the author, for displaying the avatar |
| 21 | +- **pull_request** - the pull request number of adding this sketch, for commenting on the pull request |
| 22 | + |
| 23 | +The following metadata are optional: |
| 24 | + |
| 25 | +- **thumbnail_start** - the line number of the start of the thumbnail code |
| 26 | + |
| 27 | +Here is an example: |
| 28 | + |
| 29 | +```js |
| 30 | +/** |
| 31 | + * @title Hello World |
| 32 | + * @author Bairui SU |
| 33 | + * @github pearmini |
| 34 | + * @created 2025-09-15 |
| 35 | + * @pull_request 123 |
| 36 | + * @thumbnail_start 26 |
| 37 | + */ |
| 38 | + |
| 39 | +echo("Hello World"); |
| 40 | +``` |
| 41 | + |
| 42 | +This is a [pull request](https://github.com/recho-dev/recho/pull/82) you can refer to. |
| 43 | + |
| 44 | +## Editor & Runtime Development |
| 45 | + |
| 46 | +If you want to contribute to the editor or runtime, make sure to add test files in `test/js/` and register them in `test/js/index.js`. |
| 47 | + |
| 48 | +For example, if you add a new test file called `hello-world.js` with the following content: |
| 49 | + |
| 50 | +```js |
| 51 | +export const helloWorld = `echo("Hello World");`; |
| 52 | +``` |
| 53 | + |
| 54 | +Then you need to register it in _test/js/index.js_ with the following content: |
| 55 | + |
| 56 | +```js |
| 57 | +export {helloWorld} from "./hello-world.js"; |
| 58 | +``` |
| 59 | + |
| 60 | +Then run `npm run dev` to open the development server. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +After finishing development, run `npm run test` to make sure everything works as expected. |
| 65 | + |
| 66 | +## Website Development |
| 67 | + |
| 68 | +If you want to contribute to the [website](https://recho.dev/), run `npm run app:dev` to open the development server. After finishing development, run `npm run test` to make sure everything works as expected. |
0 commit comments