Skip to content

Commit 425cfe9

Browse files
committed
fetching composer version dynamically
1 parent f7af889 commit 425cfe9

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

applications/sckanner/frontend/src/settings.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,26 @@ export const STRINGS_NUMBERS = [
7878

7979
// Get version from Vite environment variable (set at build time)
8080
export const SCKANNER_VERSION = import.meta.env.VITE_APP_VERSION || '3.1.1';
81-
export const COMPOSER_VERSION = '6.0.0';
81+
82+
const COMPOSER_PACKAGE_JSON_URL =
83+
'https://raw.githubusercontent.com/MetaCell/sckan-composer/refs/heads/main/applications/composer/frontend/package.json';
84+
85+
// Fetch Composer version from its package.json on GitHub
86+
const fetchComposerVersion = (): string => {
87+
try {
88+
const request = new XMLHttpRequest();
89+
request.open('GET', COMPOSER_PACKAGE_JSON_URL, false);
90+
request.send(null);
91+
if (request.status === 200) {
92+
const data = JSON.parse(request.responseText);
93+
return data?.version || '';
94+
}
95+
} catch {
96+
// fallback on error
97+
}
98+
return '';
99+
};
100+
export const COMPOSER_VERSION = fetchComposerVersion();
82101

83102
// Fetch NEURONDM version from remote sckan-version-info.json
84103
const fetchNeurondmVersion = (): string => {

0 commit comments

Comments
 (0)