Skip to content

Commit

Permalink
feat: electronCompile option to disable electron-compile integration
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Mar 25, 2017
1 parent 4c83b3f commit b4462a2
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 67 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/Auto Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do

| Name | Type |
| --- | --- |
| name| <code>string</code> |
| url| <code>string</code> |
| **name**| <code>string</code> |
| **url**| <code>string</code> |
| sha2| <code>string</code> |
| headers| <code>Object</code> |

Expand All @@ -146,7 +146,7 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do

| Name | Type |
| --- | --- |
| versionInfo| <code>[VersionInfo](Publishing-Artifacts#VersionInfo)</code> |
| **versionInfo**| <code>[VersionInfo](Publishing-Artifacts#VersionInfo)</code> |
| fileInfo| <code>[FileInfo](#FileInfo)</code> |
| downloadPromise| <code>Promise&lt;any&gt;</code> \| <code>null</code> |
| cancellationToken| <code>[CancellationToken](Developer-API#CancellationToken)</code> |
Expand Down
32 changes: 16 additions & 16 deletions docs/Developer API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2380,12 +2380,12 @@

| Name | Type |
| --- | --- |
| path| <code>string</code> |
| **path**| <code>string</code> |
| cert| <code>string</code> \| <code>null</code> |
| name| <code>string</code> \| <code>null</code> |
| password| <code>string</code> \| <code>null</code> |
| site| <code>string</code> \| <code>null</code> |
| options| <code>[WinBuildOptions](Options#WinBuildOptions)</code> |
| **options**| <code>[WinBuildOptions](Options#WinBuildOptions)</code> |

<a name="module_electron-builder/out/windowsCodeSign.getSignVendorPath"></a>

Expand Down Expand Up @@ -2862,7 +2862,7 @@

| Name | Type |
| --- | --- |
| name| <code>string</code> |
| **name**| <code>string</code> |
| email| <code>string</code> |

<a name="BeforeBuildContext"></a>
Expand All @@ -2873,10 +2873,10 @@

| Name | Type |
| --- | --- |
| appDir| <code>string</code> |
| electronVersion| <code>string</code> |
| platform| <code>[Platform](#Platform)</code> |
| arch| <code>string</code> |
| **appDir**| <code>string</code> |
| **electronVersion**| <code>string</code> |
| **platform**| <code>[Platform](#Platform)</code> |
| **arch**| <code>string</code> |

<a name="FileAssociation"></a>

Expand All @@ -2892,7 +2892,7 @@ On Windows works only if [nsis.perMachine](https://github.com/electron-userland/

| Name | Type | Description |
| --- | --- | --- |
| ext| <code>string</code> \| <code>Array&lt;string&gt;</code> | <a name="FileAssociation-ext"></a>The extension (minus the leading period). e.g. `png`. |
| **ext**| <code>string</code> \| <code>Array&lt;string&gt;</code> | <a name="FileAssociation-ext"></a>The extension (minus the leading period). e.g. `png`. |
| name| <code>string</code> \| <code>null</code> | <a name="FileAssociation-name"></a>The name. e.g. `PNG`. Defaults to `ext`. |
| description| <code>string</code> \| <code>null</code> | <a name="FileAssociation-description"></a>*windows-only.* The description. |
| icon| <code>string</code> \| <code>null</code> | <a name="FileAssociation-icon"></a>The path to icon (`.icns` for MacOS and `.ico` for Windows), relative to `build` (build resources directory). Defaults to `${firstExt}.icns`/`${firstExt}.ico` (if several extensions specified, first is used) or to application icon. |
Expand Down Expand Up @@ -2955,9 +2955,9 @@ Please note — on macOS [you need to register an `open-url` event handler](http

| Name | Type | Description |
| --- | --- | --- |
| name| <code>string</code> | <a name="Protocol-name"></a>The name. e.g. `IRC server URL`. |
| **name**| <code>string</code> | <a name="Protocol-name"></a>The name. e.g. `IRC server URL`. |
| role = <code>Editor</code>| <code>"Editor"</code> \| <code>"Viewer"</code> \| <code>"Shell"</code> \| <code>"None"</code> | <a name="Protocol-role"></a>*macOS-only* The app’s role with respect to the type. |
| schemes| <code>Array&lt;string&gt;</code> | <a name="Protocol-schemes"></a>The schemes. e.g. `["irc", "ircs"]`. |
| **schemes**| <code>Array&lt;string&gt;</code> | <a name="Protocol-schemes"></a>The schemes. e.g. `["irc", "ircs"]`. |

<a name="RepositoryInfo"></a>

Expand All @@ -2967,7 +2967,7 @@ Please note — on macOS [you need to register an `open-url` event handler](http

| Name | Type |
| --- | --- |
| url| <code>string</code> |
| **url**| <code>string</code> |

<a name="SourceRepositoryInfo"></a>

Expand All @@ -2990,7 +2990,7 @@ Please note — on macOS [you need to register an `open-url` event handler](http

| Name | Type | Description |
| --- | --- | --- |
| target| <code>string</code> | <a name="TargetConfig-target"></a>The target name. e.g. `snap`. |
| **target**| <code>string</code> | <a name="TargetConfig-target"></a>The target name. e.g. `snap`. |
| arch| <code>Array&lt;"x64" \| "ia32" \| "armv7l"&gt;</code> \| <code>string</code> | <a name="TargetConfig-arch"></a>The arch or list of archs. |

<a name="TargetSpecificOptions"></a>
Expand Down Expand Up @@ -3156,8 +3156,8 @@ Please note — on macOS [you need to register an `open-url` event handler](http

| Name | Type |
| --- | --- |
| name| <code>string</code> |
| package| <code>string</code> |
| **name**| <code>string</code> |
| **package**| <code>string</code> |

<a name="BintrayClient"></a>

Expand Down Expand Up @@ -3363,7 +3363,7 @@ Please note — on macOS [you need to register an `open-url` event handler](http
| headers| <code>[RequestHeaders](#RequestHeaders)</code> \| <code>null</code> |
| skipDirCreation| <code>boolean</code> |
| sha2| <code>string</code> \| <code>null</code> |
| cancellationToken| <code>[CancellationToken](#CancellationToken)</code> |
| **cancellationToken**| <code>[CancellationToken](#CancellationToken)</code> |

<a name="module_electron-builder-http.DownloadOptions+onProgress"></a>

Expand Down Expand Up @@ -3844,7 +3844,7 @@ Please note — on macOS [you need to register an `open-url` event handler](http

| Name | Type |
| --- | --- |
| cancellationToken| <code>[CancellationToken](#CancellationToken)</code> |
| **cancellationToken**| <code>[CancellationToken](#CancellationToken)</code> |
| progress| <code>[MultiProgress](#MultiProgress)</code> \| <code>null</code> |

<a name="PublishOptions"></a>
Expand Down
43 changes: 22 additions & 21 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
| Name | Type |
| --- | --- |
| appOutDir| <code>string</code> |
| packager| <code>[PlatformPackager](Developer-API#PlatformPackager)&lt;any&gt;</code> |
| electronPlatformName| <code>string</code> |
| arch| <code>[Arch](Developer-API#Arch)</code> |
| targets| <code>Array&lt;[Target](Developer-API#Target)&gt;</code> |
| **appOutDir**| <code>string</code> |
| **packager**| <code>[PlatformPackager](Developer-API#PlatformPackager)&lt;any&gt;</code> |
| **electronPlatformName**| <code>string</code> |
| **arch**| <code>[Arch](Developer-API#Arch)</code> |
| **targets**| <code>Array&lt;[Target](Developer-API#Target)&gt;</code> |
<a name="AppXOptions"></a>
Expand All @@ -157,7 +157,7 @@ AppX Options
| Name | Type |
| --- | --- |
| packager| <code>[PlatformPackager](Developer-API#PlatformPackager)&lt;any&gt;</code> |
| **packager**| <code>[PlatformPackager](Developer-API#PlatformPackager)&lt;any&gt;</code> |
| target| <code>[Target](Developer-API#Target)</code> \| <code>null</code> |
| file| <code>string</code> |
| data| <code>Buffer</code> |
Expand All @@ -172,21 +172,21 @@ AppX Options
| Name | Type |
| --- | --- |
| options| <code>[PackagerOptions](#PackagerOptions)</code> |
| metadata| <code>[Metadata](#Metadata)</code> |
| devMetadata| <code>[Metadata](#Metadata)</code> |
| config| <code>[Config](#Config)</code> |
| projectDir| <code>string</code> |
| appDir| <code>string</code> |
| electronVersion| <code>string</code> |
| **options**| <code>[PackagerOptions](#PackagerOptions)</code> |
| **metadata**| <code>[Metadata](#Metadata)</code> |
| **devMetadata**| <code>[Metadata](#Metadata)</code> |
| **config**| <code>[Config](#Config)</code> |
| **projectDir**| <code>string</code> |
| **appDir**| <code>string</code> |
| **electronVersion**| <code>string</code> |
| muonVersion| <code>string</code> \| <code>null</code> |
| isTwoPackageJsonProjectLayoutUsed| <code>boolean</code> |
| appInfo| <code>[AppInfo](Developer-API#AppInfo)</code> |
| tempDirManager| <code>[TmpDir](Developer-API#TmpDir)</code> |
| repositoryInfo| <code>Promise&lt; \| [SourceRepositoryInfo](Developer-API#SourceRepositoryInfo)&gt;</code> |
| isPrepackedAppAsar| <code>boolean</code> |
| **isTwoPackageJsonProjectLayoutUsed**| <code>boolean</code> |
| **appInfo**| <code>[AppInfo](Developer-API#AppInfo)</code> |
| **tempDirManager**| <code>[TmpDir](Developer-API#TmpDir)</code> |
| **repositoryInfo**| <code>Promise&lt; \| [SourceRepositoryInfo](Developer-API#SourceRepositoryInfo)&gt;</code> |
| **isPrepackedAppAsar**| <code>boolean</code> |
| prepackaged| <code>string</code> \| <code>null</code> |
| cancellationToken| <code>[CancellationToken](Developer-API#CancellationToken)</code> |
| **cancellationToken**| <code>[CancellationToken](Developer-API#CancellationToken)</code> |
<a name="BuildOptions"></a>
Expand All @@ -201,8 +201,8 @@ AppX Options
| Name | Type |
| --- | --- |
| outDir| <code>string</code> |
| platformToTargets| <code>Map&lt;[Platform](Developer-API#Platform) \| Map&lt;String \| [Target](Developer-API#Target)&gt;&gt;</code> |
| **outDir**| <code>string</code> |
| **platformToTargets**| <code>Map&lt;[Platform](Developer-API#Platform) \| Map&lt;String \| [Target](Developer-API#Target)&gt;&gt;</code> |
<a name="CliOptions"></a>
Expand Down Expand Up @@ -261,6 +261,7 @@ Configuration Options
| muonVersion| <code>string</code> \| <code>null</code> | <a name="Config-muonVersion"></a>The version of muon you are packaging for. |
| artifactName| <code>string</code> \| <code>null</code> | <a name="Config-artifactName"></a>The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName}-${version}.${ext}` (some target can have another defaults, see corresponding options).<br><br>Currently supported only for `mas`, `pkg`, `dmg` and `nsis`. |
| buildVersion| <code>string</code> \| <code>null</code> | <a name="Config-buildVersion"></a>The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`. If `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_NUMBER` or `bamboo.buildNumber` env defined, it will be used as a build version (`version.build_number`). |
| electronCompile| <code>boolean</code> | <a name="Config-electronCompile"></a>Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified. |
| mac| <code>[MacOptions](#MacOptions)</code> \| <code>null</code> | <a name="Config-mac"></a> |
| mas| <code>[MasBuildOptions](#MasBuildOptions)</code> \| <code>null</code> | <a name="Config-mas"></a> |
| dmg| <code>[DmgOptions](#DmgOptions)</code> \| <code>null</code> | <a name="Config-dmg"></a> |
Expand Down
17 changes: 10 additions & 7 deletions docs/Publishing Artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,17 @@ Generic (any HTTP(S) server) options.

| Name | Type | Description |
| --- | --- | --- |
| url| <code>string</code> | <a name="GenericServerOptions-url"></a>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. |
| **url**| <code>string</code> | <a name="GenericServerOptions-url"></a>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. |
| channel = <code>&quot;latest&quot;</code>| <code>string</code> \| <code>null</code> | <a name="GenericServerOptions-channel"></a>The channel. |

<a name="GithubOptions"></a>

### `GithubOptions` ⇐ <code>[PublishConfiguration](#PublishConfiguration)</code>
GitHub options.

GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.
Define `GH_TOKEN` environment variable.

**Kind**: interface of <code>[electron-builder-http/out/publishOptions](#module_electron-builder-http/out/publishOptions)</code>
**Extends**: <code>[PublishConfiguration](#PublishConfiguration)</code>
**Properties**
Expand Down Expand Up @@ -143,7 +146,7 @@ If `BT_TOKEN` is set and `GH_TOKEN` is not set — defaults to `[{provider: "bin

| Name | Type | Description |
| --- | --- | --- |
| provider| <code>"github"</code> \| <code>"bintray"</code> \| <code>"s3"</code> \| <code>"generic"</code> | <a name="PublishConfiguration-provider"></a>The provider. |
| **provider**| <code>"github"</code> \| <code>"bintray"</code> \| <code>"s3"</code> \| <code>"generic"</code> | <a name="PublishConfiguration-provider"></a>The provider. |
| owner| <code>string</code> \| <code>null</code> | <a name="PublishConfiguration-owner"></a>The owner. |
| token| <code>string</code> \| <code>null</code> | <a name="PublishConfiguration-token"></a> |

Expand All @@ -161,7 +164,7 @@ Define `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` [environment variables](h

| Name | Type | Description |
| --- | --- | --- |
| bucket| <code>string</code> | <a name="S3Options-bucket"></a>The bucket name. |
| **bucket**| <code>string</code> | <a name="S3Options-bucket"></a>The bucket name. |
| path = <code>&quot;/&quot;</code>| <code>string</code> \| <code>null</code> | <a name="S3Options-path"></a>The directory path. |
| region| <code>string</code> \| <code>null</code> | <a name="S3Options-region"></a>The region. Is determined and set automatically when publishing. |
| channel = <code>&quot;latest&quot;</code>| <code>string</code> \| <code>null</code> | <a name="S3Options-channel"></a>The channel. |
Expand All @@ -184,12 +187,12 @@ Define `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` [environment variables](h

| Name | Type | Description |
| --- | --- | --- |
| path| <code>string</code> | <a name="UpdateInfo-path"></a> |
| **path**| <code>string</code> | <a name="UpdateInfo-path"></a> |
| githubArtifactName| <code>string</code> \| <code>null</code> | <a name="UpdateInfo-githubArtifactName"></a> |
| sha2| <code>string</code> | <a name="UpdateInfo-sha2"></a> |
| **sha2**| <code>string</code> | <a name="UpdateInfo-sha2"></a> |
| releaseName| <code>string</code> \| <code>null</code> | <a name="UpdateInfo-releaseName"></a>The release name. |
| releaseNotes| <code>string</code> \| <code>null</code> | <a name="UpdateInfo-releaseNotes"></a>The release notes. |
| releaseDate| <code>string</code> | <a name="UpdateInfo-releaseDate"></a>The release date. |
| **releaseDate**| <code>string</code> | <a name="UpdateInfo-releaseDate"></a>The release date. |

<a name="VersionInfo"></a>

Expand All @@ -199,7 +202,7 @@ Define `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` [environment variables](h

| Name | Type | Description |
| --- | --- | --- |
| version| <code>string</code> | <a name="VersionInfo-version"></a>The version. |
| **version**| <code>string</code> | <a name="VersionInfo-version"></a>The version. |

<a name="module_electron-builder-http/out/publishOptions.githubUrl"></a>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"sanitize-filename": "^1.6.1",
"semver": "^5.3.0",
"stat-mode": "^0.2.2",
"ts-jsdoc": "^1.2.0",
"ts-jsdoc": "^1.2.1",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.1.0",
"uuid-1345": "^0.99.6",
Expand Down
16 changes: 5 additions & 11 deletions packages/electron-builder/src/fileTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ import * as path from "path"
import { BuildInfo } from "./packagerApi"

export function isElectronCompileUsed(info: BuildInfo): boolean {
const depList = [(<any>info.metadata).devDependencies, info.metadata.dependencies]
if (info.isTwoPackageJsonProjectLayoutUsed) {
depList.push((<any>info.devMetadata).devDependencies)
depList.push(info.devMetadata.dependencies)
if (info.config.electronCompile != null) {
return info.config.electronCompile
}

for (const deps of depList) {
if (deps != null && "electron-compile" in deps) {
return true
}
}

return false
// if in devDependencies - it means that babel is used for precompilation or for some reason user decided to not use electron-compile for production
const deps = info.metadata.dependencies
return deps != null && "electron-compile" in deps
}

export async function createTransformer(srcDir: string, extraMetadata: any): Promise<FileTransformer> {
Expand Down
5 changes: 5 additions & 0 deletions packages/electron-builder/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ export interface Config extends PlatformSpecificBuildOptions {
*/
readonly buildVersion?: string | null

/**
* Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.
*/
readonly electronCompile?: boolean

readonly mac?: MacOptions | null
readonly mas?: MasBuildOptions | null
readonly dmg?: DmgOptions | null
Expand Down
12 changes: 4 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2255,18 +2255,14 @@ mime@^1.3.4:
dependencies:
brace-expansion "^1.0.0"

minimist@0.0.8:
minimist@0.0.8, minimist@~0.0.1:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

minimist@~0.0.1:
version "0.0.10"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"

mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
Expand Down Expand Up @@ -3169,9 +3165,9 @@ ts-babel@^3.0.0:
fs-extra-p "^4.1.0"
source-map-support "^0.4.14"

ts-jsdoc@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ts-jsdoc/-/ts-jsdoc-1.2.0.tgz#7400db16493fe3292bf884122142bd02b755d085"
ts-jsdoc@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ts-jsdoc/-/ts-jsdoc-1.2.1.tgz#e2b05881c4f8cc4b0972586d01d7a91673d18745"
dependencies:
bluebird-lst "^1.0.2"
chalk "^1.1.3"
Expand Down

0 comments on commit b4462a2

Please sign in to comment.