Skip to content

Commit 72d8d71

Browse files
authored
Merge branch 'main' into devin/1752212592-fix-edit-page-links
2 parents d022e47 + c929e2e commit 72d8d71

File tree

29 files changed

+2713
-1828
lines changed

29 files changed

+2713
-1828
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ env:
1717
NODE_OPTIONS: "--max-old-space-size=8192"
1818
CP_WEB_URL: https://cloud.rxc.app/
1919
CP_BACKEND_URL: https://cloud-f188e2cd-51fb-4b29-b546-2ce4b9efc5d5.fly.dev/
20+
DEV_TYPESENSE_HOST: ${{ secrets.DEV_TYPESENSE_HOST }}
21+
DEV_TYPESENSE_SEARCH_API_KEY: ${{ secrets.DEV_TYPESENSE_SEARCH_API_KEY }}
2022

2123
jobs:
2224
deploy:
@@ -38,6 +40,14 @@ jobs:
3840
- name: Update Reflex CLI
3941
run: uv pip install reflex-hosting-cli -U
4042

43+
- name: Index documentation to Typesense
44+
env:
45+
TYPESENSE_ADMIN_API_KEY: ${{ secrets.DEV_TYPESENSE_ADMIN_API_KEY }}
46+
TYPESENSE_HOST: ${{ secrets.DEV_TYPESENSE_HOST }}
47+
run: |
48+
uv pip install typesense python-frontmatter markdown beautifulsoup4
49+
python scripts/typesense_indexer.py
50+
4151
- name: Deploy to Reflex
4252
id: deploy
4353
run: |

.github/workflows/deploy-prd.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ permissions:
1414
env:
1515
NODE_OPTIONS: "--max-old-space-size=8192"
1616
FLY_API_TOKEN: ${{ secrets.PRD_FLY_API_TOKEN }}
17+
TYPESENSE_HOST: ${{ secrets.PRD_TYPESENSE_HOST }}
18+
TYPESENSE_SEARCH_API_KEY: ${{ secrets.PRD_TYPESENSE_SEARCH_API_KEY }}
1719

1820
jobs:
1921
deploy:
@@ -36,6 +38,14 @@ jobs:
3638
- name: Update Reflex CLI
3739
run: uv pip install reflex-hosting-cli -U
3840

41+
- name: Index documentation to Typesense
42+
env:
43+
TYPESENSE_ADMIN_API_KEY: ${{ secrets.PRD_TYPESENSE_ADMIN_API_KEY }}
44+
TYPESENSE_HOST: ${{ secrets.PRD_TYPESENSE_HOST }}
45+
run: |
46+
uv pip install typesense python-frontmatter markdown beautifulsoup4
47+
python scripts/typesense_indexer.py
48+
3949
- name: Deploy to Reflex
4050
id: deploy
4151
run: |

.github/workflows/deploy-stg.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ env:
1717
FLY_API_TOKEN: ${{ secrets.STG_FLY_API_TOKEN }}
1818
CP_WEB_URL: https://cloud.reflexcorp.run/
1919
CP_BACKEND_URL: https://cloud-29f4f535-4fb8-48b9-8b55-2000f2782aee.fly.dev/
20+
TYPESENSE_HOST: ${{ secrets.STG_TYPESENSE_HOST }}
21+
TYPESENSE_SEARCH_API_KEY: ${{ secrets.STG_TYPESENSE_SEARCH_API_KEY }}
2022

2123
jobs:
2224
deploy:
@@ -38,6 +40,14 @@ jobs:
3840
- name: Update Reflex CLI
3941
run: uv pip install reflex-hosting-cli -U
4042

