-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Problem
I would like to package the Studio electron app's resources as an ASAR archive.
There are two issues that have come up when I try to do this:
-
Paths inside an ASAR archive are unreliable:
All JS code is "packed" into oneapp.asarfile. This has the implication that there would no longer be a real file system inside the electron app's code. For most cases, this is fine, but in order to run a binary, ASAR "unpacks" / moves all executable files outside the main archive. This means any code that relies on__dirnameor relative paths to figure out the QE binary's location can no longer work. These methods need a way to override this binary location.
Functions to consider:getConfig,getGenerators -
ASAR archives are readonly:
From what I can see,getGenerators(and accompanying code in@prisma/clientthat actually does the generation) heavily relies on modifying thenode_modulesdirectory. This will not be possible with an ASAR archive, because it is read only. It seems to be downloading the QE binary (even whenskipDownloadis set ttrue, which could be a separate issue altogether). I suppose we could either not download the binary and instead use one that is provided, or I give the function a read-write path that it can use. This needs a bit of discussion.
Unpacking all Prisma dependencies out of the archive defeats the purpose of the archive.
Windows has a problem with paths that are longer than 260 characters (out of the box), and so ASAR is almost a requirement for it. On other platforms, it prevents security risks, so it is very much recommended.
Suggested solution
Needs to be discussed