Skip to content

Commit

Permalink
Fix file path issue (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
konekoya committed Feb 20, 2023
1 parent 3a96229 commit 2e2c1a8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { fileTypeFromBuffer } from 'file-type';
import fs from 'node:fs';
import path from 'node:path';
import path, { dirname } from 'node:path';
import { fileURLToPath } from 'url';
import { PackageMeta } from './types.js';

export function getPackageMeta(): PackageMeta {
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const __dirname = dirname(fileURLToPath(import.meta.url));
const packagePath = path.join(__dirname, '../', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
return {
name: packageJson.name,
version: packageJson.version,
Expand Down

0 comments on commit 2e2c1a8

Please sign in to comment.