include fabricjs in npm dependencies with custom build for gestures module

Viewed 1134

When I npm install fabric and go into the node modules directory, I can see the package.json file has a script that allows 'npm run build_with_gestures'. That is the build I need, not the default one supplied. I attempt to run it but of course it fails to execute because the source files were not downloaded (or were cleaned up).

Is there any way to specify through npm that I want to download the full git repository and build it with the aforementioned command so that I can always have an up-to-date build of fabricjs with gestures?

2 Answers

@AndreaBogazzi answer is right. Just adding code with little modification. Package.json looks like this.

 "scripts": {
    "postinstall": "cd node_modules/fabric && npm run build_with_gestures",
    ...other scripts
  },
  "dependencies": {
    "fabric": "^3.2.0",
    ...other dependencies
  },
Related