Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a helper to install elk.js ahead of time #97

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion capellambse_context_diagrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from capellambse.model.layers import ctx, la, oa, pa
from capellambse.model.modeltypes import DiagramType

from . import context, styling
from . import _elkjs, context, styling

try:
__version__ = metadata.version("capellambse-context-diagrams")
Expand All @@ -46,6 +46,18 @@
ATTR_NAME = "context_diagram"


def install_elk() -> None:
"""Install elk.js and its dependencies into the local cache directory.

When rendering a context diagram, elk.js will be installed
automatically into a persistent local cache directory. This function
may be called while building a container, starting a server or
similar tasks in order to prepare the elk.js execution environment
ahead of time.
"""
_elkjs._install_required_npm_pkg_versions()


def init() -> None:
"""Initialize the extension."""
register_classes()
Expand Down
Loading