Add --no-zip pc CLI Parameter (#479)
This commit is contained in:
parent
60949e24e6
commit
fdf0e9ea6b
@ -150,7 +150,11 @@ def deploy(dry_run: bool = typer.Option(False, help="Whether to run a dry run.")
|
|||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
def export():
|
def export(
|
||||||
|
zipping: bool = typer.Option(
|
||||||
|
True, "--no-zip", help="Disable zip for backend and frontend exports."
|
||||||
|
)
|
||||||
|
):
|
||||||
"""Export the app to a zip file."""
|
"""Export the app to a zip file."""
|
||||||
# Get the app config.
|
# Get the app config.
|
||||||
config = utils.get_config()
|
config = utils.get_config()
|
||||||
@ -159,10 +163,17 @@ def export():
|
|||||||
# Compile the app in production mode and export it.
|
# Compile the app in production mode and export it.
|
||||||
utils.console.rule("[bold]Compiling production app and preparing for export.")
|
utils.console.rule("[bold]Compiling production app and preparing for export.")
|
||||||
app = utils.get_app().app
|
app = utils.get_app().app
|
||||||
utils.export_app(app, zip=True)
|
utils.export_app(app, zip=zipping)
|
||||||
utils.console.rule(
|
if zipping:
|
||||||
"Backend & Frontend compiled. See [green bold]backend.zip[/green bold] and [green bold]frontend.zip[/green bold]."
|
utils.console.rule(
|
||||||
)
|
"""Backend & Frontend compiled. See [green bold]backend.zip[/green bold]
|
||||||
|
and [green bold]frontend.zip[/green bold]."""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
utils.console.rule(
|
||||||
|
"""Backend & Frontend compiled. See [green bold]app[/green bold]
|
||||||
|
and [green bold].web/_static[/green bold] directories."""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
main = cli
|
main = cli
|
||||||
|
@ -500,7 +500,10 @@ def export_app(app: App, zip: bool = False):
|
|||||||
|
|
||||||
# Zip up the app.
|
# Zip up the app.
|
||||||
if zip:
|
if zip:
|
||||||
cmd = r"cd .web/_static && zip -r ../../frontend.zip ./* && cd ../.. && zip -r backend.zip ./* -x .web/\* ./assets\* ./frontend.zip\* ./backend.zip\*"
|
if os.name == "posix":
|
||||||
|
cmd = r"cd .web/_static && zip -r ../../frontend.zip ./* && cd ../.. && zip -r backend.zip ./* -x .web/\* ./assets\* ./frontend.zip\* ./backend.zip\*"
|
||||||
|
if os.name == "nt":
|
||||||
|
cmd = r'powershell -Command "Set-Location .web/_static; Compress-Archive -Path .\* -DestinationPath ..\..\frontend.zip; Set-Location ..\..; Compress-Archive -Path .\* -DestinationPath backend.zip -Exclude .web\*, assets\*, frontend.zip, backend.zip"'
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ def component1() -> Type[Component]:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
class TestComponent1(Component):
|
class TestComponent1(Component):
|
||||||
|
|
||||||
# A test string prop.
|
# A test string prop.
|
||||||
text: Var[str]
|
text: Var[str]
|
||||||
|
|
||||||
@ -52,7 +51,6 @@ def component2() -> Type[Component]:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
class TestComponent2(Component):
|
class TestComponent2(Component):
|
||||||
|
|
||||||
# A test list prop.
|
# A test list prop.
|
||||||
arr: Var[List[str]]
|
arr: Var[List[str]]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user