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()
|
||||
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."""
|
||||
# Get the app config.
|
||||
config = utils.get_config()
|
||||
@ -159,10 +163,17 @@ def export():
|
||||
# Compile the app in production mode and export it.
|
||||
utils.console.rule("[bold]Compiling production app and preparing for export.")
|
||||
app = utils.get_app().app
|
||||
utils.export_app(app, zip=True)
|
||||
utils.console.rule(
|
||||
"Backend & Frontend compiled. See [green bold]backend.zip[/green bold] and [green bold]frontend.zip[/green bold]."
|
||||
)
|
||||
utils.export_app(app, zip=zipping)
|
||||
if zipping:
|
||||
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
|
||||
|
@ -500,7 +500,10 @@ def export_app(app: App, zip: bool = False):
|
||||
|
||||
# Zip up the app.
|
||||
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)
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@ def component1() -> Type[Component]:
|
||||
"""
|
||||
|
||||
class TestComponent1(Component):
|
||||
|
||||
# A test string prop.
|
||||
text: Var[str]
|
||||
|
||||
@ -52,7 +51,6 @@ def component2() -> Type[Component]:
|
||||
"""
|
||||
|
||||
class TestComponent2(Component):
|
||||
|
||||
# A test list prop.
|
||||
arr: Var[List[str]]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user