-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hope build command can add options for conditional compilation #494
Comments
Why you have to modify |
Putting a magic file doesn't reduce more developers' manual work. The ideal way is the build command can generate 2 versions of installer. For example I write development package.json as: {
"scripts" : {
"test": "build --win --x64 --add-package-json-field env test",
"dist": "build --win --x64 --add-package-json-field env production"
}
} Then I can simply type 'npm test' to generate a test installer which would dump much logs for debugging. And typing 'npm dist' can get another installer for the final distribution. I mentioned to put the condition field in package.json, it is for I usually read in name, version, and other metadata of app from it. It should be easy to test the env field and decide whether to do logging. |
Important clarification, so, now is clear that magic file will just add complexity to your code. |
Why not just check
? |
This way only helps when developing in the workspace folder but not in an installation. After getting the application installed from the installer, it includes no electron-prebuilt. I think it is still helpful to be able to do logging conditionally in that situation. |
Fixed. For ASAR only. |
I'm using electron-builder 5.1.0 to generate an installer for my app. I hoped the build command can help me a way to run some logging or checking code only in test version but it looks not support this yet.
My idea is like to add an option "--add-pakcage-json-field" to build command. It only put the given field and string to the application package.json.
So I use command:
build --win --x64 --add-package-json-field "env" "test"
My app get a modified package.json:
{
// other fields like name, version
// and a new item appended
"env": "test"
}
That way I can check the 'env' field in code and package my app in 2 commands, rather than modifying code manually.
Look forward to this feature if possible.
The text was updated successfully, but these errors were encountered: