Fix retrieving versions for release builds
Summary: Fixed release build version retrieval Reviewed By: passy, cekkaewnumchai Differential Revision: D28378502 fbshipit-source-id: 345e7fac327a072a5c84cfa92bf4af78b6829654
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e6f68a9fce
commit
e7670e4e42
@@ -8,7 +8,10 @@
|
||||
*/
|
||||
|
||||
import os from 'os';
|
||||
import {isTest} from './isProduction';
|
||||
import isProduction, {isTest} from './isProduction';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {getStaticPath} from './pathUtils';
|
||||
|
||||
export type Info = {
|
||||
arch: string;
|
||||
@@ -41,7 +44,13 @@ export function getAppVersion(): string {
|
||||
return (APP_VERSION =
|
||||
APP_VERSION ??
|
||||
process.env.FLIPPER_FORCE_VERSION ??
|
||||
(isTest() ? '0.0.0' : require('../../package.json').version ?? '0.0.0'));
|
||||
(isTest()
|
||||
? '0.0.0'
|
||||
: (isProduction()
|
||||
? fs.readJsonSync(path.join(getStaticPath(), 'package.json'), {
|
||||
throws: false,
|
||||
})?.version
|
||||
: require('../../package.json').version) ?? '0.0.0'));
|
||||
}
|
||||
|
||||
export function stringifyInfo(info: Info): string {
|
||||
|
||||
Reference in New Issue
Block a user