Skip to content

Commit 0265db9

Browse files
committed
fix: Problems downloading electron #180
Closes #180
1 parent 46dbfe1 commit 0265db9

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/util.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export async function getElectronVersion(packageData: any, packageJsonPath: stri
9999
return (await readJson(path.join(path.dirname(packageJsonPath), "node_modules", "electron-prebuilt", "package.json"))).version
100100
}
101101
catch (e) {
102-
// ignore
102+
if (e.code !== "ENOENT") {
103+
console.warn("Cannot read electron version from electron-prebuilt package.json" + e.message)
104+
}
103105
}
104106

105107
const devDependencies = packageData.devDependencies

test/src/BuildTest.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from "./helpers/avaEx"
22
import { assertPack, modifyPackageJson, platform } from "./helpers/packTester"
3-
import { move, mkdirs, outputFile } from "fs-extra-p"
3+
import { move, mkdirs, outputFile, outputJson } from "fs-extra-p"
44
import { Promise as BluebirdPromise } from "bluebird"
55
import * as path from "path"
66
import { assertThat } from "./helpers/fileAssert"
@@ -53,6 +53,23 @@ test("build in the app package.json", t => {
5353
}), /'build' in the application package\.json .+/)
5454
})
5555

56+
test("version from electron-prebuilt dependency", async () => {
57+
await assertPack("test-app-one", {
58+
platform: [process.platform],
59+
arch: process.arch,
60+
dist: false
61+
}, projectDir => {
62+
return BluebirdPromise.all([
63+
outputJson(path.join(projectDir, "node_modules", "electron-prebuilt", "package.json"), {
64+
version: "0.37.2"
65+
}),
66+
modifyPackageJson(projectDir, data => {
67+
data.devDependencies = {}
68+
})
69+
])
70+
})
71+
})
72+
5673
test("copy extra resource", async () => {
5774
const platform = process.platform
5875
const osName = Platform.fromNodePlatform(platform).buildConfigurationKey

0 commit comments

Comments
 (0)