format import path from 'path' ; import fs from 'fs' ; import { getFlipperServerConfig } from '../FlipperServerConfig' ; import { isFBBuild } from '../fb-stubs/constants' ; export function getStaticPath ( relativePath = '.' , { asarUnpacked } = { asarUnpacked : false } ) { const staticDir = getFlipperServerConfig ( ) . paths . staticPath ; const absolutePath = path . resolve ( staticDir , relativePath ) ; return asarUnpacked ? absolutePath . replace ( 'app.asar' , 'app.asar.unpacked' ) : absolutePath ; } export async function getChangelog ( ) { return ( await fs . promises . readFile ( path . join ( getChangelogPath ( ) , 'CHANGELOG.md' ) , 'utf8' ) ) . trim ( ) ; } function getChangelogPath ( ) { const changelogPath = getStaticPath ( isFBBuild ? 'facebook' : '.' ) ; if ( fs . existsSync ( changelogPath ) ) { return changelogPath ; } else { throw new Error ( 'Changelog path path does not exist: ' + changelogPath ) ; } }