Преглед изворни кода

Remove pynecone.json from templates (#888)

Nikhil Rao пре 2 година
родитељ
комит
7f5b172002
3 измењених фајлова са 3 додато и 9 уклоњено
  1. 0 3
      pynecone/.templates/web/pynecone.json
  2. 0 2
      pynecone/constants.py
  3. 3 4
      pynecone/utils/prerequisites.py

+ 0 - 3
pynecone/.templates/web/pynecone.json

@@ -1,3 +0,0 @@
-{
-    "version": "0.1.25"
-}

+ 0 - 2
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")
 

+ 3 - 4
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