electron-react-boilerplate / electron-react-boilerplate/electron-react-boilerplate

Wrong version returned from app.getVersion()

Closed
#3,418 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
24.3k
Forks
4k
Avg merge
20m
Merged PRs (30d)
4

Description

## Prerequisites

- [x] Using npm
- [x] Using an up-to-date [`main` branch](https://github.com/electron-react-boilerplate/electron-react-boilerplate/tree/main)
- [x] Using latest version of devtools. [Check the docs for how to update](https://electron-react-boilerplate.js.org/docs/dev-tools/)
- [ ] Tried solutions mentioned in [#400](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/400)
- [ ] For issue in production release, add devtools output of `DEBUG_PROD=true npm run build && npm start`

## Expected Behavior

The correct app version is returned for both envs: production and development.

## Current Behavior

In the production `app.getVersion()` returns the correct app version.
In the development it returns Electron's version (ss below)
CleanShot 2023-02-10 at 13 00 04@2x

## Steps to Reproduce

In `main.ts` (L:28) file replace:
```ts
ipcMain.on('ipc-example', async (event, arg) => {
const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`;
console.log(msgTemplate(arg));
event.reply('ipc-example', 'pong'));
});
```
with
```ts
ipcMain.on('ipc-example', async (event, arg) => {
const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`;
console.log(msgTemplate(arg));
event.reply('ipc-example', msgTemplate(`pong, version: ${app.getVersion()}`));
});
```

## Possible Solution (Not obligatory)

1. I know that one of the possible solutions is to insert the version in root package.json but IMO we shouldn't take care and remember about that we should change the version in both package.json files.

2. Merge root and release/app package.json files

It would be nice to have one source of truth for version number on both environments.

## Context

## Your Environment

- Node version :
- electron-react-boilerplate version or branch :
- Operating System and version :
- Link to your project :

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.