|
| 1 | +# Contributing |
| 2 | + |
| 3 | +We'd love to accept your patches and contributions to this project. |
| 4 | + |
| 5 | +## Development Environment |
| 6 | + |
| 7 | +If you are contributing AIP content (rather than code) and want to be able to |
| 8 | +view it in your browser, the easiest way to do so is to run the provided |
| 9 | +development server. |
| 10 | + |
| 11 | +We use [GitHub Pages][1] to make this documentation available, and a specific |
| 12 | +[site generator][2] to build the site. |
| 13 | + |
| 14 | +If you have [Docker][3] installed, clone this repository and run the `serve.sh` |
| 15 | +file at the root of the repository. This script does two things: |
| 16 | + |
| 17 | +- It builds the provided Docker image (unless you already have it) and tags it |
| 18 | + as `aip-site`. |
| 19 | +- It runs the `aip-site` image. |
| 20 | + |
| 21 | +The development server uses port 4000; point your web browser to |
| 22 | +`http://localhost:4000`, and you should see the site. |
| 23 | + |
| 24 | +**Note:** After building the Docker image for the first time, you may |
| 25 | +experience issues if Python dependencies change underneath you. If this |
| 26 | +happens, remove your Docker image (`docker rmi aip-site`) and run `serve.sh` |
| 27 | +again. |
| 28 | + |
| 29 | +### Arguments |
| 30 | + |
| 31 | +Any arguments provided to `serve.sh` (or `docker run`) are forwarded (however, |
| 32 | +the current site generator does not honor any; this may change in the future). |
| 33 | + |
| 34 | +### Hot reloading |
| 35 | + |
| 36 | +The development server recognizes when files change (including static files) |
| 37 | +and local changes will be automatically reflected in your browser upon reload. |
| 38 | + |
| 39 | +### Local Installation |
| 40 | + |
| 41 | +It is possible to run the development server locally also. The general gist of |
| 42 | +how to do so correctly is: |
| 43 | + |
| 44 | +- Install Python 3.8 if you do not already have it (direct install is fine, but |
| 45 | + [pyenv][5] is probably the best way if you have other Python projects). |
| 46 | +- Create a Python 3.8 [venv][6]. Once it is created, activate it in your shell |
| 47 | + (`source path/to/venv/bin/activate`). |
| 48 | +- `pip install git+https://github.com/aip-dev/site-generator.git` |
| 49 | +- `aip-site-serve .` |
| 50 | + |
| 51 | +## Contributor License Agreement |
| 52 | + |
| 53 | +Contributions to this project must be accompanied by a Contributor License |
| 54 | +Agreement. You (or your employer) retain the copyright to your contribution, |
| 55 | +this simply gives us permission to use and redistribute your contributions as |
| 56 | +part of the project. Head over to <https://cla.developers.google.com/> to see |
| 57 | +your current agreements on file or to sign a new one. |
| 58 | + |
| 59 | +You generally only need to submit a CLA once, so if you have already submitted |
| 60 | +one (even if it was for a different project), you probably do not need to do it |
| 61 | +again. |
| 62 | + |
| 63 | +## Code reviews |
| 64 | + |
| 65 | +All submissions, including submissions by project members, require review. We |
| 66 | +use GitHub pull requests for this purpose. Consult |
| 67 | +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more |
| 68 | +information on using pull requests. |
| 69 | + |
| 70 | +### Formatting |
| 71 | + |
| 72 | +We use [prettier][4] to format Markdown, JavaScript, and (most) HTML, in order |
| 73 | +to ensure a consistent style throughout our source. You can add prettier as a |
| 74 | +plugin in most development environments. |
| 75 | + |
| 76 | +[1]: https://pages.github.com/ |
| 77 | +[2]: https://github.com/aip-dev/site-generator |
| 78 | +[3]: https://docker.com/ |
| 79 | +[4]: https://prettier.io/ |
| 80 | +[5]: https://github.com/pyenv/pyenv |
| 81 | +[6]: https://docs.python.org/3/library/venv.html |
0 commit comments