Home

Awesome

[!WARNING] This is an experimental library and not officially supported / endorsed by bpmn.io. See also caveats.

bpmn-js-headless

CI

Run bpmn-js in headless environments.

Usage

Use just like bpmn-js, but be sure not to use interactive (extension) modules.

import Modeler from 'bpmn-js-headless/lib/Modeler';

const modeler = new BpmnModeler();

// import diagram
await modeler.importXML(myDiagram);

// perform a change operation
modeler.invoke((modeling, elementRegistry) => {

  const participant = elementRegistry.get('Participant_1');

  modeling.removeElements([ participant ]);
});

// export diagram
const {
  xml
} = await modeler.saveXML({ format: true });

Why?

This utility is useful whenever you want to apply complex modeling operations in headless (aka no browser) environments. Some examples:

How does it work

Caveats

This is a truely headless version of bpmn-js, i.e. it does not fake a browser environment. For extensions to be compatible they shall enforce a proper UI / behavior separation, and not rely on browser features.

You want to bundle this library along with extensions, as bpmn-js and dependent libraries require bundling, too.