adopted-ember-addons / ember-electron

:zap: Build, test, compile and package desktop apps with Ember and Electron
https://ember-electron.js.org/
Other
805 stars 111 forks source link

"derefSymlinks: false" is not working #253

Closed debelop13 closed 6 years ago

debelop13 commented 7 years ago

Hi! Now with the compilation of my app the symlinks are being deleting, and is increasing the size a lot. But option of "derefSymlinks: false" is deleting symlinks anyway. Can be?

Thanks!

debelop13 commented 7 years ago

In "ember electron:assemble" option, when the project is built, symlinks are dereferenced.

bendemboski commented 7 years ago

We use broccoli to assemble the application, and it doesn't support symlinks. What's your use case? Where/why do you have symlinks in your app?

debelop13 commented 7 years ago

I have frameworks and other things in resources.. and they have symlinks, and the size increase a lot, and one framework is not working after the built

bendemboski commented 7 years ago

Supporting symlinks isn't really a use case we've been thinking about...it will take some thought/time to figure out how to best support them. As a workaround, I would recommend that you remove these resources from the ember-electron directory and put them somewhere else, and then use electron-forge's new hooks feature to copy what you need over yourself in the generateAssets hook.

debelop13 commented 7 years ago

I understand idea but I don't know how do it.

function prepackage() {
  console.log('prepackage');
}
function premake() {
  console.log('premake');
}
module.exports = {
  'make_targets': {
    'darwin': [
      'dmg'
    ],
    'win32': [
      'squirrel'
    ]
  },
  postPackage: prepackage(),
  preMake: premake(),
...

I am doing this, but is executing both before packaging!

It exists any example?

bendemboski commented 7 years ago

You want it to happen before packaging. Here's the sequence of events:

  1. ember-electron builds the Ember app and then assembles an Electron app that is compatible with electron-forge by copying files out of the ember-electron directory (this is the step where we can't really avoid deref'ing symlinks)
  2. ember-electron calls into electron-forge to tell it to package the application
  3. electron-forge calls into electron-packager telling it to package the application

electron-forge calls the generateAssets hook just before calling into electron-packager as you can see here, so if you copy your content and create your symlinks and whatnot in that hook, and electron-packager is properly configured to not deref symlinks, then it should work.

You could try running DEBUG=electron-forge:packager ember electron:package to double check that this line shows that your option is making it through the various layers to electron-packager correctly.

bendemboski commented 6 years ago

I'm assuming the workaround worked for you, so I'm closing this unless somebody has a broader case for us figuring out how to support symlinks.