mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 14:22:02 +00:00
- Introduced a new command for fetching and validating GitHub issues, allowing users to address issues directly from the command line. - Added a release command to bump the version of the application and build the Electron app, ensuring version consistency across UI and server packages. - Updated package.json files for both UI and server to version 0.7.1, reflecting the latest changes. - Implemented version utility in the server to read the version from package.json, enhancing version management across the application.
34 lines
855 B
TypeScript
34 lines
855 B
TypeScript
/**
|
|
* Version utility - Reads version from package.json
|
|
*/
|
|
|
|
import { readFileSync } from 'fs';
|
|
import { fileURLToPath } from 'url';
|
|
import { dirname, join } from 'path';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
let cachedVersion: string | null = null;
|
|
|
|
/**
|
|
* Get the version from package.json
|
|
* Caches the result for performance
|
|
*/
|
|
export function getVersion(): string {
|
|
if (cachedVersion) {
|
|
return cachedVersion;
|
|
}
|
|
|
|
try {
|
|
const packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
const version = packageJson.version || '0.0.0';
|
|
cachedVersion = version;
|
|
return version;
|
|
} catch (error) {
|
|
console.warn('Failed to read version from package.json:', error);
|
|
return '0.0.0';
|
|
}
|
|
}
|