electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.49k stars 520 forks source link

App name and version not set in development mode? #258

Closed BenV closed 7 years ago

BenV commented 7 years ago

Please describe your issue:

*Console output when you run electron-forge with the environment variable `DEBUG=electron-forge:`. (Instructions on how to do so here). Please include the stack trace if one exists.**

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +17ms
  electron-forge:runtime-config setting key: verbose to value: false +13ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /Users/vinsonb/scratch/test-electron-app +2ms
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/vinsonb/scratch/test-electron-app/package.json +5ms
  electron-forge:lifecycle Process Succeeded: Locating Application +1ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +1ms
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +43ms
  electron-forge:hook could not find hook: generateAssets +6ms
  electron-forge:lifecycle Process Started: Launching Application +1ms
  electron-forge:lifecycle Process Succeeded: Launching Application +4ms

What command line arguments are you passing?

start

What does your config.forge data in package.json look like?

"forge": {
            "make_targets": {
                "win32": [
                    "squirrel"
                ],
                "darwin": [
                    "zip"
                ],
                "linux": [
                    "deb",
                    "rpm"
                ]
            },
            "electronPackagerConfig": {
            },
            "electronWinstallerConfig": {
                "name": "test_electron_app"
            },
            "electronInstallerDebian": {},
            "electronInstallerRedhat": {},
            "github_repository": {
                "owner": "",
                "name": ""
            },
            "windowsStoreConfig": {
                "packageName": "",
                "name": "testelectronapp"
            }

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to reproduce your problem. Using electron-forge init is a good starting point, if that is not the source of your problem.

When creating a new project with electron-forge init and then running electron-forge start the methods app.getName() and app.getVersion() return information about Electron itself instead of the values from package.json. They work fine when the application is packaged. This causes application data from all Electron Forge development apps to be put into the same directory, makes them all have the same user agent, etc. This does not happen in development mode with a minimal electron-quick-start application.

If this is the expected behavior, is there any way to override this? My current workaround is to use app.setAppName etc, but that seems quite hacky. I apologize if this is documented somewhere, as it seems pretty basic. I tried searching around, but only found people using the same workaround: https://github.com/felixrieseberg/ember-electron/issues/199

malept commented 7 years ago

This appears to be a bug in the electron-prebuilt-compile module? I can reproduce the behavior by cloning electron-quick-start and replacing electron with electron-prebuilt-compile in package.json, then running npm install and npm start after adding the following to the bottom of main.js:

console.log(app.getName())
console.log(app.getVersion())

CC: @paulcbetts

MarshallOfSound commented 7 years ago

PR up in electron-prebuilt-compile to fix this 👍