[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(cli): bundle package version

+2 -15
+2 -15
cli/src/server.ts
··· 1 1 import crypto from 'node:crypto' 2 - import { readFileSync } from 'node:fs' 3 - import { fileURLToPath } from 'node:url' 4 - import { dirname, join } from 'node:path' 5 2 import { H3, HTTPError, handleCors, type H3Event } from 'h3' 6 3 import type { CorsOptions } from 'h3' 7 4 ··· 26 23 } from './npm-client.ts' 27 24 28 25 // Read version from package.json 29 - const __dirname = dirname(fileURLToPath(import.meta.url)) 30 - function getConnectorVersion(): string { 31 - try { 32 - const pkgPath = join(__dirname, '..', 'package.json') 33 - const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) 34 - return pkg.version || '0.0.0' 35 - } catch { 36 - // Fallback if package.json can't be read (e.g., in bundled builds) 37 - return '0.0.0' 38 - } 39 - } 26 + import pkg from '../package.json' with { type: 'json' } 40 27 41 - export const CONNECTOR_VERSION = getConnectorVersion() 28 + export const CONNECTOR_VERSION = pkg.version 42 29 43 30 function generateToken(): string { 44 31 return crypto.randomBytes(16).toString('hex')