43+
- name: Index documentation to Typesense
44+
env:
45+
TYPESENSE_ADMIN_API_KEY: ${{ secrets.STG_TYPESENSE_ADMIN_API_KEY }}
46+
TYPESENSE_HOST: ${{ secrets.STG_TYPESENSE_HOST }}
47+
run: |
48+
uv pip install typesense python-frontmatter markdown beautifulsoup4
49+
python scripts/typesense_indexer.py
50+
4151
- name: Deploy to Reflex
4252
id: deploy
4353
run: |
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Typesense Documentation Indexing
2+
3+
env:
4+
TELEMETRY_ENABLED: false
5+
NODE_OPTIONS: "--max_old_space_size=8192"
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
force_reindex:
11+
description: "Force complete reindexing"
12+
type: boolean
13+
default: false
14+
15+
permissions:
16+
contents: read
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
jobs:
23+
index-docs:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install the latest version of uv
29+
uses: astral-sh/setup-uv@v6
30+
with:
31+
python-version: "3.11"
32+
activate-environment: true
33+
34+
- name: Install indexing dependencies
35+
run: |
36+
uv pip install typesense python-frontmatter markdown beautifulsoup4
37+
38+
- name: Run Typesense indexing
39+
env:
40+
TYPESENSE_ADMIN_API_KEY: ${{ secrets.TYPESENSE_ADMIN_API_KEY }}
41+
run: |
42+
python scripts/typesense_indexer.py
43+
44+
- name: Verify indexing coverage and completeness
45+
env:
46+
TYPESENSE_SEARCH_API_KEY: ${{ secrets.TYPESENSE_SEARCH_API_KEY }}
47+
run: |
48+
echo "=== INDEXING VERIFICATION SUMMARY ==="
49+
echo "The indexing script includes comprehensive verification that:"
50+
echo "✅ All markdown files in /docs are found and processed"
51+
echo "✅ No files are skipped or fail processing"
52+
echo "✅ Section-by-section coverage is 100%"
53+
echo "✅ Final Typesense count matches processed documents"
54+
echo ""
55+
echo "If any markdown files are missing or fail to index, the script will:"
56+
echo "❌ Exit with error code 1"
57+
echo "❌ Report specific failed files and reasons"
58+
echo "❌ Show detailed section breakdown of coverage"
59+
echo ""
60+
echo "Performing additional search verification..."
61+
python -c "
62+
import typesense
63+
client = typesense.Client({
64+
'nodes': [{'host': 'z2mi3hyewokc16a4p-1.a1.typesense.net', 'port': '443', 'protocol': 'https'}],
65+
'api_key': '${{ secrets.TYPESENSE_SEARCH_API_KEY }}',
66+
'connection_timeout_seconds': 60
67+
})
68+
result = client.collections['docs'].documents.search({'q': 'reflex', 'query_by': 'title,content'})
69+
print(f'✅ Search verification: Found {result[\"found\"]} documents for \"reflex\" query')
70+
71+
# Test different sections
72+
sections = ['getting_started', 'library', 'hosting', 'events', 'styling']
73+
for section in sections:
74+
result = client.collections['docs'].documents.search({
75+
'q': section,
76+
'query_by': 'section,title,content',
77+
'per_page': 1
78+
})
79+
print(f'✅ Section \"{section}\": {result[\"found\"]} searchable documents')
80+
"

docs/api-reference/browser_javascript.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,15 @@ via `rx.call_script`.
7777
rx.vstack(
7878
rx.script(
7979
src="https://cdn.jsdelivr.net/gh/scottschiller/snowstorm@snowstorm_20131208/snowstorm-min.js",
80-
on_ready=rx.call_script("snowStorm.autoStart = false; snowStorm.snowColor = '#111'"),
8180
),
81+
rx.script("""
82+
window.addEventListener('load', function() {
83+
if (typeof snowStorm !== 'undefined') {
84+
snowStorm.autoStart = false;
85+
snowStorm.snowColor = '#111';
86+
}
87+
});
88+
"""),
8289
rx.button("Start Duststorm", on_click=rx.call_script("snowStorm.start()")),
8390
rx.button("Toggle Duststorm", on_click=rx.call_script("snowStorm.toggleSnow()")),
8491
)

docs/components/conditional_rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class PropCondState(rx.State):
5555
value: int
5656

5757
@rx.event
58-
def set_end(self, value: list[int]):
58+
def set_end(self, value: list[int | float]):
5959
self.value = value[0]
6060

6161

docs/custom-components/command-reference.md

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
# Command Reference
22

3-
```python exec
4-
import reflex as rx
5-
from pcweb.pages.docs import wrapping_react
6-
from pcweb.pages.gallery import gallery
7-
from pcweb.pages.docs import custom_components
8-
from pcweb.templates.docpage import doccmdoutput
9-
from pcweb.styles.fonts import code
10-
```
11-
123
The custom component commands are under `reflex component` subcommand. To see the list of available commands, run `reflex component --help`. To see the manual on a specific command, run `reflex component <command> --help`, for example, `reflex component init --help`.
134

