decentraland / creator-hub

MIT License
0 stars 4 forks source link

fix: binaries in production build #32

Closed cazala closed 2 months ago

cazala commented 2 months ago

This PR fixes the production build, which is currently broken in the main branch.

It removes the use of npx and instead runs the package bins directly using UtilityProcess to fork a process.

Since many things down the line make use of node and npm globally (postinstall scripts, esbuild, etc) it also links the node and npm bins to the forked process's $PATH.

The npm bin is linked to the one in the app's own node_modules.

For node what this does is create a symlink (or a cmd in windows) in the app's path (app.getAppPath) called node that points to electron's own process.execPath, and then it adds the app's path to the forked process's $PATH.

This approach works but may cause permissions issues on windows, we might need to use a different path other than the app's path to store the symlink to the node binaries.