File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ def list2cmdline(cmd_list):
2929root_dir = Path (__file__ ).parent
3030src_dir = root_dir / "src"
3131package_dir = src_dir / name
32- js_runtime_build = package_dir / "client" / "build"
3332
3433
3534# -----------------------------------------------------------------------------
@@ -143,8 +142,6 @@ def run(self):
143142 log .error (traceback .format_exc ())
144143 raise
145144 else :
146- if js_runtime_build .exists ():
147- shutil .rmtree (js_runtime_build )
148145 log .info ("Successfully installed Javascript" )
149146 super ().run ()
150147
Original file line number Diff line number Diff line change 11import json
22import re
33import shutil
4+ from os .path import getmtime
45from pathlib import Path
56from typing import Dict , Set , Tuple , cast
67
1516IDOM_CLIENT_IMPORT_SOURCE_URL_INFIX = "/_snowpack/pkg"
1617
1718
19+ if getmtime (BACKUP_BUILD_DIR ) > getmtime (IDOM_CLIENT_BUILD_DIR .current ):
20+ # delete the runtime build if the backup build is newer (i.e. IDOM was re-installed)
21+ shutil .rmtree (IDOM_CLIENT_BUILD_DIR .current )
22+
23+ if not IDOM_CLIENT_BUILD_DIR .current .exists ():
24+ # populate the runtime build directory if it doesn't exist
25+ shutil .copytree (BACKUP_BUILD_DIR , IDOM_CLIENT_BUILD_DIR .current , symlinks = True )
26+
27+
1828def get_user_packages_file (app_dir : Path ) -> Path :
1929 return app_dir / "packages" / "idom-app-react" / "src" / "user-packages.js"
2030
@@ -25,10 +35,6 @@ def web_modules_dir() -> Path:
2535 )
2636
2737
28- if not IDOM_CLIENT_BUILD_DIR .current .exists (): # pragma: no cover
29- shutil .copytree (BACKUP_BUILD_DIR , IDOM_CLIENT_BUILD_DIR .current , symlinks = True )
30-
31-
3238def restore_build_dir_from_backup () -> None :
3339 target = IDOM_CLIENT_BUILD_DIR .current
3440 if target .exists ():
You can’t perform that action at this time.
0 commit comments