-
Notifications
You must be signed in to change notification settings - Fork 99
Description
I am in the process of moving all dependencies from bower to npm (a good read is http://dontkry.com/posts/code/browserify-and-the-universal-module-definition.html). Now I would like to depend on imagediff through npm for browser-facing code.
The npm package for imagediff however depends on canvas
which itself has a dependency (cairo
) that needs manual installation. For browser-facing code this dependency is not needed and this manual installation step is a deal breaker.
It would be super helpful if we could provide a npm package without that strictly required dependency. I see two options here:
- Publish a second package to npm just for the use in browsers, say
imagediff-browser
. - Make the dependency on
canvas
optional (viaoptionalDependencies
, https://npmjs.org/doc/json.html#optionalDependencies).
Any more that I missed?
Personally I would prefer option 2. This would be as simple as changing "dependencies"
in package.json to "optionalDependencies"
. npm will still try to install canvas, but will skip if installation fails and return successfully.
The issue with step 2 is that NodeJS users will yield a working dependency installation while the setup is not complete. One way of mitigating that would be to throw an error indicating the unmet dependency.
What do you think?