Skip to content

Commit

Permalink
fix(packager): warn if the app version is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Oct 23, 2017
1 parent e55ea98 commit 29070ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/package.js
Expand Up @@ -9,6 +9,7 @@ import { hostArch } from 'electron-packager/targets';

import getForgeConfig from '../util/forge-config';
import runHook from '../util/hook';
import { warn } from '../util/messages';
import realOra, { fakeOra } from '../util/ora';
import packagerCompileHook from '../util/compile-hook';
import readPackageJSON from '../util/read-package-json';
Expand Down Expand Up @@ -111,6 +112,11 @@ export default async (providedOptions = {}) => {
throw new Error('electron-compile does not support asar.unpack yet. Please use asar.unpackDir');
}

if (!packageJSON.version && !packageOpts.appVersion) {
// eslint-disable-next-line max-len
warn(interactive, "Please set 'version' or 'config.forge.electronPackagerConfig.appVersion' in your application's package.json so auto-updates work properly".yellow);
}

await runHook(forgeConfig, 'generateAssets');
await runHook(forgeConfig, 'prePackage');

Expand Down

3 comments on commit 29070ca

@danibishop
Copy link

Choose a reason for hiding this comment

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

I might be reading this the wrong way but the text on the warning (117) and the condition (115) say different things, isn´t it?

@malept
Copy link
Member Author

@malept malept commented on 29070ca Oct 23, 2017

Choose a reason for hiding this comment

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

How are you interpreting it?

@danibishop
Copy link

Choose a reason for hiding this comment

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

I am wrong. I noticed it writing the comment. I was thinking in the equivalent:
if !(packageJSON.version || packageOpts.appVersion)

And for some reason I did not see it in your code. Sorry for the lost time.

Please sign in to comment.