Fix sitemap output dir (#1382)
This commit is contained in:
parent
23fa6d5ec4
commit
d1924bb4a6
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "reflex"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
description = "Web apps in pure Python."
|
||||
license = "Apache-2.0"
|
||||
authors = [
|
||||
|
@ -3,6 +3,7 @@
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"export": "next build && next export -o _static",
|
||||
"export-sitemap": "next build && next-sitemap && next export -o _static",
|
||||
"prod": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -69,6 +69,8 @@ JINJA_TEMPLATE_DIR = os.path.join(TEMPLATE_DIR, "jinja")
|
||||
WEB_DIR = ".web"
|
||||
# The name of the utils file.
|
||||
UTILS_DIR = "utils"
|
||||
# The name of the output static directory.
|
||||
STATIC_DIR = "_static"
|
||||
# The name of the state file.
|
||||
STATE_PATH = "/".join([UTILS_DIR, "state"])
|
||||
# The name of the components file.
|
||||
@ -76,7 +78,7 @@ COMPONENTS_PATH = "/".join([UTILS_DIR, "components"])
|
||||
# The directory where the app pages are compiled to.
|
||||
WEB_PAGES_DIR = os.path.join(WEB_DIR, "pages")
|
||||
# The directory where the static build is located.
|
||||
WEB_STATIC_DIR = os.path.join(WEB_DIR, "_static")
|
||||
WEB_STATIC_DIR = os.path.join(WEB_DIR, STATIC_DIR)
|
||||
# The directory where the utils file is located.
|
||||
WEB_UTILS_DIR = os.path.join(WEB_DIR, UTILS_DIR)
|
||||
# The directory where the assets are located.
|
||||
|
@ -86,15 +86,6 @@ def generate_sitemap_config(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,
|
||||
@ -115,8 +106,10 @@ def export_app(
|
||||
path_ops.rm(constants.WEB_STATIC_DIR)
|
||||
|
||||
# Generate the sitemap file.
|
||||
command = "export"
|
||||
if deploy_url is not None:
|
||||
generate_sitemap_config(deploy_url)
|
||||
command = "export-sitemap"
|
||||
|
||||
# Create a progress object
|
||||
progress = Progress(
|
||||
@ -143,7 +136,7 @@ def export_app(
|
||||
# Start the subprocess with the progress bar.
|
||||
try:
|
||||
with progress, new_process(
|
||||
[prerequisites.get_package_manager(), "run", "export"],
|
||||
[prerequisites.get_package_manager(), "run", command],
|
||||
cwd=constants.WEB_DIR,
|
||||
) as export_process:
|
||||
assert export_process.stdout is not None, "No stdout for export process."
|
||||
@ -168,10 +161,6 @@ 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":
|
||||
|
Loading…
Reference in New Issue
Block a user