isomer.ui.builder module¶
Frontend building process.
Since this involves a lot of javascript handling, it is best advised to not directly use any of the functionality except install_frontend and maybe rebuild_frontend.
-
copy_directory_tree
(root_src_dir: str, root_dst_dir: str, hardlink: bool = False, move: bool = False)[source]¶ Copies/links/moves a whole directory tree
Parameters: - root_src_dir (
str
) – Source filesystem location - root_dst_dir (
str
) – Target filesystem location - hardlink (
bool
) – Create hardlinks instead of copying (experimental) - move (
bool
) – Move whole directory
- root_src_dir (
-
copy_resource_tree
(package: str, source: str, target: str)[source]¶ Copies a whole resource tree
Parameters: - package (
str
) – Package object with resources - source (
str
) – Source folder inside package resources - target (
str
) – Filesystem destination
- package (
-
generate_component_folders
(folder)[source]¶ If not existing, create the components’ holding folder inside the frontend source tree
Parameters: folder – Target folder in the frontend’s source, where frontend modules will be copied to
-
get_components
(frontend_root)[source]¶ Iterate over all installed isomer modules to find all the isomer components frontends and their dependencies :param frontend_root: Frontend source root directory :return:
-
get_frontend_locations
(development)[source]¶ Determine the frontend target and root locations. The root is where the complete source code for the frontend will be assembled, whereas the target is its installation directory after building :param development: If True, uses the development frontend server location :return:
-
get_sails_dependencies
(root)[source]¶ Get all core user interface (sails) dependencies
Parameters: root – Frontend source root directory
-
install_dependencies
(dependency_list: list, frontend_root: str)[source]¶ Instruct npm to install a list of all dependencies
Parameters: - frontend_root (
str
) – Frontend source root directory - dependency_list (
list
) – List of javascript dependency packages
- frontend_root (
-
install_frontend
(force_rebuild: bool = False, install: bool = True, development: bool = False, build_type: str = 'dist')[source]¶ Builds and installs the frontend.
The process works like this:
- Find the frontend locations (source root and target)
- Generate the target component folders to copy modules’ frontend sources to
- Gather all component meta data
- Collect all dependencies (when installing them is desired) and their module imports
- If desired, install all dependencies
- Write the frontend main loader with all module entrypoints
- Run npm build BUILD_TYPE and copy all resulting files to the frontend target folder
Parameters: - force_rebuild (
bool
) – Trigger a rebuild of the sources. - install (
bool
) – Trigger installation of the frontend’s dependencies - development (
bool
) – Use development frontend server locations - build_type (
str
) – Type of frontend build, either ‘dist’ or ‘build’
-
rebuild_frontend
(root: str, target: str, build_type: str)[source]¶ Instruct npm to rebuild the frontend
Parameters: - root (
str
) – Frontend source root directory - target (
str
) – frontend build target installation directory - build_type (
str
) – Type of frontend build, either ‘dist’ or ‘build’
Returns: - root (
-
update_frontends
(frontend_components: dict, frontend_root: str, install: bool)[source]¶ Installs all found entrypoints and returns the list of all required dependencies
Parameters: - frontend_root (
str
) – Frontend source root directory - install (
bool
) – If true, collect installable dependencies - frontend_components (
dict
) – Dictionary with component names and metadata
Returns: - frontend_root (