Skip to content

Commit

Permalink
fix: Fix dirname resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed Jul 15, 2024
1 parent 84f5804 commit 3df0e2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/packageJsonUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path';
import * as fs from 'fs/promises';
import * as url from 'url';

export async function getVersion(): Promise<string> {
try {
Expand All @@ -15,7 +16,7 @@ async function getPackageJson(): Promise<{
name: string;
version: string;
}> {
const dirName = import.meta.dirname ?? __dirname;
const dirName = url.fileURLToPath(new URL('.', import.meta.url));
const packageJsonPath = path.join(dirName, '..', '..', 'package.json');
const packageJsonFile = await fs.readFile(packageJsonPath, 'utf-8');
const packageJson = JSON.parse(packageJsonFile);
Expand Down

0 comments on commit 3df0e2c

Please sign in to comment.