diff --git a/pynecone/pc.py b/pynecone/pc.py index 8c5f1e787..6189b3f8d 100644 --- a/pynecone/pc.py +++ b/pynecone/pc.py @@ -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 diff --git a/pynecone/utils.py b/pynecone/utils.py index be7720cf1..1009d0034 100644 --- a/pynecone/utils.py +++ b/pynecone/utils.py @@ -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) diff --git a/tests/components/test_component.py b/tests/components/test_component.py index 568f1b8b0..8ebaecc6a 100644 --- a/tests/components/test_component.py +++ b/tests/components/test_component.py @@ -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]]