File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -165,3 +165,7 @@ _version.py
165
165
# npm
166
166
node_modules /
167
167
package-lock.json
168
+
169
+
170
+ # Django
171
+ tests /staticfiles /
Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ def parse_root_package(package_json):
24
24
url = mod
25
25
if mod [0 ] in ["." , "/" ]:
26
26
# local file
27
- url = get_static_from_abs_path (settings .BASE_DIR / mod )
28
27
if mod .endswith ("/*" ):
29
- url = url [:- 2 ] + "/"
28
+ mod = mod [:- 1 ]
30
29
module_name = module_name [:- 1 ]
30
+ url = get_static_from_abs_path (settings .BASE_DIR / mod )
31
31
yield module_name , url
32
32
33
33
for dep_name , dep_version in package_json .get ("dependencies" , {}).items ():
@@ -38,10 +38,12 @@ def get_static_from_abs_path(path: Path):
38
38
for finder in get_finders ():
39
39
for storage in finder .storages .values ():
40
40
try :
41
- rel_path = path .relative_to (Path (storage .location ))
41
+ rel_path = path .relative_to (Path (storage .location ). resolve () )
42
42
except ValueError :
43
43
pass
44
44
else :
45
+ if path .is_dir ():
46
+ return settings .STATIC_URL + str (rel_path ) + "/"
45
47
return staticfiles_storage .url (str (rel_path ))
46
48
raise ValueError (f"Could not find { path } in staticfiles" )
47
49
@@ -84,7 +86,7 @@ def parse_package_json(path: Path = None):
84
86
mod = module
85
87
86
88
yield str (Path (name ) / module_name ), staticfiles_storage .url (
87
- str ((path / mod ).relative_to (settings .BASE_DIR / "node_modules" ))
89
+ str ((path / mod ).resolve (). relative_to (settings .BASE_DIR / "node_modules" ))
88
90
)
89
91
90
92
if (path / "node_modules" ).exists ():
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ source = ["django_esm"]
74
74
75
75
[tool .coverage .report ]
76
76
show_missing = true
77
- omit = [" django_esm/_version.py" ]
77
+ omit = [" django_esm/_version.py" , " tests/* " ]
78
78
79
79
[tool .isort ]
80
80
atomic = true
You can’t perform that action at this time.
0 commit comments