remove frontend_package option (#1700)
This commit is contained in:
parent
71811a600c
commit
03a92bc60e
@ -493,7 +493,7 @@ class App(Base):
|
||||
Example:
|
||||
>>> get_frontend_packages({"react": "16.14.0", "react-dom": "16.14.0"})
|
||||
"""
|
||||
page_imports = [
|
||||
page_imports = {
|
||||
i
|
||||
for i in imports
|
||||
if i not in compiler.DEFAULT_IMPORTS.keys()
|
||||
@ -501,8 +501,22 @@ class App(Base):
|
||||
and "next" not in i
|
||||
and not i.startswith("/")
|
||||
and i != ""
|
||||
]
|
||||
page_imports.extend(get_config().frontend_packages)
|
||||
}
|
||||
frontend_packages = get_config().frontend_packages
|
||||
_frontend_packages = []
|
||||
for package in frontend_packages:
|
||||
if package in get_config().tailwind.get("plugins", []): # type: ignore
|
||||
console.warn(
|
||||
f"Tailwind packages are inferred from 'plugins', remove `{package}` from `frontend_packages`"
|
||||
)
|
||||
continue
|
||||
if package in page_imports:
|
||||
console.warn(
|
||||
f"React packages and their dependencies are inferred from Component.library and Component.lib_dependencies, remove `{package}` from `frontend_packages`"
|
||||
)
|
||||
continue
|
||||
_frontend_packages.append(package)
|
||||
page_imports.update(_frontend_packages)
|
||||
prerequisites.install_frontend_packages(page_imports)
|
||||
|
||||
def compile(self):
|
||||
|
@ -180,10 +180,10 @@ class Config(Base):
|
||||
# The event namespace for ws connection
|
||||
event_namespace: Optional[str] = None
|
||||
|
||||
# Params to remove eventually.
|
||||
# Additional frontend packages to install. (TODO: these can be inferred from the imports)
|
||||
# Additional frontend packages to install.
|
||||
frontend_packages: List[str] = []
|
||||
|
||||
# Params to remove eventually.
|
||||
# For rest are for deploy only.
|
||||
# The rxdeploy url.
|
||||
rxdeploy_url: Optional[str] = None
|
||||
|
@ -406,7 +406,7 @@ def install_bun():
|
||||
)
|
||||
|
||||
|
||||
def install_frontend_packages(packages: list[str]):
|
||||
def install_frontend_packages(packages: set[str]):
|
||||
"""Installs the base and custom frontend packages.
|
||||
|
||||
Args:
|
||||
@ -424,14 +424,25 @@ def install_frontend_packages(packages: list[str]):
|
||||
|
||||
processes.show_status("Installing base frontend packages", process)
|
||||
|
||||
# Install the custom packages, if any.
|
||||
config = get_config()
|
||||
if config.tailwind is not None and "plugins" in config.tailwind:
|
||||
process = processes.new_process(
|
||||
[get_install_package_manager(), "add", *config.tailwind["plugins"]],
|
||||
cwd=constants.WEB_DIR,
|
||||
shell=constants.IS_WINDOWS,
|
||||
)
|
||||
processes.show_status("Installing tailwind packages", process)
|
||||
|
||||
# Install custom packages defined in frontend_packages
|
||||
if len(packages) > 0:
|
||||
process = processes.new_process(
|
||||
[get_install_package_manager(), "add", *packages],
|
||||
cwd=constants.WEB_DIR,
|
||||
shell=constants.IS_WINDOWS,
|
||||
)
|
||||
processes.show_status("Installing frontend packages for components", process)
|
||||
processes.show_status(
|
||||
"Installing frontend packages from config and components", process
|
||||
)
|
||||
|
||||
|
||||
def check_initialized(frontend: bool = True):
|
||||
|
Loading…
Reference in New Issue
Block a user