Change Flipper version retrieving

Summary:
Changed retrieving of Flipper version. Now it will be always retrieved from package.json. Before this change we used "remote.app.getVersion()" API which instead returned electron version for dev builds, e.g. "11.2.3". This is not convenient, because we now use Flipper version to check plugin compatibility and unrelated Electron version here makes things more complicated. After this change, if version is not properly bumped then "0.0.0" will be used: 1) when running using "yarn start", 2) when local building with "yarn build --mac" without setting new version, 3) when running tests "yarn test".

In addition to that I added a new command-line argument and env var which allow overriding version number for Flipper. This is useful for testing plugin updates, because compatibility between plugins and Flipper is checked by comparing Flipper version with the min version set in the plugin metadata.

Reviewed By: passy

Differential Revision: D28287354

fbshipit-source-id: 2f9482080e3612b95a24300050d98150c6db6cb7
This commit is contained in:
Anton Nikolaev
2021-05-11 17:02:24 -07:00
committed by Facebook GitHub Bot
parent 21ce694fd5
commit 2b41fba704
2 changed files with 16 additions and 10 deletions

View File

@@ -85,6 +85,11 @@ const argv = yargs
'[FB-internal only] Will force using public sources only, to be able to iterate quickly on the public version. If sources are checked out from GitHub this is already the default. Setting env var "FLIPPER_FORCE_PUBLIC_BUILD" is equivalent.',
type: 'boolean',
},
'force-version': {
describe:
'Will force using the given value as Flipper version, to be able to test logic which is version-dependent. Setting env var "FLIPPER_FORCE_VERSION" is equivalent.',
type: 'string',
},
})
.version('DEV')
.help()
@@ -152,6 +157,10 @@ if (argv.channel !== undefined) {
process.env.FLIPPER_RELEASE_CHANNEL = argv.channel;
}
if (argv['force-version']) {
process.env.FLIPPER_FORCE_VERSION = argv['force-version'];
}
function looksLikeDevServer(): boolean {
const hn = hostname();
if (/^devvm.*\.facebook\.com$/.test(hn)) {