mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-17 09:56:06 +00:00
fix: update build pipelines for Vite migration (out → dist)
- Dockerfile: npm run build → npx vite build, web/out → web/dist - pyproject.toml: package-data web/out/** → web/dist/** - paths.py: support both web/dist (Vite) and web/out (legacy) with fallback
This commit is contained in:
+2
-2
@@ -4,7 +4,7 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY web ./web
|
COPY web ./web
|
||||||
|
|
||||||
RUN cd web && npm install && npm run build
|
RUN cd web && npm install && npx vite build
|
||||||
|
|
||||||
FROM python:3.12.7-slim
|
FROM python:3.12.7-slim
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
COPY --from=node /app/web/out ./web/out
|
COPY --from=node /app/web/dist ./web/dist
|
||||||
|
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install gcc -y \
|
&& apt install gcc -y \
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ requires = ["setuptools>=61.0", "wheel"]
|
|||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
package-data = { "langbot" = ["templates/**", "pkg/provider/modelmgr/requesters/*", "pkg/platform/sources/*", "web/out/**"] }
|
package-data = { "langbot" = ["templates/**", "pkg/provider/modelmgr/requesters/*", "pkg/platform/sources/*", "web/dist/**"] }
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
|
|||||||
@@ -38,28 +38,31 @@ def get_frontend_path() -> str:
|
|||||||
"""
|
"""
|
||||||
Get the path to the frontend build files.
|
Get the path to the frontend build files.
|
||||||
|
|
||||||
Returns the path to web/out directory, handling both:
|
Returns the path to web/dist directory (Vite build output), handling both:
|
||||||
- Development mode: running from source directory
|
- Development mode: running from source directory
|
||||||
- Package mode: installed via pip/uvx
|
- Package mode: installed via pip/uvx
|
||||||
|
- Legacy mode: web/out (Next.js, for backward compatibility)
|
||||||
"""
|
"""
|
||||||
# First, check if we're running from source directory
|
# Check both dist (Vite) and out (legacy Next.js) paths
|
||||||
if _check_if_source_install() and os.path.exists('web/out'):
|
for dirname in ('dist', 'out'):
|
||||||
return 'web/out'
|
web_dir = f'web/{dirname}'
|
||||||
|
|
||||||
# Second, check current directory for web/out (in case user is in source dir)
|
# First, check if we're running from source directory
|
||||||
if os.path.exists('web/out'):
|
if _check_if_source_install() and os.path.exists(web_dir):
|
||||||
return 'web/out'
|
return web_dir
|
||||||
|
|
||||||
# Third, find it relative to the package installation
|
# Second, check current directory
|
||||||
# Get the directory where this file is located
|
if os.path.exists(web_dir):
|
||||||
# paths.py is in pkg/utils/, so parent.parent goes up to pkg/, then parent again goes up to the package root
|
return web_dir
|
||||||
pkg_dir = Path(__file__).parent.parent.parent
|
|
||||||
frontend_path = pkg_dir / 'web' / 'out'
|
# Third, find it relative to the package installation
|
||||||
if frontend_path.exists():
|
pkg_dir = Path(__file__).parent.parent.parent
|
||||||
return str(frontend_path)
|
frontend_path = pkg_dir / 'web' / dirname
|
||||||
|
if frontend_path.exists():
|
||||||
|
return str(frontend_path)
|
||||||
|
|
||||||
# Return the default path (will be checked by caller)
|
# Return the default path (will be checked by caller)
|
||||||
return 'web/out'
|
return 'web/dist'
|
||||||
|
|
||||||
|
|
||||||
def get_resource_path(resource: str) -> str:
|
def get_resource_path(resource: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user