UNPKG

@gensx/storage

Version:

Cloud storage, blobs, sqlite, and vector database providers/hooks for GenSX.

36 lines (32 loc) 1.28 kB
/** * Check out the docs at https://www.gensx.com/docs * Find us on Github https://github.com/gensx-inc/gensx * Find us on Discord https://discord.gg/F5BSU8Kc */ import { existsSync, readFileSync } from 'node:fs'; import path__default from 'node:path'; import { fileURLToPath } from 'node:url'; let version = ""; const dirname = path__default.dirname(fileURLToPath(import.meta.url)); let rootDir = path__default.resolve(dirname, "..", "..", ".."); let packageJsonPath = path__default.join(rootDir, "package.json"); if (existsSync(packageJsonPath)) { const localPackageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); version = localPackageJson.version; } else { // if the first check fails, try two levels up instead of three rootDir = path__default.resolve(dirname, "..", ".."); packageJsonPath = path__default.join(rootDir, "package.json"); if (existsSync(packageJsonPath)) { const localPackageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); version = localPackageJson.version; } else { console.error("Error trying to get version from package.json"); } } const VERSION = version; const USER_AGENT = `@gensx/storage v${VERSION}`; export { USER_AGENT, VERSION }; //# sourceMappingURL=user-agent.js.map