From 93b39957cc30578971b27355b2569850b8cabdc7 Mon Sep 17 00:00:00 2001 From: raymond-u <36328498+raymond-u@users.noreply.github.com> Date: Fri, 15 Mar 2024 23:40:16 +0800 Subject: [PATCH] refactor: remove unnecessary variable --- src/lungo_cli/core/context.py | 5 ----- src/lungo_cli/models/context.py | 1 - src/lungo_cli/resources/web/Dockerfile.jinja | 6 ++++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lungo_cli/core/context.py b/src/lungo_cli/core/context.py index 5a29b59d..e69f60e3 100644 --- a/src/lungo_cli/core/context.py +++ b/src/lungo_cli/core/context.py @@ -106,10 +106,6 @@ def web_app_info(self) -> list[dict[str, str | None]]: for plugin_output in self.plugin_outputs ] - @property - def web_extra_dependencies(self) -> list[str]: - return [dep for plugin_output in self.plugin_outputs for dep in plugin_output.web_dependencies] - @property def context(self) -> Context: return Context( @@ -121,5 +117,4 @@ def context(self) -> Context: dev=self.dev, ip_addresses=self.ip_addresses, web_app_info=self.web_app_info, - web_extra_dependencies=self.web_extra_dependencies, ) diff --git a/src/lungo_cli/models/context.py b/src/lungo_cli/models/context.py index 7a89e3a2..781e2767 100644 --- a/src/lungo_cli/models/context.py +++ b/src/lungo_cli/models/context.py @@ -24,4 +24,3 @@ class Context(Base): dev: bool ip_addresses: dict[str, IPv4Address] web_app_info: list[dict[str, str | None]] - web_extra_dependencies: list[str] diff --git a/src/lungo_cli/resources/web/Dockerfile.jinja b/src/lungo_cli/resources/web/Dockerfile.jinja index 1a1d4234..ce2e58b1 100644 --- a/src/lungo_cli/resources/web/Dockerfile.jinja +++ b/src/lungo_cli/resources/web/Dockerfile.jinja @@ -4,8 +4,10 @@ FROM docker.io/library/node:{{ NODE_VER }} AS builder WORKDIR /app COPY package.json pnpm-lock.yaml . RUN corepack enable && pnpm install --frozen-lockfile && \ - {% for dep in web_extra_dependencies %} - pnpm add '{{ dep }}' && \ + {% for plugin_output in plugin_outputs %} + {% for dependency in plugin_output.web_dependencies %} + pnpm add '{{ dependency }}' && \ + {% endfor %} {% endfor %} mv package.json package.json.bak && mv pnpm-lock.yaml pnpm-lock.yaml.bak COPY . .