Skip to content

Commit

Permalink
feat: Add FPA printout to log on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Dec 31, 2024
1 parent a4497e9 commit f0104f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const esbuild = require('esbuild');
const pipeline = promisify(require('stream').pipeline);

const packageJson = JSON.parse(fs.readFileSync('./package.json', { encoding: 'utf-8' }));

const config = {
buildVersion: Date.now().toString(),
publish: !!process.env.PUBLISH,
Expand Down Expand Up @@ -247,7 +248,12 @@ function createVersionFile(done) {
// Get Git Commit Hash
const gitCommitHash = execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim();

const data = `export const VERSION = '${formattedDate} (${gitCommitHash})';\n`;
const packageLockJson = JSON.parse(fs.readFileSync('./package-lock.json', { encoding: 'utf-8' }));
const fpaVersion = packageLockJson['packages']['node_modules/@fparchive/flashpoint-archive']['version'];

const data = `export const VERSION = '${formattedDate} (${gitCommitHash})';
export const FPA_VERSION = '${fpaVersion}';
`;

// Write to src/shared/version.ts
fs.writeFile('src/shared/version.ts', data, (err) => {
Expand Down
3 changes: 2 additions & 1 deletion src/back/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { LangFileContent, getDefaultLocalization } from '@shared/lang';
import { PreferencesFile } from '@shared/preferences/PreferencesFile';
import { defaultPreferencesData } from '@shared/preferences/util';
import { validateSemiUUID } from '@shared/utils/uuid';
import { VERSION } from '@shared/version';
import { FPA_VERSION, VERSION } from '@shared/version';
import * as child_process from 'child_process';
import { EventEmitter } from 'events';
import * as flashpoint from 'flashpoint-launcher';
Expand Down Expand Up @@ -303,6 +303,7 @@ async function prepForInit(message: any): Promise<void> {
};

log.info('Launcher', `Build Version: ${VERSION}`);
log.info('Launcher', `FPA Version: ${FPA_VERSION}`);

state.socketServer.secret = content.secret;

Expand Down

0 comments on commit f0104f8

Please sign in to comment.