14-
```python eval
15-
doccmdoutput(
16-
command="reflex component --help",
17-
output="""Usage: reflex component [OPTIONS] COMMAND [ARGS]...
5+
```bash
6+
reflex component --help
7+
```
8+
9+
```text
10+
Usage: reflex component [OPTIONS] COMMAND [ARGS]...
1811
1912
Subcommands for creating and publishing Custom Components.
2013
@@ -24,17 +17,19 @@ Options:
2417
Commands:
2518
init Initialize a custom component.
2619
build Build a custom component.
27-
share Collect more details on the published package for gallery.""")
20+
share Collect more details on the published package for gallery.
2821
```
2922

3023
## reflex component init
3124

3225
Below is an example of running the `init` command.
3326

34-
```python eval
35-
doccmdoutput(
36-
command="reflex component init",
37-
output="""reflex component init
27+
```bash
28+
reflex component init
29+
```
30+
31+
```text
32+
reflex component init
3833
─────────────────────────────────────── Initializing reflex-google-auth project ───────────────────────────────────────
3934
Info: Populating pyproject.toml with package name: reflex-google-auth
4035
Info: Initializing the component directory: custom_components/reflex_google_auth
@@ -51,16 +46,13 @@ Custom component initialized successfully!
5146
[ pyproject.toml ]: Project configuration file. Please fill in details such as your name, email, homepage URL.
5247
[ custom_components/ ]: Custom component code template. Start by editing it with your component implementation.
5348
[ google_auth_demo/ ]: Demo App. Add more code to this app and test.
54-
""",
55-
)
5649
```
5750

5851
The `init` command uses the current enclosing folder name to construct a python package name, typically in the kebab case. For example, if running init in folder `google_auth`, the package name will be `reflex-google-auth`. The added prefix reduces the chance of name collision on PyPI (the Python Package Index), and it indicates that the package is a Reflex custom component. The user can override the package name by providing the `--package-name` option.
5952

6053
The `init` command creates a set of files and folders prefilled with the package name and other details. During the init, the `custom_component` folder is installed locally in editable mode, so a developer can incrementally develop and test with ease. The changes in component implementation is automatically reflected where it is used. Below is the folder structure after the `init` command.
6154

62-
```python eval
63-
rx._x.code_block("""
55+
```text
6456
google_auth/
6557
├── pyproject.toml
6658
├── README.md
@@ -73,17 +65,6 @@ google_auth/
7365
google_auth_demo/
7466
requirements.txt
7567
rxconfig.py
76-
""",
77-
language="bash",
78-
style={
79-
"border-radius": "12px",
80-
"border": "1px solid var(--c-slate-4)",
81-
"background": "var(--c-slate-2)",
82-
"color": "var(--c-slate-12)",
83-
"font-family": "Source Code Pro",
84-
**code
85-
}
86-
)
8768
```
8869

8970
### pyproject.toml
@@ -110,10 +91,12 @@ A demo app is generated inside `google_auth_demo` folder with import statements
11091

11192
The help manual is shown when adding the `--help` option to the command.
11293

113-
```python eval
114-
doccmdoutput(
115-
command="reflex component init --help",
116-
output="""Usage: reflex component init [OPTIONS]
94+
```bash
95+
reflex component init --help
96+
```
97+
98+
```text
99+
Usage: reflex component init [OPTIONS]
117100
118101
Initialize a custom component.
119102
@@ -134,7 +117,6 @@ Options:
134117
The log level to use. [default:
135118
LogLevel.INFO]
136119
--help Show this message and exit.
137-
""")
138120
```
139121

140122
## reflex component publish
@@ -149,10 +131,11 @@ It is not required to run the `build` command separately before publishing. The
149131

150132
The `build` command generates the `.tar.gz` and `.whl` distribution files to be uploaded to the desired package index, for example, PyPI. This command must be run at the top level of the project where the `pyproject.toml` file is. As a result of a successful build, there is a new `dist` folder with the distribution files.
151133

152-
```python eval
153-
doccmdoutput(
154-
command="reflex component build --help",
155-
output="""reflex component build --help
134+
```bash
135+
reflex component build --help
136+
```
137+
138+
```text
156139
Usage: reflex component build [OPTIONS]
157140
158141
Build a custom component. Must be run from the project root directory where
@@ -167,5 +150,4 @@ Options:
167150
The log level to use. [default:
168151
LogLevel.INFO]
169152
--help Show this message and exit.
170-
""")
171-
```
153+
```

0 commit comments

Comments
 (0)