Added better check for bun version. (#877)

This commit is contained in:
Alek Petuskey 2023-04-25 23:35:50 -07:00 committed by GitHub
parent ddcdfbc671
commit 1a8e0b8058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -18,9 +18,9 @@ VERSION = pkg_resources.get_distribution(PACKAGE_NAME).version
MIN_NODE_VERSION = "12.22.0"
# Valid bun versions.
MIN_BUN_VERSION = "0.5.5"
MIN_BUN_VERSION = "0.5.8"
MAX_BUN_VERSION = "0.5.9"
INVALID_BUN_VERSIONS = ["0.5.6", "0.5.7"]
INVALID_BUN_VERSIONS = ["0.5.5", "0.5.6", "0.5.7"]
# Files and directories used to init a new project.
# The root directory of the pynecone library.

View File

@ -211,19 +211,27 @@ def install_bun():
"""Install bun onto the user's system.
Raises:
Exit: If the bun version is not supported.
FileNotFoundError: If the required packages are not installed.
"""
bun_version = get_bun_version()
if bun_version is not None and bun_version in constants.INVALID_BUN_VERSIONS:
console.print(
f"[red]Bun version {bun_version} is not supported by Pynecone. Please downgrade to bun version {constants.MIN_BUN_VERSION} or upgrade to {constants.MAX_BUN_VERSION} or higher."
f"""[red]Bun version {bun_version} is not supported by Pynecone. Please change your to bun version to be between {constants.MIN_BUN_VERSION} and {constants.MAX_BUN_VERSION}."""
)
return
console.print(
f"""[red]Upgrade by running the following command:[/red]
curl -fsSL https://bun.sh/install | bash -s -- bun-v{constants.MAX_BUN_VERSION}
"""
)
raise typer.Exit()
# Bun is not supported on Windows.
if platform.system() == "Windows":
console.log("Skipping bun installation on Windows.")
return
raise typer.Exit()
# Only install if bun is not already installed.
if not os.path.exists(get_package_manager()):

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pynecone"
version = "0.1.23"
version = "0.1.26"
description = "Web apps in pure Python."
license = "Apache-2.0"
authors = [