Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(packager): throw error when electron-prebuilt-compile is not found #2

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/util/resolve-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ export default async (dir) => {
if (await fs.exists(testPath)) {
const packageJSON = JSON.parse(await fs.readFile(testPath, 'utf8'));

if (packageJSON.devDependencies && packageJSON.devDependencies['electron-prebuilt-compile']
&& !/[0-9]/.test(packageJSON.devDependencies['electron-prebuilt-compile'][0])) {
global._resolveError = () => console.error('You must depend on an EXACT version of "electron-prebuilt-compile" not a range'.red);
if (packageJSON.devDependencies && packageJSON.devDependencies['electron-prebuilt-compile']) {
if (!/[0-9]/.test(packageJSON.devDependencies['electron-prebuilt-compile'][0])) {
global._resolveError = () => console.error('You must depend on an EXACT version of "electron-prebuilt-compile" not a range'.red);
return null;
}
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this else is at the wrong level (hence the test failure). I think it should be on the nested if statement. And both branches of that nested if statement need to return null

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. That was because I resolved a merge conflict incorrectly. I was wondering why the tests failed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I had flaky tests already and was about to cry 😆 Quite happy that it caught it 👍

global._resolveError = () => console.error('You must depend on "electron-prebuilt-compile" in your devDependencies'.red);
return null;
}

Expand Down