Skip to content

Commit

Permalink
fix(msi): msi target error
Browse files Browse the repository at this point in the history
Close #2798
  • Loading branch information
develar committed Apr 27, 2018
1 parent 726706c commit 734cbaf
Show file tree
Hide file tree
Showing 12 changed files with 425 additions and 470 deletions.
6 changes: 5 additions & 1 deletion docs/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Env file `electron-builder.env` in the current dir ([example](https://github.com
* <code id="Configuration-extraMetadata">extraMetadata</code> any - Inject properties to `package.json`.
* <code id="Configuration-readonly">readonly</code> = `false` Boolean - Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).
* <code id="Configuration-muonVersion">muonVersion</code> String - The version of muon you are packaging for.
* <code id="Configuration-protonNodeVersion">protonNodeVersion</code> String - *Proton Native only* The version of NodeJS you are packaging for. You can set it to `current` to set the Node.js version that you use to run electron-builder.

---

Expand All @@ -114,7 +115,10 @@ Env file `electron-builder.env` in the current dir ([example](https://github.com
---

* <code id="Configuration-afterSign">afterSign</code> (context: AfterPackContext) => Promise | null - The function (or path to file or module id) to be run after pack and sign (but before pack into distributable format).
* <code id="Configuration-beforeBuild">beforeBuild</code> (context: BeforeBuildContext) => Promise | null - The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. If provided and `node_modules` are missing it will not invoke production dependencies check. Resolving to `false` will skip dependencies install or rebuild.
* <code id="Configuration-onNodeModuleFile">onNodeModuleFile</code> module:electron-builder-lib/out/configuration.__type | String - The function (or path to file or module id) to be run on each node module file.
* <code id="Configuration-beforeBuild">beforeBuild</code> (context: BeforeBuildContext) => Promise | null - The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.

If provided and `node_modules` are missing, it will not invoke production dependencies check.
* <code id="Configuration-remoteBuild">remoteBuild</code> = `true` Boolean - Whether to build using Electron Build Service if target not supported on current OS.
* <code id="Configuration-includePdb">includePdb</code> = `false` Boolean - Whether to include PDB files.
* <code id="Configuration-removePackageScripts">removePackageScripts</code> = `true` Boolean - Whether to remove `scripts` field from `package.json` files.
Expand Down
3 changes: 2 additions & 1 deletion docs/configuration/mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ The top-level [mac](configuration.md#Configuration-mac) key contains set of opti

For example, `"category": "public.app-category.developer-tools"` will set the application category to *Developer Tools*.

Valid values are listed in [Apple's documentation](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
* <code id="MacConfiguration-target">target</code> String | [TargetConfiguration](/configuration/target.md#targetconfiguration) - The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (dmg and zip for Squirrel.Mac).
* <code id="MacConfiguration-identity">identity</code> String - The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing.md) instead of specifying this option. MAS installer identity is specified in the [mas](mas.md).
* <code id="MacConfiguration-icon">icon</code> = `build/icon.icns` String - The path to application icon.
* <code id="MacConfiguration-entitlements">entitlements</code> String - The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set). MAS entitlements is specified in the [mas](mas.md).
* <code id="MacConfiguration-entitlementsInherit">entitlementsInherit</code> String - The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set). Otherwise [default](https://github.com/electron-userland/electron-osx-sign/blob/master/default.entitlements.darwin.inherit.plist).

This option only applies when signing with `entitlements` provided.
* <code id="MacConfiguration-provisioningProfile">provisioningProfile</code> String - The path to the provisioning profile to use when signing, absolute or relative to the app root.
* <code id="MacConfiguration-bundleVersion">bundleVersion</code> String - The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).
* <code id="MacConfiguration-bundleShortVersion">bundleShortVersion</code> String - The `CFBundleShortVersionString`. Do not use it unless you need to.
* <code id="MacConfiguration-helperBundleId">helperBundleId</code> = `${appBundleIdentifier}.helper` String - The bundle identifier to use in the application helper's plist.
Expand Down
22 changes: 21 additions & 1 deletion docs/configuration/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ You can publish to multiple providers. For example, to publish Windows artifacts
}
```

## Macros

In all publish options [File Macros](/file-patterns.md#file-macros) are supported.

## How to Publish

Excerpt from [CLI Usage](https://github.com/electron-userland/electron-builder#cli-usage) of `electron-builder` command:
Expand Down Expand Up @@ -91,14 +95,25 @@ Define `BT_TOKEN` environment variable.
* <code id="BintrayOptions-user">user</code> String - The Bintray user account. Used in cases where the owner is an organization.
* <code id="BintrayOptions-token">token</code> String

Inherited from `PublishConfiguration`:
* <code id="BintrayOptions-publishAutoUpdate">publishAutoUpdate</code> = `true` Boolean - Whether to publish auto update info files.

Auto update relies only on the first provider in the list (you can specify several publishers). Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.

## GenericServerOptions
Generic (any HTTP(S) server) options.
In all publish options [File Macros](/file-patterns.md#file-macros) are supported.

* **<code id="GenericServerOptions-provider">provider</code>** "generic" - The provider. Must be `generic`.
* **<code id="GenericServerOptions-url">url</code>** String - The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
* **<code id="GenericServerOptions-url">url</code>** String - The base url. e.g. `https://bucket_name.s3.amazonaws.com`.
* <code id="GenericServerOptions-channel">channel</code> = `latest` String - The channel.
* <code id="GenericServerOptions-useMultipleRangeRequest">useMultipleRangeRequest</code> Boolean - Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.

Inherited from `PublishConfiguration`:
* <code id="GenericServerOptions-publishAutoUpdate">publishAutoUpdate</code> = `true` Boolean - Whether to publish auto update info files.

Auto update relies only on the first provider in the list (you can specify several publishers). Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.

## GithubOptions
[GitHub](https://help.github.com/articles/about-releases/) options.

Expand All @@ -117,6 +132,11 @@ Define `GH_TOKEN` environment variable.

Also you can set release type using environment variable. If `EP_DRAFT`is set to `true``draft`, if `EP_PRELEASE`is set to `true``prerelease`.

Inherited from `PublishConfiguration`:
* <code id="GithubOptions-publishAutoUpdate">publishAutoUpdate</code> = `true` Boolean - Whether to publish auto update info files.

Auto update relies only on the first provider in the list (you can specify several publishers). Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.

<!-- end of generated block -->

## S3Options
Expand Down
5 changes: 3 additions & 2 deletions docs/generated/NsisOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@
* <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-preCompressedFileExtensions">preCompressedFileExtensions</code> = `[".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"]` Array&lt;String&gt; | String - The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.
* <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.
* <code id="NsisOptions-runAfterFinish">runAfterFinish</code> = `true` Boolean - *one-click installer only.* Whether to run the installed application after finish.
* <code id="NsisOptions-runAfterFinish">runAfterFinish</code> = `true` Boolean - Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.

---

* <code id="NsisOptions-createDesktopShortcut">createDesktopShortcut</code> = `true` Boolean - Whether to create desktop shortcut.
* <code id="NsisOptions-createDesktopShortcut">createDesktopShortcut</code> = `true` Boolean | "always" - Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).
* <code id="NsisOptions-createStartMenuShortcut">createStartMenuShortcut</code> = `true` Boolean - Whether to create start menu 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.
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"app-builder-bin": "1.8.6",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.225.1",
"aws-sdk": "^2.229.1",
"bluebird-lst": "^1.0.5",
"chalk": "^2.3.2",
"chalk": "^2.4.1",
"chromium-pickle-js": "^0.2.0",
"debug": "^3.1.0",
"ejs": "^2.5.9",
Expand All @@ -60,15 +60,15 @@
"sanitize-filename": "^1.6.1",
"sax": "^1.2.4",
"semver": "^5.5.0",
"source-map-support": "^0.5.4",
"source-map-support": "^0.5.5",
"stat-mode": "^0.2.2",
"temp-file": "^3.1.1",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.5.0",
"yargs": "^11.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.44",
"@babel/core": "^7.0.0-beta.46",
"@develar/gitbook": "3.2.11",
"@types/debug": "^0.0.30",
"@types/ejs": "^2.5.1",
Expand Down Expand Up @@ -97,11 +97,11 @@
"gitbook-plugin-github-buttons": "^3.0.0",
"globby": "^8.0.1",
"jest-cli": "^23.0.0-alpha.0",
"jest-junit": "^3.6.0",
"jest-junit": "^3.7.0",
"jsdoc-to-markdown": "^4.0.1",
"path-sort": "^0.1.0",
"ts-babel": "^5.0.2",
"ts-jsdoc": "^3.0.0",
"ts-jsdoc": "^3.0.1",
"tslint": "^5.9.1",
"typescript": "2.8.3",
"v8-compile-cache": "^1.1.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/builder-util-runtime/src/publishOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function githubUrl(options: GithubOptions, defaultHost: string = "github.

/**
* Generic (any HTTP(S) server) options.
* In all publish options [File Macros](/file-patterns.md#file-macros) are supported.
*/
export interface GenericServerOptions extends PublishConfiguration {
/**
Expand All @@ -101,7 +102,7 @@ export interface GenericServerOptions extends PublishConfiguration {
readonly provider: "generic"

/**
* The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
* The base url. e.g. `https://bucket_name.s3.amazonaws.com`.
*/
readonly url: string

Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"chalk": "^2.3.2",
"debug": "^3.1.0",
"builder-util-runtime": "^0.0.0-semantic-release",
"source-map-support": "^0.5.4",
"source-map-support": "^0.5.5",
"7zip-bin": "~3.1.0",
"semver": "^5.5.0",
"lazy-val": "^1.0.3",
Expand Down
7 changes: 5 additions & 2 deletions packages/electron-builder-lib/src/targets/MsiTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export default class MsiTarget extends Target {
const iconPath = await this.packager.getIconPath()
return (await projectTemplate.value)({
...commonOptions,
isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,
isRunAfterFinish: options.runAfterFinish !== false,
iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),
compressionLevel: compression === "store" ? "none" : "high",
Expand Down Expand Up @@ -209,10 +210,12 @@ export default class MsiTarget extends Target {
else if (directoryId === null) {
result += ` Id="${path.basename(packagePath)}_f"`
}
if (isMainExecutable && (commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER || commonOptions.isCreateStartMenuShortcut)) {

const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER
if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {
result += `>\n`
const shortcutName = commonOptions.shortcutName
if (commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER) {
if (isCreateDesktopShortcut) {
result += `${fileSpace} <Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="${shortcutName}" WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="icon.ico"/>\n`
}

Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.5.2",
"aws-sdk": "^2.225.1",
"aws-sdk": "^2.229.1",
"mime": "^2.3.1",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"fs-extra-p": "^4.5.2",
"js-yaml": "^3.11.0",
"semver": "^5.5.0",
"source-map-support": "^0.5.4",
"source-map-support": "^0.5.5",
"builder-util-runtime": "~0.0.0-semantic-release",
"electron-is-dev": "^0.3.0",
"lodash.isequal": "^4.5.0"
Expand Down
3 changes: 2 additions & 1 deletion scripts/renderer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../node_modules/ts-babel/tsconfig-base.json",
"compilerOptions": {
"outDir": "out",
"module": "commonjs"
"module": "commonjs",
"skipLibCheck": true
},
"declaration": false,
"include": [
Expand Down

0 comments on commit 734cbaf

Please sign in to comment.