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):
29
29
root_dir = Path (__file__ ).parent
30
30
src_dir = root_dir / "src"
31
31
package_dir = src_dir / name
32
- js_runtime_build = package_dir / "client" / "build"
33
32
34
33
35
34
# -----------------------------------------------------------------------------
@@ -143,8 +142,6 @@ def run(self):
143
142
log .error (traceback .format_exc ())
144
143
raise
145
144
else :
146
- if js_runtime_build .exists ():
147
- shutil .rmtree (js_runtime_build )
148
145
log .info ("Successfully installed Javascript" )
149
146
super ().run ()
150
147
Original file line number Diff line number Diff line change 1
1
import json
2
2
import re
3
3
import shutil
4
+ from os .path import getmtime
4
5
from pathlib import Path
5
6
from typing import Dict , Set , Tuple , cast
6
7
15
16
IDOM_CLIENT_IMPORT_SOURCE_URL_INFIX = "/_snowpack/pkg"
16
17
17
18
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
+
18
28
def get_user_packages_file (app_dir : Path ) -> Path :
19
29
return app_dir / "packages" / "idom-app-react" / "src" / "user-packages.js"
20
30
@@ -25,10 +35,6 @@ def web_modules_dir() -> Path:
25
35
)
26
36
27
37
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
-
32
38
def restore_build_dir_from_backup () -> None :
33
39
target = IDOM_CLIENT_BUILD_DIR .current
34
40
if target .exists ():
You can’t perform that action at this time.
0 commit comments