Skip to content

Commit 085cebe

Browse files
authored
Docs version control and new theme (#176)
- Version controlled docs - Every time something is committed to `main`, it will update the `develop` docs. - Every time a version is released, it will push a new version number to the docs. - Use our new ReactPy docs theme, which is an even better imitation of ReactJS docs - Fix `GITHUB_ACTIONS` env type conversion
1 parent aae9c7a commit 085cebe

32 files changed

+678
-374
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Develop Docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: 3.x
16+
- run: pip install -r requirements/build-docs.txt
17+
- name: Publish Develop Docs
18+
run: mike deploy --push develop

.github/workflows/publish-docs.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish Release Docs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.x
17+
- run: pip install -r requirements/build-docs.txt
18+
- name: Publish ${{ github.event.release.name }} Docs
19+
run: mike deploy --push --update-aliases ${{ github.event.release.name }} latest

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Using the following categories, list your changes in this order:
3434

3535
## [Unreleased]
3636

37+
### Added
38+
39+
- [ReactPy-Django docs](https://reactive-python.github.io/reactpy-django/) are now version controlled via [mike](https://github.com/jimporter/mike)!
40+
3741
### Changed
3842

3943
- Bumped the minimum ReactPy version to `1.0.2`.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<!--badge-end-->
2424
<!--intro-start-->
2525

26+
[ReactPy-Django](https://github.com/reactive-python/reactpy-django) is used to add used to add [ReactPy](https://reactpy.dev/) support to an existing **Django project**.
27+
2628
[ReactPy](https://reactpy.dev/) is a library for building user interfaces in Python without Javascript. ReactPy interfaces are made from components that look and behave similar to those found in [ReactJS](https://reactjs.org/). Designed with simplicity in mind, ReactPy can be used by those without web development experience while also being powerful enough to grow with your ambitions.
2729

2830
<table align="center">
@@ -77,11 +79,12 @@ def hello_world(recipient: str):
7779

7880
<!--html-header-start-->
7981

80-
In your **Django app**'s HTML template, you can now embed your ReactPy component using the `component` template tag. Within this tag, you will need to type in your dotted path to the component function as the first argument.
81-
82-
Additionally, you can pass in `args` and `kwargs` into your component function. For example, after reading the code below, pay attention to how the function definition for `hello_world` (_in the previous example_) accepts a `recipient` argument.
82+
In your **Django app**'s HTML template, you can now embed your ReactPy component using the `component` template tag. Within this tag, you will need to type in the dotted path to the component.
8383

8484
<!--html-header-end-->
85+
86+
Additionally, you can pass in `args` and `kwargs` into your component function. After reading the code below, pay attention to how the function definition for `hello_world` (_from the previous example_) accepts a `recipient` argument.
87+
8588
<!--html-code-start-->
8689

8790
```jinja

docs/overrides/main.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@
1111
</div>
1212
{% endif %}
1313
{% endblock %}
14+
15+
{% block outdated %}
16+
You're not viewing the latest version.
17+
<a href="{{ '../' ~ base_url }}">
18+
<strong>Click here to go to latest.</strong>
19+
</a>
20+
{% endblock %}

docs/src/changelog/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ hide:
33
- toc
44
---
55

6-
!!! summary "Attribution"
6+
<p class="intro" markdown>
77

8-
{% include-markdown "../../../CHANGELOG.md" start="<!--attr-start-->" end="<!--attr-end-->" %}
8+
{% include-markdown "../../../CHANGELOG.md" start="<!--attr-start-->" end="<!--attr-end-->" %}
9+
10+
</p>
11+
12+
---
913

1014
{% include-markdown "../../../CHANGELOG.md" start="<!--changelog-start-->" %}

docs/src/contribute/code.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
## Overview
22

3-
!!! summary "Overview"
3+
<p class="intro" markdown>
44

55
You will need to set up a Python environment to develop ReactPy-Django.
66

7-
??? tip "Looking to contribute features that are not Django specific?"
7+
</p>
88

9-
Everything within the `reactpy-django` repository must be specific to Django integration. Check out the [ReactPy Core documentation](https://reactpy.dev/docs/about/contributor-guide.html) to contribute general features such as: components, hooks, events, and more.
9+
!!! note
10+
11+
Looking to contribute features that are not Django specific?
12+
13+
Everything within the `reactpy-django` repository must be specific to Django integration. Check out the [ReactPy Core documentation](https://reactpy.dev/docs/about/contributor-guide.html) to contribute general features such as components, hooks, and events.
14+
15+
---
1016

1117
## Modifying Code
1218

docs/src/contribute/docs.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## Overview
22

3-
!!! summary "Overview"
3+
<p class="intro" markdown>
44

5-
You will need to set up a Python environment to preview docs changes.
5+
You will need to set up a Python environment to create, test, and preview docs changes.
6+
7+
</p>
8+
9+
---
610

711
## Modifying Docs
812

docs/src/contribute/running-tests.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## Overview
22

3-
!!! summary "Overview"
3+
<p class="intro" markdown>
44

5-
You will need to set up a Python environment to run out test suite.
5+
You will need to set up a Python environment to run the ReactPy-Django test suite.
6+
7+
</p>
8+
9+
---
610

711
## Running Tests
812

@@ -29,17 +33,26 @@ By running the command below you can run the full test suite:
2933
nox -s test
3034
```
3135

32-
Or, if you want to run the tests in the foreground:
36+
Or, if you want to run the tests in the background:
3337

3438
```bash linenums="0"
35-
nox -s test -- --headed
39+
nox -s test -- --headless
3640
```
3741

38-
## Only Django Tests
42+
## Django Tests
3943

40-
Alternatively, if you want to only run Django related tests, you can use the following command:
44+
If you want to only run our Django tests in your current environment, you can use the following command:
4145

4246
```bash linenums="0"
4347
cd tests
4448
python manage.py test
4549
```
50+
51+
## Django Test Webserver
52+
53+
If you want to manually run the Django test application, you can use the following command:
54+
55+
```bash linenums="0"
56+
cd tests
57+
python manage.py runserver
58+
```

0 commit comments

Comments
 (0)