Electron-builder: add option to disable warning about asar being off

Created on 7 Dec 2016  ·  11Comments  ·  Source: electron-userland/electron-builder

Packaging using asar archive is disabled — it is strongly not recommended.

Can I add a PR with some env var that would disable this?
In meteor-desktop I am packing the app into three asars because I needed to split the app into three parts because of internal hot code push mechanism.
So the app is actually asared, and this warning is adding a little confusion in my case.

feature

Most helpful comment

Finally got time to get back to this.
Please take a look at the PR. I already have a meteor-desktop prepared to use the beforeBuild callback and it works like a charm :)

All 11 comments

Is there a way to detect such packaging automatically?

structure

Well theoretically, a simple detection could be just a simple lookout for asar (or asars files) in app directory. Or just a check for app.asar.


Since I have you on the line, I have something I would like to ask. I would like to benefit from your npmRebuild - but the problem is that I have the node_modules already packed into app.asar.
I do not like the idea that I am asking about modification that would only benefit my package but I guess I have no choice :wink:

I would need an option to hook a callback before a build for a platform/arch is made, so that I could rebuild the node_modules myself and update them into app.asar. I am already calling your installOrRebuild here https://github.com/wojtkowiak/meteor-desktop/blob/master/lib/electronApp.js#L458 so I could just use it the same way. I would just need a callback like beforeBuild(platform, arch) that would be invoked before each build. I would then switch npmRebuild off and handle it myself. What do you think?

I would just need a callback like beforeBuild(platform, arch) that would be invoked before each build

Callback will be added.

Great, I can not express how I appreciate that 👍 Really, creators and maintainers of various open source packages are often very reservedly when it comes to helping others integrate things with their packages and here you are always helpful and positive.

Can you estimate a timeline for this two changes? Can I help or do the PR? In the first case I think I know what to add and where, and in the second I am not so sure.

Can I help or do the PR?

Yes, it will be helpful.

I think I know what to add and where

Consider to use statOrNull and check that file is really file. https://github.com/electron-userland/electron-builder/blob/master/src/util/fs.ts

in the second I am not so sure.

I suppose, callback should return Promise and we should wait promise completion. Promise result is boolean — false to not perform build, and true to build.

Thanks for the tips.
I have just started with this.

use added callback option in the https://github.com/electron-userland/electron-builder/blob/master/src/yarn.ts somehow. options: BuildMetadata is already available in the method installOrRebuild.

So instead of beforeBuild you would rather see sth like beforeYarnInstallOrRebuild? That would be more tailored for the situation I guess.

false to not perform build, and true to build.

So this would not condition whether to build but rather whether to run installOrRebuild, right?

Can I assume that there is an app directory always?
https://github.com/wojtkowiak/electron-builder/commit/182d7860c69029e4c159fd464a18bd4e1d7a34a6#diff-f3f55770caf14ea02d69896e0b071d88R320

@wojtkowiak No, on computeAsarOptions files is not yet copied to resourcesPath. You should check you source project directory, not dist.

So instead of beforeBuild you would rather see sth like beforeYarnInstallOrRebuild? That would be more tailored for the situation I guess.

beforeYarnInstallOrRebuild is too long name :) beforeBuild is ok here, no?

Finally got time to get back to this.
Please take a look at the PR. I already have a meteor-desktop prepared to use the beforeBuild callback and it works like a charm :)

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings