UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

42 lines (41 loc) 1.47 kB
/* * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com> * This file is part of Sync-in | The open source file sync and share solution * See the LICENSE file for licensing details */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "loadVersion", { enumerable: true, get: function() { return loadVersion; } }); const _fs = require("fs"); const _nodepath = require("node:path"); const _configconstants = require("./configuration/config.constants"); function loadVersion() { let version; const currentDir = (0, _nodepath.resolve)((0, _nodepath.join)(__dirname, _configconstants.IS_TEST_ENV ? '../../' : '.')); const packageJson = 'package.json'; const candidatePaths = [ (0, _nodepath.join)(currentDir, `./${packageJson}`), (0, _nodepath.join)(currentDir, `../${packageJson}`), (0, _nodepath.join)(currentDir, `../../${packageJson}`) ]; for (const p of candidatePaths){ if (!(0, _fs.existsSync)(p)) continue; try { version = JSON.parse((0, _fs.readFileSync)(p, 'utf8')).version; break; } catch (e) { console.error(`unable to load version from: ${p} - ${e}`); } } if (!version) { throw new Error('Application version not found (package.json not readable on known paths)'); } return version; } //# sourceMappingURL=app.functions.js.map