-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add option to apply applicable options to package.json #602
Comments
Just so I'm clear about the feature you're requesting, you could like Electron Packager to update the |
Yes, but it would only update the version of package.json located in the temp directory for packaging. The main source code would be unchanged. My use case for this feature is to have a script that uses electron-packager to make a test version of the app. The electron-packager name option would include the word "test". The packaged test app would then be able to check for the word test and modify its behavior as discussed here. |
I'm not inclined to add this functionality to Electron Packager, partly because I don't see a broader use case for it, and partly because I think it will make the code base messier than it already is. However, you can implement it for your app by using an afterCopy hook with the packager API: const packager = require('electron-packager');
const packagerOptions = {
// ...
afterCopy: (buildPath, electronVersion, platform, arch, callback) => {
// read package.json from buildPath
// modify deserialized package.json
// write new package.json contents
callback();
}
// ...
};
packager(packagerOptions, (err, appPaths) => { /* ... */ }); |
OK, thanks for reminding me about afterCopy. That should do nicely. |
electron-builder for such use case supports |
For instance, setting the
app-version
option would not only change the "ProductVersion metadata property on Windows, and CFBundleShortVersionString on OS X", but would also changeversion
in the packaged app'spackage.json
. This way, accessingapp.version
from Electron will return the version passed to electron-packager, and not the original version.As far as I can tell, this would only apply to the
version
andname
options. I thinkname
should modifyproductName
in package.json.IMHO, this should eventually be made the default behavior, but that would require a major version change.
If this sounds good, I might go ahead and work on a PR for this.
The text was updated successfully, but these errors were encountered: