feat(profile): display version number from .env in profile menu (#182)

* feat(profile): display version number from .env in profile menu

* Update version checking process

---------

Co-authored-by: LukeGus <bugattiguy527@gmail.com>
This commit was merged in pull request #182.
This commit is contained in:
Shivam Kumar
2025-09-08 10:44:17 +05:30
committed by GitHub
parent aa04597e16
commit dfb50ed8b1
6 changed files with 47 additions and 36 deletions

View File

@@ -147,22 +147,16 @@ app.get('/health', (req, res) => {
app.get('/version', async (req, res) => {
let localVersion = process.env.VERSION;
// Fallback to package.json version if env variable not set
if (!localVersion) {
try {
const packagePath = path.resolve(process.cwd(), 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
localVersion = packageJson.version;
logger.info(`Using version from package.json: ${localVersion}`);
} catch (error) {
logger.error('Failed to read version from package.json:', error);
}
}
// Debug logging
logger.debug(`Final version: ${localVersion}`);
logger.debug(`Working directory: ${process.cwd()}`);
if (!localVersion) {
logger.error('No version information available');
@@ -186,6 +180,7 @@ app.get('/version', async (req, res) => {
const response = {
status: localVersion === remoteVersion ? 'up_to_date' : 'requires_update',
localVersion: localVersion,
version: remoteVersion,
latest_release: {
tag_name: releaseData.data.tag_name,