-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncouple from node-canvas. #136
Comments
Thinking about this more. Could we have Canvas be a peer dependency, that is not needed in browser, but in node, if it exists, pattern.js will try and create a canvas from it. We could have it in devDependencies for Jest. |
@VictorioBerra I've gone back and forth on this a fair amount. The latest version of Can you give a specific example of your use case and the pain point that you're hitting? Both pureimage and camanjs look interesting, but I'm hesitant to swap out a dependency that has served this project well for 5+ years without more information. |
My issue is mainly with Electron. Since electron is being built on Node it will still fire up the node-gyp try and download the precompiled binary but none exists. Even though electron uses Chrome, any native dependencies like node-canvas are still re-built. I definitely understand your point about Maybe the solution is for me to just fork and publish a non none-canvas build so that it works for my niche usecase. Although I wish there was an easy way for this to be more optional. Just like Jest and Canvas. The following happens during an npm i
You can see: WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-electron-v9.3-win32-unknown-x64.tar.gz |
That makes sense, there's no prebuilt version available so it blows up. It's also definitely not ideal that users with supported architectures who only need the browser shim have to download the whole Brainstorming a little bit here:
The thing that might make the most sense would be to publish a separate @VictorioBerra - would publishing a |
Yes I think that's the best course of action. I was going to do that myself tomorrow. But I'd rather it come from you that way it benifits from all the updates and issues here. Would you want to publish a core library to be used by both? That way you don't have duplication. |
@VictorioBerra as long as the only difference is the absence of the |
Sounds great I look forward to testing it! |
@qrohlf https://github.com/VictorioBerra/trianglify-desktop-wallpaper But id love to switch to your official package when you get this done. Thanks for making this library! |
I would also love to see an official trianglify-browser package on npm. That could reduce confusion about what package to use. |
@knrdl agree that it's confusing! I want to avoid publishing two different packages since there are projects (including the project that funds this library) that do use on Trianglify on both the server-side and the browser and it's very helpful to have a single package to ensure that the browser and server rendering of patterns is always deterministic and matches. This package is in fact fully browser-compatible, as The real problem is that installation of In the past I've listed @knrdl For now, the situation is that this package is the official browser implementation of Trianglify, and it requires an environment where @VictorioBerra could you please either update your package to track the latest version of Trainglify, or un-publish your package/mark it deprecated so that module consumers are not confused? |
@qrohlf I listed my package with the prefix What do I need to do to update my package? My package is a fork of trianglify, it does not depend on it. |
I am currently using the version provided by @VictorioBerra . My goal is to use trianglify client side but in a Sveltekit project (nodejs server). The builds are handled by docker. So I run into the exact problems @qrohlf described in detail above. npm i
npm i trianglify || exit 0 this workaround is just a bit ugly ... |
node-canvas requires node gyp and its a nightmare to use with things like electron or docker. Is there a way to fully uncouple from canvas and instead have an abstraction where the user can decide?
For example, svg is a good start but if I install Trianglify I am forced to download node-canvas even if I dont want it.
Maybe some possible alternatives:
The text was updated successfully, but these errors were encountered: