File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515 removeDirectory ,
1616 ensureDirectory ,
1717} from "../utils/paths.js" ;
18+ import { getApiVersion } from "../utils/update-checker.js" ;
1819
1920/**
2021 * Main setup wizard
@@ -144,6 +145,7 @@ export async function setupWizard(): Promise<void> {
144145 } ;
145146
146147 // Display configuration review
148+ const apiVersion = getApiVersion ( ) ;
147149 console . log ( chalk . cyan . bold ( "\n📋 Configuration Review\n" ) ) ;
148150 console . log ( chalk . gray ( "Please review your configuration:\n" ) ) ;
149151 console . log (
@@ -152,6 +154,7 @@ export async function setupWizard(): Promise<void> {
152154 console . log (
153155 chalk . white ( " API Port: " ) + chalk . cyan ( config . port . toString ( ) )
154156 ) ;
157+ console . log ( chalk . white ( " API Version: " ) + chalk . cyan ( apiVersion ) ) ;
155158 console . log (
156159 chalk . white ( " Database User: " ) + chalk . cyan ( config . postgresUser )
157160 ) ;
@@ -252,8 +255,11 @@ export async function setupWizard(): Promise<void> {
252255 * Display success message with next steps
253256 */
254257function displaySuccessMessage ( port : number , installDir : string ) : void {
258+ const apiVersion = getApiVersion ( ) ;
255259 console . log ( chalk . green . bold ( "\n✅ Setup Complete!\n" ) ) ;
256260 console . log ( chalk . cyan ( "📚 Your DesterLib server is now running!\n" ) ) ;
261+ console . log ( chalk . gray ( " API Version: " ) + chalk . cyan ( apiVersion ) ) ;
262+ console . log ( "" ) ;
257263
258264 console . log ( chalk . bold ( "🔗 Quick Links:" ) ) ;
259265 console . log (
Original file line number Diff line number Diff line change @@ -25,6 +25,33 @@ export function getCurrentVersion(): string {
2525 }
2626}
2727
28+ /**
29+ * Get the API version from the root package.json
30+ * The API version is synced with the root package.json version
31+ * Falls back to CLI version if root package.json is not accessible
32+ */
33+ export function getApiVersion ( ) : string {
34+ try {
35+ // Navigate from packages/cli/dist/utils to root package.json
36+ const rootPackagePath = join ( __dirname , "../../../../package.json" ) ;
37+ const packageJson = JSON . parse ( readFileSync ( rootPackagePath , "utf-8" ) ) ;
38+ return packageJson . version || getCurrentVersion ( ) ;
39+ } catch ( error ) {
40+ // Fallback: try to read from apps/api/package.json
41+ try {
42+ const apiPackagePath = join (
43+ __dirname ,
44+ "../../../../apps/api/package.json"
45+ ) ;
46+ const packageJson = JSON . parse ( readFileSync ( apiPackagePath , "utf-8" ) ) ;
47+ return packageJson . version || getCurrentVersion ( ) ;
48+ } catch ( fallbackError ) {
49+ // Final fallback: use CLI version (versions are synced)
50+ return getCurrentVersion ( ) ;
51+ }
52+ }
53+ }
54+
2855/**
2956 * Check for updates from GitHub releases
3057 */
You can’t perform that action at this time.
0 commit comments