Skip to content
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

[Feature Request] Ability to set author/CompanyName programmatically #455

Closed
dknutsen opened this issue Jun 1, 2016 · 5 comments · May be fixed by qcif/data-curator#563
Closed

[Feature Request] Ability to set author/CompanyName programmatically #455

dknutsen opened this issue Jun 1, 2016 · 5 comments · May be fixed by qcif/data-curator#563
Labels

Comments

@dknutsen
Copy link

dknutsen commented Jun 1, 2016

So I'm using electron-builder programmatically in a script because we build the same app with multiple whitelabeled builds, each with unique branding (icons, app name, etc). This allows me to simply run the script with the name of the app that I want to build and electron-builder builds it the requested way.

This all works great with the exception of author/CompanyName, causing my Windows apps to install under "Undefined" company (because in package.json my author is simply ""). As far as I can tell the only way to set that is to set it in the package.json, which of course would make the company name/author the same for all of our whitelabeled apps, and there isn't really a good author name that will work for everyone.

Would that be something that could be added to be specified in the programmatic API?
Alternatively not installing the app under an author subdirectory at all would be acceptable (basically being able to leave author/CompanyName out completely).

@develar
Copy link
Member

develar commented Jun 1, 2016

Thanks for detailed explanation.

builder.build({
  targets: Platform.OSX.createTarget(),
  devMetadata: {
    "//": "build and other properties, see https://goo.gl/5jVxoO"
  }
})

Just set author in the devMetadatadevMetadata allows you to override any field in the package.json.

@dknutsen
Copy link
Author

dknutsen commented Jun 3, 2016

So I tried adding the "author" field to devMetadata as suggested but no luck. I managed to get it to work though after looking through the electron-builder code a little bit and experimenting.

In case anyone else runs across this, here's what I did:
First I put the following in my script for the builder config (note that it must go in devMetadata.build):

builder.build({
  ...
  devMetadata: {
    build: {
      ...
      'version-string': {
        "CompanyName":  `${companyName}`,
        "FileDescription":  `${appDescription}`,
        "ProductName":  `${appName}`,
        "InternalName":  `${appName}`,
      },
      ...
    }
})

That worked right for the description however I was getting an error on the CompanyName value. In my package.json i had the "author" field set to just "" which mean that when it was looking at metadata.author.name it was trying to get the name key from an undefined object. So what I had to do to fix this was this in my package.json I had to replace this:

{
  ...
  "author": ""
  ...
}

with this:

{
  ...
  "author": {
    "name": "DefaultName"
  },
  ...
}

Now setting the company name and description works perfectly. Thanks @develar for the assistance and all the work on a great tool!

@develar
Copy link
Member

develar commented Jun 4, 2016

Reopened — of course author should be specified in the app package.json — appMetadata property should be supported.

@develar develar reopened this Jun 4, 2016
@develar develar added feature and removed question labels Jun 4, 2016
@develar
Copy link
Member

develar commented Jun 11, 2016

appMetadata was added.

@ChengLin-Zhou
Copy link

appMetadata has no company property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants