fix(swc-info): Use correct path while getting local package versions (#7872)

This commit is contained in:
Donny/강동윤 2023-08-26 07:27:09 +09:00 committed by GitHub
parent 606b57c101
commit 67afaf1f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,9 @@
import os from "node:os";
import process from "node:process";
import childProcess from "child_process";
import { createRequire } from "node:module";
const localRequire = createRequire(`${process.cwd()}/[eval]`);
function getUniqueCpuNames(): string {
return os
@ -23,7 +26,7 @@ function getBinaryVersion(binaryName: string): string {
function getPackageVersion(packageName: string) {
try {
return require(`${packageName}/package.json`).version;
return localRequire(`${packageName}/package.json`).version;
} catch {
return null;
}

View File

@ -1,7 +1,7 @@
{
"name": "swc-info",
"packageManager": "yarn@3.2.3",
"version": "0.1.11",
"version": "0.1.15",
"description": "CLI tool to help issue reporting for swc",
"sideEffects": false,
"scripts": {