fix(telemetry): Pointing and resolving packages wrongly (#9939)

FIXES FRMW-2764

**What**
- Fix wrong CLI package
- Fix package.json path resolution
This commit is contained in:
Adrien de Peretti
2024-11-06 09:43:04 +01:00
committed by GitHub
parent 674c86eaa0
commit de228d209f
3 changed files with 9 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/telemetry": patch
"@medusajs/medusa": patch
---
fix(telemetry): Pointing and resolving packages wrongly

View File

@@ -96,14 +96,9 @@ class Telemeter {
getCliVersion() { getCliVersion() {
try { try {
const jsonfile = join( const jsonfile = join(
require require.resolve(`@medusajs/cli`).split(`${sep}dist`).shift(),
.resolve(`@medusajs/medusa-cli`) // Resolve where current gatsby-cli would be loaded from. "package.json"
.split(sep)
.slice(0, -2) // drop lib/index.js
.join(sep),
`package.json`
) )
const { version } = require(jsonfile) const { version } = require(jsonfile)
return version return version
} catch (e) { } catch (e) {

View File

@@ -4,6 +4,7 @@
"description": "Building blocks for digital commerce", "description": "Building blocks for digital commerce",
"main": "dist/index.js", "main": "dist/index.js",
"exports": { "exports": {
"./package.json": "./package.json",
".": "./dist/index.js", ".": "./dist/index.js",
"./types": "./dist/types/index.js", "./types": "./dist/types/index.js",
"./utils": "./dist/utils/index.js", "./utils": "./dist/utils/index.js",