Generate sitemap on export (#1358)
* Generate sitemap on export * Remove prints
This commit is contained in:
parent
be9120b251
commit
3f151f054d
@ -16,10 +16,10 @@
|
||||
"focus-visible": "^5.2.0",
|
||||
"framer-motion": "^10.12.4",
|
||||
"gridjs": "^6.0.6",
|
||||
"universal-cookie": "^4.0.4",
|
||||
"gridjs-react": "^6.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"next": "^13.3.1",
|
||||
"next-sitemap": "^4.1.8",
|
||||
"plotly.js": "^2.22.0",
|
||||
"react": "^18.2.0",
|
||||
"react-debounce-input": "^3.3.0",
|
||||
@ -34,6 +34,7 @@
|
||||
"remark-gfm": "^3.0.1",
|
||||
"remark-math": "^5.1.1",
|
||||
"socket.io-client": "^4.6.1",
|
||||
"universal-cookie": "^4.0.4",
|
||||
"victory": "^36.6.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -148,8 +148,8 @@ class Tr(ChakraComponent):
|
||||
Args:
|
||||
children: The children of the component.
|
||||
props: The properties of the component.
|
||||
cell_type (str): the type of cells in this table row. "header" or "data". Defaults to None.
|
||||
cells (list, optional): The cells value to add in the table row. Defaults to None.
|
||||
cell_type: the type of cells in this table row. "header" or "data". Defaults to None.
|
||||
cells: The cells value to add in the table row. Defaults to None.
|
||||
|
||||
Returns:
|
||||
The table row component
|
||||
|
@ -24,9 +24,9 @@ class Alert(ChakraComponent):
|
||||
|
||||
Args:
|
||||
children: The children of the component.
|
||||
icon (bool): The icon of the alert.
|
||||
title (str): The title of the alert.
|
||||
desc (str): The description of the alert
|
||||
icon: The icon of the alert.
|
||||
title: The title of the alert.
|
||||
desc: The description of the alert
|
||||
props: The properties of the component.
|
||||
|
||||
Returns:
|
||||
|
@ -12,6 +12,7 @@ from typing import Optional, Union
|
||||
from rich.progress import MofNCompleteColumn, Progress, TimeElapsedColumn
|
||||
|
||||
from reflex import constants
|
||||
from reflex.config import get_config
|
||||
from reflex.utils import console, path_ops, prerequisites
|
||||
from reflex.utils.processes import new_process
|
||||
|
||||
@ -65,7 +66,7 @@ def set_os_env(**kwargs):
|
||||
os.environ[key.upper()] = value
|
||||
|
||||
|
||||
def generate_sitemap(deploy_url: str):
|
||||
def generate_sitemap_config(deploy_url: str):
|
||||
"""Generate the sitemap config file.
|
||||
|
||||
Args:
|
||||
@ -85,6 +86,15 @@ def generate_sitemap(deploy_url: str):
|
||||
f.write(templates.SITEMAP_CONFIG(config=config))
|
||||
|
||||
|
||||
def generate_sitemap():
|
||||
"""Generate the actual sitemap."""
|
||||
subprocess.run(
|
||||
[prerequisites.get_package_manager(), "run", "next-sitemap"],
|
||||
cwd=constants.WEB_DIR,
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
|
||||
|
||||
def export_app(
|
||||
backend: bool = True,
|
||||
frontend: bool = True,
|
||||
@ -106,7 +116,7 @@ def export_app(
|
||||
|
||||
# Generate the sitemap file.
|
||||
if deploy_url is not None:
|
||||
generate_sitemap(deploy_url)
|
||||
generate_sitemap_config(deploy_url)
|
||||
|
||||
# Create a progress object
|
||||
progress = Progress(
|
||||
@ -158,6 +168,10 @@ def export_app(
|
||||
)
|
||||
os._exit(1)
|
||||
|
||||
# Generate the actual sitemap.
|
||||
if deploy_url is not None:
|
||||
generate_sitemap()
|
||||
|
||||
# Zip up the app.
|
||||
if zip:
|
||||
if os.name == "posix":
|
||||
@ -256,4 +270,4 @@ def setup_frontend_prod(
|
||||
disable_telemetry: Whether to disable the Next telemetry.
|
||||
"""
|
||||
setup_frontend(root, loglevel, disable_telemetry)
|
||||
export_app(loglevel=loglevel)
|
||||
export_app(loglevel=loglevel, deploy_url=get_config().deploy_url)
|
||||
|
@ -25,7 +25,7 @@ def log(msg: str) -> None:
|
||||
"""Takes a string and logs it to the console.
|
||||
|
||||
Args:
|
||||
msg (str): The message to log.
|
||||
msg: The message to log.
|
||||
"""
|
||||
_console.log(msg)
|
||||
|
||||
@ -34,7 +34,7 @@ def print(msg: str) -> None:
|
||||
"""Prints the given message to the console.
|
||||
|
||||
Args:
|
||||
msg (str): The message to print to the console.
|
||||
msg: The message to print to the console.
|
||||
"""
|
||||
_console.print(msg)
|
||||
|
||||
@ -43,7 +43,7 @@ def rule(title: str) -> None:
|
||||
"""Prints a horizontal rule with a title.
|
||||
|
||||
Args:
|
||||
title (str): The title of the rule.
|
||||
title: The title of the rule.
|
||||
"""
|
||||
_console.rule(title)
|
||||
|
||||
@ -55,9 +55,9 @@ def ask(
|
||||
and returns the user input.
|
||||
|
||||
Args:
|
||||
question (str): The question to ask the user.
|
||||
choices (Optional[List[str]]): A list of choices to select from.
|
||||
default(Optional[str]): The default option selected.
|
||||
question: The question to ask the user.
|
||||
choices: A list of choices to select from.
|
||||
default: The default option selected.
|
||||
|
||||
Returns:
|
||||
A string
|
||||
@ -70,7 +70,7 @@ def status(msg: str) -> Status:
|
||||
which can be used as a context manager.
|
||||
|
||||
Args:
|
||||
msg (str): The message to be used as status title.
|
||||
msg: The message to be used as status title.
|
||||
|
||||
Returns:
|
||||
The status of the console.
|
||||
|
@ -309,7 +309,7 @@ def install_frontend_packages(web_dir: str):
|
||||
into the given web directory.
|
||||
|
||||
Args:
|
||||
web_dir (str): The directory where the frontend code is located.
|
||||
web_dir: The directory where the frontend code is located.
|
||||
"""
|
||||
# Install the frontend packages.
|
||||
console.rule("[bold]Installing frontend packages")
|
||||
|
Loading…
Reference in New Issue
Block a user