From 7f5b172002ae6757180913489df4f6eccd0046a9 Mon Sep 17 00:00:00 2001 From: Nikhil Rao Date: Wed, 26 Apr 2023 16:57:25 -0700 Subject: [PATCH] Remove pynecone.json from templates (#888) --- pynecone/.templates/web/pynecone.json | 3 --- pynecone/constants.py | 2 -- pynecone/utils/prerequisites.py | 7 +++---- 3 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 pynecone/.templates/web/pynecone.json diff --git a/pynecone/.templates/web/pynecone.json b/pynecone/.templates/web/pynecone.json deleted file mode 100644 index 89f1f2322..000000000 --- a/pynecone/.templates/web/pynecone.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "0.1.25" -} diff --git a/pynecone/constants.py b/pynecone/constants.py index 5c1cdc864..f85336d63 100644 --- a/pynecone/constants.py +++ b/pynecone/constants.py @@ -57,8 +57,6 @@ SITEMAP_CONFIG_FILE = os.path.join(WEB_DIR, "next-sitemap.config.js") NODE_MODULES = "node_modules" # The package lock file. PACKAGE_LOCK = "package-lock.json" -# The pcversion template file. -PCVERSION_TEMPLATE_FILE = os.path.join(WEB_TEMPLATE_DIR, "pynecone.json") # The pcversion app file. PCVERSION_APP_FILE = os.path.join(WEB_DIR, "pynecone.json") diff --git a/pynecone/utils/prerequisites.py b/pynecone/utils/prerequisites.py index d63888841..3f664af94 100644 --- a/pynecone/utils/prerequisites.py +++ b/pynecone/utils/prerequisites.py @@ -205,7 +205,8 @@ def initialize_web_directory(): path_ops.rm(os.path.join(constants.WEB_TEMPLATE_DIR, constants.NODE_MODULES)) path_ops.rm(os.path.join(constants.WEB_TEMPLATE_DIR, constants.PACKAGE_LOCK)) path_ops.cp(constants.WEB_TEMPLATE_DIR, constants.WEB_DIR) - """Write the current version of distributed pynecone package to a PCVERSION_APP_FILE.""" + + # Write the current version of distributed pynecone package to a PCVERSION_APP_FILE.""" with open(constants.PCVERSION_APP_FILE) as f: # type: ignore pynecone_json = json.load(f) pynecone_json["version"] = constants.VERSION @@ -298,10 +299,8 @@ def is_latest_template() -> bool: Returns: Whether the app is using the latest template. """ - with open(constants.PCVERSION_TEMPLATE_FILE) as f: # type: ignore - template_version = json.load(f)["version"] if not os.path.exists(constants.PCVERSION_APP_FILE): return False with open(constants.PCVERSION_APP_FILE) as f: # type: ignore app_version = json.load(f)["version"] - return app_version >= template_version + return app_version == constants.VERSION