Move changelog loading to server
Summary: per title Reviewed By: aigoncharov Differential Revision: D32723706 fbshipit-source-id: ce5108da9f5da6fdfa7d1a66a31a4f8f430eb78d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
eab4f0d3d3
commit
129cbd6f7b
@@ -37,6 +37,7 @@ import {KeytarManager} from './utils/keytar';
|
||||
import {PluginManager} from './plugins/PluginManager';
|
||||
import {runHealthcheck, getHealthChecks} from './utils/runHealthchecks';
|
||||
import {openFile} from './utils/openFile';
|
||||
import {getChangelog} from './utils/pathUtils';
|
||||
|
||||
/**
|
||||
* FlipperServer takes care of all incoming device & client connections.
|
||||
@@ -195,6 +196,7 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
|
||||
private commandHandler: FlipperServerCommands = {
|
||||
'get-config': async () => this.config,
|
||||
'get-changelog': getChangelog,
|
||||
'device-start-logging': async (serial: string) =>
|
||||
this.getDevice(serial).startLogging(),
|
||||
'device-stop-logging': async (serial: string) =>
|
||||
|
||||
@@ -30,7 +30,16 @@ export function getStaticPath(
|
||||
: absolutePath;
|
||||
}
|
||||
|
||||
export function getChangelogPath() {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user