Skip to content

Commit

Permalink
fix: remove package.json import on status page
Browse files Browse the repository at this point in the history
  • Loading branch information
matteovivona committed Feb 11, 2025
1 parent 6d98b29 commit ad63d6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"homepage": "https://github.com/ducktors/turborepo-remote-cache#readme",
"engines": {
"node": ">=20.0.0",
"pnpm": ">=9.15.5"
"pnpm": ">=9.15.4"
},
"keywords": [
"turborepo",
Expand Down
12 changes: 1 addition & 11 deletions src/plugins/remote-cache/routes/get-status.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { readFileSync } from 'fs'
import type { Server } from 'http'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
import type {
RawReplyDefaultExpression,
RawRequestDefaultExpression,
Expand All @@ -10,13 +7,6 @@ import type {
import { type Params, type Querystring } from './schema.js'
import { statusRouteSchema } from './status-schema.js'

// Get package.json version
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const packageJson = JSON.parse(
readFileSync(join(__dirname, '../../../../package.json'), 'utf8'),
)

export const getStatus: RouteOptions<
Server,
RawRequestDefaultExpression,
Expand All @@ -33,7 +23,7 @@ export const getStatus: RouteOptions<
async handler(req, reply) {
reply.send({
status: 'enabled',
version: packageJson.version,
version: process.env.npm_package_version ?? 'unknown',
})
},
}

0 comments on commit ad63d6e

Please # to comment.