expose staticPageGenerationTimeout (#4266)

* expose staticPageGenerationTimeout

* update tests
This commit is contained in:
Khaleel Al-Adhami 2024-10-29 22:02:35 -07:00 committed by GitHub
parent 1f627c5a30
commit d478387007
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 5 deletions

View File

@ -451,6 +451,9 @@ class Config(Base):
# The bun path # The bun path
bun_path: ExistingPath = constants.Bun.DEFAULT_PATH bun_path: ExistingPath = constants.Bun.DEFAULT_PATH
# Timeout to do a production build of a frontend page.
static_page_generation_timeout: int = 60
# List of origins that are allowed to connect to the backend API. # List of origins that are allowed to connect to the backend API.
cors_allowed_origins: List[str] = ["*"] cors_allowed_origins: List[str] = ["*"]

View File

@ -677,6 +677,7 @@ def _update_next_config(
"compress": config.next_compression, "compress": config.next_compression,
"reactStrictMode": config.react_strict_mode, "reactStrictMode": config.react_strict_mode,
"trailingSlash": True, "trailingSlash": True,
"staticPageGenerationTimeout": config.static_page_generation_timeout,
} }
if transpile_packages: if transpile_packages:
next_config["transpilePackages"] = list( next_config["transpilePackages"] = list(

View File

@ -24,7 +24,15 @@ from reflex.utils.prerequisites import (
app_name="test", app_name="test",
), ),
False, False,
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true};', 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
app_name="test",
static_page_generation_timeout=30,
),
False,
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 30};',
), ),
( (
Config( Config(
@ -32,7 +40,7 @@ from reflex.utils.prerequisites import (
next_compression=False, next_compression=False,
), ),
False, False,
'module.exports = {basePath: "", compress: false, reactStrictMode: true, trailingSlash: true};', 'module.exports = {basePath: "", compress: false, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
), ),
( (
Config( Config(
@ -40,7 +48,7 @@ from reflex.utils.prerequisites import (
frontend_path="/test", frontend_path="/test",
), ),
False, False,
'module.exports = {basePath: "/test", compress: true, reactStrictMode: true, trailingSlash: true};', 'module.exports = {basePath: "/test", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
), ),
( (
Config( Config(
@ -49,14 +57,14 @@ from reflex.utils.prerequisites import (
next_compression=False, next_compression=False,
), ),
False, False,
'module.exports = {basePath: "/test", compress: false, reactStrictMode: true, trailingSlash: true};', 'module.exports = {basePath: "/test", compress: false, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
), ),
( (
Config( Config(
app_name="test", app_name="test",
), ),
True, True,
'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, output: "export", distDir: "_static"};', 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60, output: "export", distDir: "_static"};',
), ),
], ],
) )