Remove pynecone.json from templates (#888)

This commit is contained in:
Nikhil Rao 2023-04-26 16:57:25 -07:00 committed by GitHub
parent a165d745f2
commit 7f5b172002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 9 deletions

View File

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

View File

@ -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")

View File

@ -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