Skip to content

Commit

Permalink
fix: check homepage/author in the dev metadata
Browse files Browse the repository at this point in the history
Close #2024, Close #1881
  • Loading branch information
develar committed Sep 1, 2017
1 parent c3c613b commit 03df22d
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 80 deletions.
2 changes: 1 addition & 1 deletion docs/configuration/appx.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `appx` key contains set of options instructing electron-builder on how it should build AppX (Windows Store).
The top-level [appx](configuration.md#Configuration-appx) key contains set of options instructing electron-builder on how it should build AppX (Windows Store).

Please also see [AppX Assets](/icons.md#appx).

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/deb.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `deb` key contains set of options instructing electron-builder on how it should build Debian package.
The top-level [deb](configuration.md#Configuration-deb) key contains set of options instructing electron-builder on how it should build Debian package.

<!-- do not edit. start of generated block -->
* <code id="DebOptions-compression">compression</code> = `xz` "gz" | "bzip2" | "xz" - The compression type.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/dmg.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `dmg` key contains set of options instructing electron-builder on how it should build [DMG](https://en.wikipedia.org/wiki/Apple_Disk_Image).
The top-level [dmg](configuration.md#Configuration-dmg) key contains set of options instructing electron-builder on how it should build [DMG](https://en.wikipedia.org/wiki/Apple_Disk_Image).

<!-- do not edit. start of generated block -->
* <code id="DmgOptions-background">background</code> String - The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window. If background is not specified, use `window.size`. Default locations expected background size to be 540x380. See: [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/linux-other.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- do not edit. start of generated block -->
## AppImageOptions
The top-level `appImage` key contains set of options instructing electron-builder on how it should build [AppImage](https://appimage.org/).
The top-level [appImage](configuration.md#Configuration-appImage) key contains set of options instructing electron-builder on how it should build [AppImage](https://appimage.org/).

* <code id="AppImageOptions-systemIntegration">systemIntegration</code> = `ask` "ask" | "doNotAsk" - The system integration installation.

Expand All @@ -19,7 +19,7 @@ Inherited from `TargetSpecificOptions`:
If `BT_TOKEN` is set and `GH_TOKEN` is not set — defaults to `[{provider: "bintray"}]`.

## LinuxTargetSpecificOptions
The top-level `apk`, `freebsd`, `pacman`, `p5p`,`rpm` keys contains set of options instructing electron-builder on how it should build corresponding Linux target.
The top-level [apk](configuration.md#Configuration-apk), [freebsd](configuration.md#Configuration-freebsd), [pacman](configuration.md#Configuration-pacman), [p5p](configuration.md#Configuration-p5p), [rpm](configuration.md#Configuration-rpm) keys contains set of options instructing electron-builder on how it should build corresponding Linux target.

* <code id="LinuxTargetSpecificOptions-depends">depends</code> Array&lt;String&gt; - Package dependencies.
* <code id="LinuxTargetSpecificOptions-icon">icon</code> String
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/linux.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `linux` key contains set of options instructing electron-builder on how it should build Linux targets. These options applicable for any Linux target.
The top-level [linux](configuration.md#Configuration-linux) key contains set of options instructing electron-builder on how it should build Linux targets. These options applicable for any Linux target.

<!-- do not edit. start of generated block -->
* <code id="LinuxConfiguration-target">target</code> = `AppImage` String | [TargetConfiguration](target.md#targetconfig) - Target package type: list of `AppImage`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/mac.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `mac` key contains set of options instructing electron-builder on how it should build macOS targets. These options applicable for any macOS target.
The top-level [mac](configuration.md#Configuration-mac) key contains set of options instructing electron-builder on how it should build macOS targets. These options applicable for any macOS target.

<!-- do not edit. start of generated block -->
* <code id="MacConfiguration-category">category</code> String - The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/mas.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `mas` key contains set of options instructing electron-builder on how it should build MAS (Mac Application Store) target.
The top-level [mas](configuration.md#Configuration-mas) key contains set of options instructing electron-builder on how it should build MAS (Mac Application Store) target.
Inherits [macOS options](mac.md).

<!-- do not edit. start of generated block -->
Expand Down
32 changes: 22 additions & 10 deletions docs/configuration/nsis.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `nsis` key contains set of options instructing electron-builder on how it should build NSIS target (default target for Windows).
The top-level [nsis](configuration.md#Configuration-nsis) key contains set of options instructing electron-builder on how it should build NSIS target (default target for Windows).

<!-- do not edit. start of generated block -->
* <code id="NsisOptions-oneClick">oneClick</code> = `true` Boolean - One-click installation.
Expand All @@ -7,31 +7,43 @@ The top-level `nsis` key contains set of options instructing electron-builder on
If `oneClick` is `false`: no install mode installer page (choice per-machine or per-user), always install per-machine.
* <code id="NsisOptions-allowElevation">allowElevation</code> = `true` Boolean - *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.
* <code id="NsisOptions-allowToChangeInstallationDirectory">allowToChangeInstallationDirectory</code> = `false` Boolean - *assisted installer only.* Whether to allow user to change installation directory.
* <code id="NsisOptions-createDesktopShortcut">createDesktopShortcut</code> = `true` Boolean - Whether to create desktop shortcut.
* <code id="NsisOptions-runAfterFinish">runAfterFinish</code> = `true` Boolean - *one-click installer only.* Run application after finish.

---

* <code id="NsisOptions-installerIcon">installerIcon</code> String - The path to installer icon, relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory. Defaults to `build/installerIcon.ico` or application icon.
* <code id="NsisOptions-uninstallerIcon">uninstallerIcon</code> String - The path to uninstaller icon, relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory. Defaults to `build/uninstallerIcon.ico` or application icon.
* <code id="NsisOptions-installerHeader">installerHeader</code> = `build/installerHeader.bmp` String - *assisted installer only.* `MUI_HEADERIMAGE`, relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory.
* <code id="NsisOptions-installerHeaderIcon">installerHeaderIcon</code> String - *one-click installer only.* The path to header icon (above the progress bar), relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory. Defaults to `build/installerHeaderIcon.ico` or application icon.
* <code id="NsisOptions-installerSidebar">installerSidebar</code> String - *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory. Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`
* <code id="NsisOptions-uninstallerSidebar">uninstallerSidebar</code> String - *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory. Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`
* <code id="NsisOptions-installerHeaderIcon">installerHeaderIcon</code> String - *one-click installer only.* The path to header icon (above the progress bar), relative to the the [build resources](/configuration/configuration.md#MetadataDirectories-buildResources) or to the project directory. Defaults to `build/installerHeaderIcon.ico` or application icon.
* <code id="NsisOptions-installerLanguages">installerLanguages</code> Array&lt;String&gt; | String - The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.
* <code id="NsisOptions-displayLanguageSelector">displayLanguageSelector</code> = `false` Boolean - Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).
* <code id="NsisOptions-uninstallDisplayName">uninstallDisplayName</code> = `${productName} ${version}` String - The uninstaller display name in the control panel.

---

* <code id="NsisOptions-include">include</code> String - The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).
* <code id="NsisOptions-script">script</code> String - The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).
* <code id="NsisOptions-license">license</code> String - The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt, `rtf` and `html` supported (don't forget to use `target="_blank"` for links).

Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`)). For example, create files `license_de.txt` and `license_en.txt` in the build resources. If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).

Appropriate license file will be selected by user OS language.
* <code id="NsisOptions-language">language</code> String - [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).
* <code id="NsisOptions-multiLanguageInstaller">multiLanguageInstaller</code> Boolean - Whether to create multi-language installer. Defaults to `unicode` option value.
* <code id="NsisOptions-menuCategory">menuCategory</code> = `false` Boolean | String - Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.
* <code id="NsisOptions-uninstallDisplayName">uninstallDisplayName</code> = `${productName} ${version}` String - The uninstaller display name in the control panel.
* <code id="NsisOptions-artifactName">artifactName</code> String - The [artifact file name template](/configuration/configuration.md#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.
* <code id="NsisOptions-deleteAppDataOnUninstall">deleteAppDataOnUninstall</code> = `false` Boolean - *one-click installer only.* Whether to delete app data on uninstall.
* <code id="NsisOptions-packElevateHelper">packElevateHelper</code> = `true` Boolean - Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.

---

* <code id="NsisOptions-createDesktopShortcut">createDesktopShortcut</code> = `true` Boolean - Whether to create desktop shortcut.
* <code id="NsisOptions-menuCategory">menuCategory</code> = `false` Boolean | String - Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.
* <code id="NsisOptions-shortcutName">shortcutName</code> String - The name that will be used for all shortcuts. Defaults to the application name.

---

* <code id="NsisOptions-displayLanguageSelector">displayLanguageSelector</code> = `false` Boolean - Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).
* <code id="NsisOptions-installerLanguages">installerLanguages</code> Array&lt;String&gt; | String - The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.
* <code id="NsisOptions-language">language</code> String - [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).
* <code id="NsisOptions-multiLanguageInstaller">multiLanguageInstaller</code> Boolean - Whether to create multi-language installer. Defaults to `unicode` option value.
* <code id="NsisOptions-packElevateHelper">packElevateHelper</code> = `true` Boolean - Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.
* <code id="NsisOptions-unicode">unicode</code> = `true` Boolean - Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).
* <code id="NsisOptions-guid">guid</code> String - See [GUID vs Application Name](../configuration/nsis.md#guid-vs-application-name).
* <code id="NsisOptions-warningsAsErrors">warningsAsErrors</code> = `true` Boolean - If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/pkg.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `pkg` key contains set of options instructing electron-builder on how it should build [PKG](https://goo.gl/yVvgF6) (macOS installer component package).
The top-level [pkg](configuration.md#Configuration-pkg) key contains set of options instructing electron-builder on how it should build [PKG](https://goo.gl/yVvgF6) (macOS installer component package).

<!-- do not edit. start of generated block -->
* <code id="PkgOptions-scripts">scripts</code> = `build/pkg-scripts` String - The scripts directory, relative to `build` (build resources directory). The scripts can be in any language so long as the files are marked executable and have the appropriate shebang indicating the path to the interpreter. Scripts are required to be executable (`chmod +x file`). See: [Scripting in installer packages](http://macinstallers.blogspot.de/2012/07/scripting-in-installer-packages.html).
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/snap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `snap` key contains set of options instructing electron-builder on how it should build [Snap](http://snapcraft.io).
The top-level [snap](configuration.md#Configuration-snap) key contains set of options instructing electron-builder on how it should build [Snap](http://snapcraft.io).

<!-- do not edit. start of generated block -->
* <code id="SnapOptions-confinement">confinement</code> = `strict` "devmode" | "strict" | "classic" - The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/squirrel-windows.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `squirrelWindows` key contains set of options instructing electron-builder on how it should build Squirrel.Windows.
The top-level [squirrelWindows](configuration.md#Configuration-squirrelWindows) key contains set of options instructing electron-builder on how it should build Squirrel.Windows.

Squirrel.Windows target is maintained, but deprecated. Please use [nsis](nsis.md) instead.

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/win.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The top-level `win` key contains set of options instructing electron-builder on how it should build Windows targets. These options applicable for any Windows target.
The top-level [win](configuration.md#Configuration-win) key contains set of options instructing electron-builder on how it should build Windows targets. These options applicable for any Windows target.

<!-- do not edit. start of generated block -->
* <code id="WindowsConfiguration-target">target</code> = `nsis` String | [TargetConfiguration](target.md#targetconfig) - The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` (portable app without installation), `appx`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. AppX package can be built only on Windows 10.
Expand Down
8 changes: 6 additions & 2 deletions packages/electron-builder/src/appInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export class AppInfo {
return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${this.buildNumber || "0"}`
}

private get notNullDevMetadata() {
return this.info.devMetadata || {}
}

get companyName(): string | null {
const author = this.info.metadata.author
const author = this.info.metadata.author || this.notNullDevMetadata.author
return author == null ? null : author.name
}

Expand Down Expand Up @@ -86,7 +90,7 @@ export class AppInfo {
}

async computePackageUrl(): Promise<string | null> {
const url = this.info.metadata.homepage
const url = this.info.metadata.homepage || this.notNullDevMetadata.homepage
if (url != null) {
return url
}
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/options/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface Metadata {
*/
readonly license?: string | null

readonly author?: AuthorMetadata
readonly author?: AuthorMetadata | null

/**
* The [repository](https://docs.npmjs.com/files/package.json#repository).
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Packager {
return this._isPrepackedAppAsar
}

private devMetadata: Metadata
devMetadata: Metadata

private _configuration: Configuration

Expand Down
Loading

0 comments on commit 03df22d

Please sign in to comment.