Update bpmn-js without effecting my changes

Today I have updated bpmn-js to version 0.20.6 using “npm update” command. then I found that all customization and installed modules has been deleted .

What is the best practice to handle such this case ?

There exist two ways how you can extend bpmn-js without monkey patching.

(1) Hook into bpmn-js events to influence what is going on
(2) Replace an existing service to change functionality

In both cases, you should make sure that your code and the bpmn-js basis are clearly separated (and thus, bpmn-js remains upgradable).

Consider option (2): Everything in bpmn-js is a replaceable service. Let’s say you would like to customize the palette. That is being done via a paletteProvider.

Override the default palette provider like this:

var bpmnJs = new BpmnJs({
  additionalModules: [
    // instead of doing this, roll your own palette
    // implementation, possibly re-using parts of bpmn-js

All of our examples showcase extending bpmn-js in a non-intrusive way. To learn more, I’d suggest you to start here or here.