diff --git a/src/util.ts b/src/util.ts index 412e23f14b9..62c34b7193f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -99,7 +99,9 @@ export async function getElectronVersion(packageData: any, packageJsonPath: stri return (await readJson(path.join(path.dirname(packageJsonPath), "node_modules", "electron-prebuilt", "package.json"))).version } catch (e) { - // ignore + if (e.code !== "ENOENT") { + console.warn("Cannot read electron version from electron-prebuilt package.json" + e.message) + } } const devDependencies = packageData.devDependencies diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts index 7e03a5e00d1..9729657686b 100755 --- a/test/src/BuildTest.ts +++ b/test/src/BuildTest.ts @@ -1,6 +1,6 @@ import test from "./helpers/avaEx" import { assertPack, modifyPackageJson, platform } from "./helpers/packTester" -import { move, mkdirs, outputFile } from "fs-extra-p" +import { move, mkdirs, outputFile, outputJson } from "fs-extra-p" import { Promise as BluebirdPromise } from "bluebird" import * as path from "path" import { assertThat } from "./helpers/fileAssert" @@ -53,6 +53,23 @@ test("build in the app package.json", t => { }), /'build' in the application package\.json .+/) }) +test("version from electron-prebuilt dependency", async () => { + await assertPack("test-app-one", { + platform: [process.platform], + arch: process.arch, + dist: false + }, projectDir => { + return BluebirdPromise.all([ + outputJson(path.join(projectDir, "node_modules", "electron-prebuilt", "package.json"), { + version: "0.37.2" + }), + modifyPackageJson(projectDir, data => { + data.devDependencies = {} + }) + ]) + }) +}) + test("copy extra resource", async () => { const platform = process.platform const osName = Platform.fromNodePlatform(platform).buildConfigurationKey