diff --git a/docs/Options.md b/docs/Options.md
index d0c930bcd92..c7e756efa5d 100644
--- a/docs/Options.md
+++ b/docs/Options.md
@@ -54,7 +54,7 @@ Here documented only `electron-builder` specific options:
| app-category-type |
*macOS-only.* The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.
For example, app-category-type=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/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
| asar | Whether to package the application’s source code into an archive, using [Electron’s archive format](https://github.com/electron/asar). Defaults to true
. Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron’s documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).
Or you can pass object of any asar options.
electron-builder detects node modules that must be unpacked automatically, you don’t need to explicitly set asar.unpackDir
- please file issue if this doesn’t work.
| productName | See [AppMetadata.productName](#AppMetadata-productName).
-| files | A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the [app directory](#MetadataDirectories-app), which specifies which files to include when copying files to create the package. See [File Patterns](#multiple-glob-patterns).
+| files | A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the [app directory](#MetadataDirectories-app), which specifies which files to include when copying files to create the package.
See [File Patterns](#multiple-glob-patterns).
| extraResources | A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the project directory, when specified, copy the file or directory with matching names directly into the app’s resources directory (Contents/Resources
for MacOS, resources
for Linux/Windows).
Glob rules the same as for [files](#multiple-glob-patterns).
| extraFiles | The same as [extraResources](#BuildMetadata-extraResources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux/Windows).
| mac | See [.build.mac](#MacOptions).
diff --git a/src/metadata.ts b/src/metadata.ts
index 35b2cd6de55..e6788e2c9c4 100755
--- a/src/metadata.ts
+++ b/src/metadata.ts
@@ -125,6 +125,7 @@ export interface BuildMetadata {
/**
A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the [app directory](#MetadataDirectories-app), which specifies which files to include when copying files to create the package.
+
See [File Patterns](#multiple-glob-patterns).
*/
readonly files?: Array | string | null
diff --git a/src/util/filter.ts b/src/util/filter.ts
index 3aefddb3763..991a496dc61 100644
--- a/src/util/filter.ts
+++ b/src/util/filter.ts
@@ -90,7 +90,7 @@ function minimatchAll(path: string, patterns: Array): boolean {
}
// partial match — pattern: foo/bar.txt path: foo — we must allow foo
- // use it only for non-negate patterns: const m = new Minimatch("!node_modules/@(electron-download|electron-prebuilt)/**/*", {dot: true }); m.match("node_modules", true) will return false, but must be true
+ // use it only for non-negate patterns: const m = new Minimatch("!node_modules/@(electron-download|electron)/**/*", {dot: true }); m.match("node_modules", true) will return false, but must be true
match = pattern.match(path, !pattern.negate)
}
return match
diff --git a/src/util/util.ts b/src/util/util.ts
index ca1f6b8299b..7c3942c3709 100644
--- a/src/util/util.ts
+++ b/src/util/util.ts
@@ -147,18 +147,21 @@ export async function getElectronVersion(packageData: any, packageJsonPath: stri
if (build != null && build.electronVersion != null) {
return build.electronVersion
}
- try {
- return (await readJson(path.join(path.dirname(packageJsonPath), "node_modules", "electron-prebuilt", "package.json"))).version
- }
- catch (e) {
- if (e.code !== "ENOENT") {
- warn(`Cannot read electron version from electron-prebuilt package.json: ${e.message}`)
+
+ for (let name of ["electron", "electron-prebuilt", "electron-prebuilt-compile"]) {
+ try {
+ return (await readJson(path.join(path.dirname(packageJsonPath), "node_modules", name, "package.json"))).version
+ }
+ catch (e) {
+ if (e.code !== "ENOENT") {
+ warn(`Cannot read electron version from ${name} package.json: ${e.message}`)
+ }
}
}
const electronPrebuiltDep = findFromElectronPrebuilt(packageData)
if (electronPrebuiltDep == null) {
- throw new Error("Cannot find electron-prebuilt dependency to get electron version in the '" + packageJsonPath + "'")
+ throw new Error("Cannot find electron dependency to get electron version in the '" + packageJsonPath + "'")
}
const firstChar = electronPrebuiltDep[0]
@@ -166,15 +169,15 @@ export async function getElectronVersion(packageData: any, packageJsonPath: stri
}
function findFromElectronPrebuilt(packageData: any): any {
- for (let name of ["electron-prebuilt", "electron-prebuilt-compile"]) {
+ for (let name of ["electron", "electron-prebuilt", "electron-prebuilt-compile"]) {
const devDependencies = packageData.devDependencies
- let electronPrebuiltDep = devDependencies == null ? null : devDependencies[name]
- if (electronPrebuiltDep == null) {
+ let dep = devDependencies == null ? null : devDependencies[name]
+ if (dep == null) {
const dependencies = packageData.dependencies
- electronPrebuiltDep = dependencies == null ? null : dependencies[name]
+ dep = dependencies == null ? null : dependencies[name]
}
- if (electronPrebuiltDep != null) {
- return electronPrebuiltDep
+ if (dep != null) {
+ return dep
}
}
return null
diff --git a/test/fixtures/app-executable-deps/app/start-electron.js b/test/fixtures/app-executable-deps/app/start-electron.js
index 3ad81cd141f..2336829d8cb 100644
--- a/test/fixtures/app-executable-deps/app/start-electron.js
+++ b/test/fixtures/app-executable-deps/app/start-electron.js
@@ -1,3 +1,3 @@
-const electron = require('electron-prebuilt'),
+const electron = require('electron'),
proc = require('child_process'),
child = proc.spawn(electron, ['.']);
\ No newline at end of file
diff --git a/test/fixtures/app-executable-deps/package.json b/test/fixtures/app-executable-deps/package.json
index 42b3cea5c73..010bc106e20 100644
--- a/test/fixtures/app-executable-deps/package.json
+++ b/test/fixtures/app-executable-deps/package.json
@@ -1,7 +1,7 @@
{
"devDependencies": {
"electron-builder": "next",
- "electron-prebuilt": "^1.3.2"
+ "electron": "^1.3.2"
},
"build": {
"app-category-type": "public.app-category.business"
diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts
index 6192c2c43e9..438c96971ec 100755
--- a/test/src/BuildTest.ts
+++ b/test/src/BuildTest.ts
@@ -150,7 +150,7 @@ test("relative index", () => assertPack("test-app", allPlatforms(false), {
const electronVersion = "1.3.2"
-test.ifNotWindows("electron version from electron-prebuilt dependency", () => assertPack("test-app-one", {
+test.ifDevOrLinuxCi("electron version from electron-prebuilt dependency", () => assertPack("test-app-one", {
targets: Platform.LINUX.createTarget(DIR_TARGET),
}, {
tempDirCreated: projectDir => BluebirdPromise.all([
@@ -158,12 +158,27 @@ test.ifNotWindows("electron version from electron-prebuilt dependency", () => as
version: electronVersion
}),
modifyPackageJson(projectDir, data => {
+ delete data.build.electronVersion
data.devDependencies = {}
})
])
}))
-test.ifNotWindows("electron version from build", () => assertPack("test-app-one", {
+test.ifDevOrLinuxCi("electron version from electron dependency", () => assertPack("test-app-one", {
+ targets: Platform.LINUX.createTarget(DIR_TARGET),
+}, {
+ tempDirCreated: projectDir => BluebirdPromise.all([
+ outputJson(path.join(projectDir, "node_modules", "electron", "package.json"), {
+ version: electronVersion
+ }),
+ modifyPackageJson(projectDir, data => {
+ delete data.build.electronVersion
+ data.devDependencies = {}
+ })
+ ])
+}))
+
+test.ifDevOrLinuxCi("electron version from build", () => assertPack("test-app-one", {
targets: Platform.LINUX.createTarget(DIR_TARGET),
}, {
tempDirCreated: projectDir => modifyPackageJson(projectDir, data => {