-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathversion.ts
More file actions
42 lines (37 loc) · 1.04 KB
/
version.ts
File metadata and controls
42 lines (37 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as fs from 'fs';
import * as path from 'path';
export interface VersionInfo {
version: string;
buildTime: string;
source: string;
}
// This will be replaced by the build script
let versionData: VersionInfo = {
version: '0.19.0',
buildTime: '2026-02-01T21:12:35.929Z',
source: 'release'
};
// Try to read from package.json as fallback for development
try {
const packageJsonPath = path.join(__dirname, '../../package.json');
if (fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
versionData = {
version: packageJson.version || '0.1.0',
buildTime: new Date().toISOString(),
source: 'package.json'
};
}
} catch {
// Use static fallback if package.json can't be read
}
export const getSatelliteVersion = (): VersionInfo => {
return {
version: versionData.version || '0.1.0',
buildTime: versionData.buildTime,
source: versionData.source
};
};
export const getVersionString = (): string => {
return getSatelliteVersion().version;
};