diff --git a/docs/source/about/changelog.rst b/docs/source/about/changelog.rst index 325481f9a..8768c5160 100644 --- a/docs/source/about/changelog.rst +++ b/docs/source/about/changelog.rst @@ -25,6 +25,7 @@ Unreleased - :pull:`1200` - Fixed ``UnicodeDecodeError`` when using ``reactpy.web.export`` - :pull:`1224` - Fixes needless unmounting of JavaScript components during each ReactPy render. - :pull:`1126` - Fixed missing ``event["target"]["checked"]`` on checkbox inputs +- :pull:`1191` - Fixed missing static files on `sdist` Python distribution **Added** diff --git a/src/js/app/vite.config.js b/src/js/app/vite.config.js index c97fb6dac..64a015757 100644 --- a/src/js/app/vite.config.js +++ b/src/js/app/vite.config.js @@ -7,6 +7,7 @@ export default defineConfig({ react: "preact/compat", "react-dom": "preact/compat", }, + preserveSymlinks: true, }, base: "/_reactpy/", }); diff --git a/src/py/reactpy/.gitignore b/src/py/reactpy/.gitignore index 0499d7590..b4362ae8c 100644 --- a/src/py/reactpy/.gitignore +++ b/src/py/reactpy/.gitignore @@ -2,3 +2,4 @@ # --- Build Artifacts --- reactpy/_static +js diff --git a/src/py/reactpy/pyproject.toml b/src/py/reactpy/pyproject.toml index e5a2559b7..05d35c8e1 100644 --- a/src/py/reactpy/pyproject.toml +++ b/src/py/reactpy/pyproject.toml @@ -103,11 +103,20 @@ dependencies = [ types = "mypy --strict reactpy" all = ["types"] +[tool.hatch.build.targets.sdist] +artifacts = ["_static"] + +[tool.hatch.build.targets.wheel] +artifacts = ["_static"] + [[tool.hatch.build.hooks.build-scripts.scripts]] -work_dir = "../../js" out_dir = "reactpy/_static" -commands = ["npm ci", "npm run build"] -artifacts = ["app/dist/"] +commands = [ + # link the js directory if it doesn't exist - use Python to avoid platform differences + "python -c \"import pathlib as p;js=p.Path('js');js.unlink(missing_ok=True);js.symlink_to(p.Path('..','..','js').resolve(),target_is_directory=True);\"", + "cd js && npm ci && npm run build", +] +artifacts = ["js/app/dist/"] # --- Pytest --------------------------------------------------------------------------- diff --git a/src/py/reactpy/reactpy/backend/_common.py b/src/py/reactpy/reactpy/backend/_common.py index b4d6af19c..77c9a7ae0 100644 --- a/src/py/reactpy/reactpy/backend/_common.py +++ b/src/py/reactpy/reactpy/backend/_common.py @@ -21,7 +21,7 @@ MODULES_PATH = PATH_PREFIX / "modules" ASSETS_PATH = PATH_PREFIX / "assets" STREAM_PATH = PATH_PREFIX / "stream" -CLIENT_BUILD_DIR = Path(_reactpy_file_path).parent / "_static" / "app" / "dist" +CLIENT_BUILD_DIR = Path(_reactpy_file_path).parent / "_static" / "js" / "app" / "dist" async def serve_with_uvicorn( diff --git a/tasks.py b/tasks.py index e11d291e3..5669025a4 100644 --- a/tasks.py +++ b/tasks.py @@ -416,8 +416,9 @@ def prepare_py_release( def publish(dry_run: bool): with context.cd(package.path): + context.run("twine check dist/*") + if dry_run: - context.run("twine check dist/*") return context.run(