Skip to content

Commit

Permalink
fix: store static file path relative to dist dir in manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbonczek authored and MartinGauk committed Jul 15, 2024
1 parent cd7eb84 commit bc6b82d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion questionpy_sdk/package/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _write_glob(
if add_to_static_files:
mime_type = guess_type(source_file)[0]
file_size = source_file.stat().st_size
path_in_dist = str(path_in_pkg.relative_to(Path(DIST_DIR, "static")))
path_in_dist = str(path_in_pkg.relative_to(DIST_DIR))
self._static_files[path_in_dist] = PackageFile(mime_type=mime_type, size=file_size)

@staticmethod
Expand Down
8 changes: 4 additions & 4 deletions tests/questionpy_sdk/package/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ def test_writes_manifest(qpy_pkg_path: Path) -> None:
manifest = Manifest.model_validate_json(manifest_file.read())

assert manifest.short_name == "static_files_example"
assert manifest.static_files["css/styles.css"].mime_type == "text/css"
assert manifest.static_files["css/styles.css"].size > 0
assert manifest.static_files["js/test.js"].mime_type == "text/javascript"
assert manifest.static_files["js/test.js"].size > 0
assert manifest.static_files["static/css/styles.css"].mime_type == "text/css"
assert manifest.static_files["static/css/styles.css"].size > 0
assert manifest.static_files["static/js/test.js"].mime_type == "text/javascript"
assert manifest.static_files["static/js/test.js"].size > 0


def test_runs_pre_build_hook(tmp_path: Path, source_path: Path) -> None:
Expand Down

0 comments on commit bc6b82d

Please sign in to comment.