Skip to content

Commit d6525b3

Browse files
author
ChidcGithub
committed
refactor: centralize version configuration
- Add frontend/src/config/version.js for frontend version - Add backend/config.py for backend version - Update Header.js, SocialCardGenerator.js, main.py to use centralized config
1 parent 1ec3af9 commit d6525b3

5 files changed

Lines changed: 23 additions & 12 deletions

File tree

backend/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
PyVizAST Version Configuration
3+
All version numbers are managed in this single file for easy updates.
4+
"""
5+
6+
VERSION = "0.7.1"
7+
BUILD = "2522"
8+
FULL_VERSION = f"v{VERSION}"

backend/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from pydantic import ValidationError
1919

2020
from .utils.logger import log_exception, init_logging
21+
from .config import VERSION
2122
from .exceptions import (
2223
AnalysisError,
2324
CodeParsingError,
@@ -58,7 +59,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
5859
app = FastAPI(
5960
title="PyVizAST API",
6061
description="Python AST Visualization and Static Analysis API",
61-
version="0.7.1",
62+
version=VERSION,
6263
docs_url="/docs",
6364
redoc_url="/redoc",
6465
lifespan=lifespan

frontend/src/components/Header.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState, useCallback, useEffect, useRef } from 'react';
2+
import { VERSION, BUILD } from '../config/version';
23

34
const DECRYPT_KEY = 42;
45

@@ -12,10 +13,6 @@ const decrypt = (encrypted) => {
1213
}
1314
};
1415

15-
// Version info
16-
const APP_VERSION = '0.7.1';
17-
const APP_BUILD = '2522';
18-
1916
// Get actual encrypted values (these are pre-encrypted)
2017
const AUTHOR_DATA = {
2118
author: decrypt('aUJDTkk='),
@@ -769,11 +766,11 @@ function Header({
769766
</div>
770767
<div className="info-row">
771768
<span className="info-label">Version</span>
772-
<span className="info-value">v{APP_VERSION}</span>
769+
<span className="info-value">v{VERSION}</span>
773770
</div>
774771
<div className="info-row">
775772
<span className="info-label">Build</span>
776-
<span className="info-value info-build">{APP_BUILD}</span>
773+
<span className="info-value info-build">{BUILD}</span>
777774
</div>
778775
</div>
779776
<p className="easter-egg-hint">

frontend/src/components/SocialCardGenerator.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React, { useState, useRef, useCallback, useEffect, useMemo } from 'react';
2-
3-
// App version
4-
const APP_VERSION = '0.7.1';
2+
import { VERSION } from '../config/version';
53

64
// Social Card Generator - creates beautiful black/white themed image cards
75
function SocialCardGenerator({
@@ -353,7 +351,7 @@ function SocialCardGenerator({
353351
ctx.font = '500 16px "SF Pro Text", -apple-system, sans-serif';
354352
ctx.fillStyle = colors.textMuted;
355353
ctx.textAlign = 'right';
356-
ctx.fillText(`v${APP_VERSION}`, width - edgePadding - 50, edgePadding + 32);
354+
ctx.fillText(`v${VERSION}`, width - edgePadding - 50, edgePadding + 32);
357355

358356
// Center AST visualization
359357
drawASTGraph(ctx, width / 2, height / 2 - 20, width * 0.6, height * 0.45);
@@ -489,7 +487,7 @@ function SocialCardGenerator({
489487
ctx.fillText('Python AST Visualizer & Static Analyzer', edgePadding, footerY);
490488

491489
ctx.textAlign = 'right';
492-
ctx.fillText(`v${APP_VERSION}`, width - edgePadding, footerY);
490+
ctx.fillText(`v${VERSION}`, width - edgePadding, footerY);
493491
}, [colors, drawLogo, roundRect]);
494492

495493
// Generate card image

frontend/src/config/version.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* PyVizAST Version Configuration
3+
* All version numbers are managed in this single file for easy updates.
4+
*/
5+
export const VERSION = '0.7.1';
6+
export const BUILD = '2522';
7+
export const FULL_VERSION = `v${VERSION}`;

0 commit comments

Comments
 (0)