Hi @Daniel,
I haven’t made any good progress yet but I thought about sharing my failed attempts so far.
I tried to make npm install to work offline. I took the npm5 path.
I wrote a script that creates a npm cache and bundles it in a tarball.
The cache is then re-created in the sandbox and used by calling npm install --offline.
https://github.com/manuq/org.sugarizer.Sugarizer/commit/1136ce0353f95c3a35c8331541c5313238b14b80
This trick works for simple dependencies, but unfortunately not for Electron.
This is because Electron postinstall script does use the network.
I tested being offline by running flatpak-builder --disable-download --disable-cache --build-only
I could try bundling the entire node_modules directory, but seems too much… I think my next step is trying the yarn path.
UPDATE
Adding more files to the previous commit I was able to build the Electron app offline. But the solution is platform specific.
-
I passed node_modules/ directory with a tarball, like I did with the npm cache directory.
-
The electron-packager
command (called from npm run pack
) also attempts to use the network
to download a OS and architecture specific ZIP file (in my case electron-v1.6.10-linux-x64.zip).
This was sorted by downloading the ZIP and checksum and passing it to the electron-packager cache directory.
But again this is platform specific, flathub will fail for other platforms.
I guess all the files of an electron release have to be downloaded.
https://github.com/manuq/org.sugarizer.Sugarizer/commit/d36b6f31b34051d9608718530708d56ed13f85fb