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
165165# npm
166166node_modules /
167167package-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):
2424 url = mod
2525 if mod [0 ] in ["." , "/" ]:
2626 # local file
27- url = get_static_from_abs_path (settings .BASE_DIR / mod )
2827 if mod .endswith ("/*" ):
29- url = url [:- 2 ] + "/"
28+ mod = mod [:- 1 ]
3029 module_name = module_name [:- 1 ]
30+ url = get_static_from_abs_path (settings .BASE_DIR / mod )
3131 yield module_name , url
3232
3333 for dep_name , dep_version in package_json .get ("dependencies" , {}).items ():
@@ -38,10 +38,12 @@ def get_static_from_abs_path(path: Path):
3838 for finder in get_finders ():
3939 for storage in finder .storages .values ():
4040 try :
41- rel_path = path .relative_to (Path (storage .location ))
41+ rel_path = path .relative_to (Path (storage .location ). resolve () )
4242 except ValueError :
4343 pass
4444 else :
45+ if path .is_dir ():
46+ return settings .STATIC_URL + str (rel_path ) + "/"
4547 return staticfiles_storage .url (str (rel_path ))
4648 raise ValueError (f"Could not find { path } in staticfiles" )
4749
@@ -84,7 +86,7 @@ def parse_package_json(path: Path = None):
8486 mod = module
8587
8688 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" ))
8890 )
8991
9092 if (path / "node_modules" ).exists ():
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ source = ["django_esm"]
7474
7575[tool .coverage .report ]
7676show_missing = true
77- omit = [" django_esm/_version.py" ]
77+ omit = [" django_esm/_version.py" , " tests/* " ]
7878
7979[tool .isort ]
8080atomic = true
You can’t perform that action at this time.
0 commit comments