Plugins - how to build plugins in the new way?


I have updated my plugin regarding updates to javascript plugins: Html Client Plugins

I have following questions:

  1. copies plugin into implementations/plugins folder. Shouldn’t it be implementations/<PluginName> folder? In case of multiple plugins it can get confusing and also there might be issues with file names.
  2. How can I build client on origam’s docker? There is /home/origam/HTML_SOURCE folder, I have used to use it to build new client whenever I have created new docker container. What should I do to make sure I can build the client?
    • Currently, I am building client in my development environment and save html build into git and use it when I create docker container. But this would mean that with any minor version of Origam, I would need to rebuild client manualy. This I would like to avoid.

About point 1:

The plugin manager will copy the plugins into individual folders as you suggest. Look also at the updated documanatation. The prefered way of structuring the plugins is to have them all in one folder and copy them all to the origam source all together.

1 Like

Regarding point 2: can I run plugin manager inside docker build? I mean I can copy all source code but there are also custom dependencies in package.json file. Would it be enough to just overwrite yarn.lock file in HMTL5_SOURCE folder to build client inside docker?

No you have to copy the dependencies. The plugin manager cannot do that out of the box and I don’t want to complicate it too much. Maybe I will do it later… The simpliest solution now would be to copy the relevant functions from the manager script to a new script and do the copying in the new script. You could also reference the the plugin manager insterad of copying of course… Or not use python at all.

I’m working on someting like that on another project now. The work is not done yest but here is what I have:

docker file:

FROM origam/server:2024.3.0.3306.linux AS base

# Install python
USER root
RUN apt-get update
RUN apt-get install -y python3
RUN apt-get install -y python3-pip
RUN pip install packaging

# Prepare files
USER origam
COPY plugins src/plugins/implementations/plugins
RUN rm yarn.lock
COPY plugins/yarn.lock yarn.lock
COPY --chown=origam:origam
RUN python3 src/plugins/implementations/plugins/package.json package.json
RUN rm -r

python script

import sys, os, json, re

def add_dependencies(package_json_path, dependencies):
    with open(package_json_path, "r+") as f:
        content =
        for dependency in dependencies:
            if dependency not in content:
                content = re.sub(r'[^\S\r\n]*"dependencies"\s*:\s*{', f'  "dependencies": {{\n    {dependency},',

def copy_dependencies(source_package_json_path, target_package_json_path):
    with open(source_package_json_path) as f:
        source_package_json = json.load(f)
    dependency_dict = source_package_json["dependencies"]
    dependencies = [f'"{key}": "{dependency_dict[key]}"' for key in dependency_dict]
    add_dependencies(target_package_json_path, dependencies)
    print(f"Dependencies copied to: {target_package_json_path}")
    for dependency in dependencies:

if __name__ == "__main__":

    if len(sys.argv) != 3:
        print("Need path to source and target package.json as input arguments.")
    source_package_json_path = sys.argv[1]
    target_package_json_path = sys.argv[2]
    if not os.path.exists(source_package_json_path):
        print(f"Path to the source package.json {source_package_json_path} does not exist")
    if not os.path.exists(target_package_json_path):
        print(f"Path to the target package.json {target_package_json_path} does not exist")
    copy_dependencies(source_package_json_path, target_package_json_path)

1 Like