mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 13:38:33 +03:00
fix(swc-info): Use correct path while getting local package versions (#7872)
This commit is contained in:
parent
606b57c101
commit
67afaf1f2d
@ -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;
|
||||
}
|
||||
|
@ -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": {
|
||||
|
Loading…
Reference in New Issue
Block a user