|
| 1 | +# Welcome to the MMM-PrometheusAlerts contributing guide <!-- omit in toc --> |
| 2 | + |
| 3 | +Thank you for investing your time in contributing to our project! |
| 4 | + |
| 5 | +This project adheres to the [Github Contributor Code of Conduct](https://github.com/github/docs/blob/main/CODE_OF_CONDUCT.md). |
| 6 | + |
| 7 | +In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. |
| 8 | + |
| 9 | +Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly. |
| 10 | + |
| 11 | +## New contributor guide |
| 12 | + |
| 13 | +To get an overview of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions: |
| 14 | + |
| 15 | +- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github) |
| 16 | +- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git) |
| 17 | +- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) |
| 18 | +- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests) |
| 19 | + |
| 20 | +## Getting started |
| 21 | + |
| 22 | +To navigate our codebase with confidence, see [the introduction to working in the docs repository](/contributing/working-in-docs-repository.md) :confetti_ball:. For more information on how we write our markdown files, see [the GitHub Markdown reference](contributing/content-markup-reference.md). |
| 23 | + |
| 24 | +Check to see what [types of contributions](/contributing/types-of-contributions.md) we accept before making changes. Some of them don't even require writing a single line of code :sparkles:. |
| 25 | + |
| 26 | +### Issues |
| 27 | + |
| 28 | +#### Create a new issue |
| 29 | + |
| 30 | +If you spot a problem with the docs, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using the [issue form](https://github.com/spyder007/MMM-PrometheusAlerts/issues/new/choose). |
| 31 | + |
| 32 | +#### Solve an issue |
| 33 | + |
| 34 | +Scan through our [existing issues](https://github.com/spyder007/MMM-PrometheusAlerts/issues) to find one that interests you. You can narrow down the search using `labels` as filters. See [Labels](/contributing/how-to-use-labels.md) for more information. If you find an issue to work on, you are welcome to open a PR with a fix. |
| 35 | + |
| 36 | +### Make Changes |
| 37 | + |
| 38 | +#### Make changes locally |
| 39 | + |
| 40 | +1. [Install and Configure](https://docs.magicmirror.builders/getting-started/installation.html) an instance of MagicMirror for testing. It is very helpful to read and understand [Module Development](https://docs.magicmirror.builders/development/introduction.html) in Magic Mirror. |
| 41 | + |
| 42 | +2. Fork the repository |
| 43 | + |
| 44 | +- Using GitHub Desktop: |
| 45 | +- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop. |
| 46 | +- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)! |
| 47 | + |
| 48 | +- Using the command line: |
| 49 | + - [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them. |
| 50 | + |
| 51 | +3. Install or update to **Node.js v18**. |
| 52 | + |
| 53 | +4. Clone your forked repository. In order to test locally, clone your repository into the `modules` folder of the MagicMirror repository. |
| 54 | + |
| 55 | +5. Create a working branch and start with your changes! |
| 56 | + |
| 57 | +### Commit your update |
| 58 | + |
| 59 | +Commit the changes once you are happy with them. Don't forget to run the linting and test commands: |
| 60 | + |
| 61 | +#### Linting Commands |
| 62 | + |
| 63 | +```bash |
| 64 | +# Run ESLint on Javascript files |
| 65 | +npm run lint:js |
| 66 | +# Run Prettier on all files |
| 67 | +npm run lint:prettier |
| 68 | + |
| 69 | +# run everything above - *** Recommended before commit *** |
| 70 | +npm run lint |
| 71 | +``` |
| 72 | + |
| 73 | +#### Test Commands |
| 74 | + |
| 75 | +```bash |
| 76 | +# Run all tests (unit, prettier, and js) |
| 77 | +npm run test |
| 78 | + |
| 79 | +# Run unit tests |
| 80 | +npm run test:unit |
| 81 | + |
| 82 | +# Check for prettier syntax violations (does not fix) |
| 83 | +npm run test:prettier |
| 84 | + |
| 85 | +# Check for ESLint JS syntax violations (does not fix) |
| 86 | +npm run test:js |
| 87 | + |
| 88 | +``` |
| 89 | + |
| 90 | +#### Build Commands |
| 91 | + |
| 92 | +This module is written and tested using Typescript and SCSS, however, to be used by MagicMirror, `rollup` must execute and create the necessary Javascript and CSS files for the module and the `node_helper`. |
| 93 | + |
| 94 | +This is all encapsulated in the build command: |
| 95 | + |
| 96 | +```bash |
| 97 | +# build module JS files from typescript |
| 98 | +npm run build |
| 99 | +``` |
| 100 | + |
| 101 | +You can use `npm run dev` to build with inline source maps, and `npm run watch` to build (and rebuild) on changes. |
| 102 | + |
| 103 | +### Pull Request |
| 104 | + |
| 105 | +When you're finished with the changes, create a pull request, also known as a PR. |
| 106 | + |
| 107 | +- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one. |
| 108 | +- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge. |
| 109 | + Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information. |
| 110 | +- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch. |
| 111 | +- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations). |
| 112 | +- If you run into any merge issues, checkout this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues. |
| 113 | + |
| 114 | +### Your PR is merged |
| 115 | + |
| 116 | +Congratulations :tada::tada: We thank you for your contribution. |
| 117 | + |
| 118 | +Once your PR is merged, your updates are available in MagicMirror by pulling the latest code from the `main` branch in this repository into your Magic Mirror `modules` folder and running `npm install` |
0 commit comments