-
Notifications
You must be signed in to change notification settings - Fork 378
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: refactor way we get COMPOSER_VERSION #7326
Changes from 2 commits
f57f6b3
62cbeb9
74990d5
bb252f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
const { app, ipcRenderer } = require('electron'); // eslint-disable-line | ||
const { ipcRenderer } = require('electron'); // eslint-disable-line | ||
|
||
// expose ipcRenderer to the browser | ||
window.ipcRenderer = ipcRenderer; | ||
// get the app version to hand into the client | ||
window.appVersion = app.getVersion(); | ||
// flag to distinguish electron client from web app client | ||
window.__IS_ELECTRON__ = true; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import path from 'path'; | ||
|
||
import fs from 'fs-extra'; | ||
|
||
const isProduction = process.env.NODE_ENV === 'production'; | ||
|
||
export function getVersion(): string { | ||
try { | ||
const version = fs.readJSONSync(path.join(__dirname, '../../../electron-server/package.json')).version; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this file exist in packed electron? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, but the env variable gets set in the electron start up sequence. So in that case, this will just error and return Right now, there is not a lazy evaluation for getting default values using the |
||
return isProduction ? version : `${version}-DEV`; | ||
} catch { | ||
return 'unknown'; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question