endlessm / electron-installer-flatpak

Create a flatpak for your Electron app
MIT License
59 stars 17 forks source link

How to workaround devDependency on Windows? #20

Closed averissimo closed 6 years ago

averissimo commented 6 years ago

This could be more of a general question, but the flatpak plays nicely on linux and MacOSX environments.

The problem is when setting up npm modules in Windows environment, where it fails.

Should electron-installer-flatpak be added to optionalDependencies and checked if installed inside the code? or is there a better way of dealing with this?

The problem with this is that it will be added to production, which I would not like to do. (correct me if I'm mistaken)

What version of node and npm are you using?

node v9.4.0 and npm v5.6.0

image

cosimoc commented 6 years ago

I'm not completely sure exactly why non-windows is a hard requirement; @mattdangerw do you remember? I don't think it would be possible to create the flatpak bundle itself under windows anyway, because it requires the flatpak binary to be installed AFAIK.

See https://stackoverflow.com/questions/15176082/npm-package-json-os-specific-dependency for what I've found about managing OS-specific dependencies with node; there doesn't seem to really be a great way of achieving it, and optionalDependencies seems the recommendation there as well.

mattdangerw commented 6 years ago

@cosimoc yeah that os requirement is coming from https://github.com/endlessm/electron-installer-flatpak/blob/master/package.json#L19, which I think we just inherited from electron-installer-debian when we forked.

We could take it out and then people would be free to try the tool on any OS, but as you say it requires the flatpak binary and as far as I know that's only going to work on Linux. So the other approach could be to change the os to just linux, and add a similar line to the package.json in flatpak-bundler.

cosimoc commented 6 years ago

@mattdangerw Yeah, limiting it to linux-only sounds like a good plan for now.

averissimo commented 6 years ago

The only problem I'm seeing with this workaround is that when packaging the module will be included in the releases. (correct me if wrong)