Skip to content

Commit

Permalink
fix(getJsdocProcessorPlugin): ensure package.json file is consisten…
Browse files Browse the repository at this point in the history
…tly located
  • Loading branch information
brettz9 committed Jul 30, 2024
1 parent 2fbd47c commit 87a1270
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/getJsdocProcessorPlugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Todo: Support TS by fenced block type

import {readFileSync} from 'fs';
import {readFileSync} from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as espree from 'espree';
import {
getRegexFromString,
Expand All @@ -13,9 +15,11 @@ import {
parseComment,
} from '@es-joy/jsdoccomment';

const __dirname = dirname(fileURLToPath(import.meta.url));

const {version} = JSON.parse(
// @ts-expect-error `Buffer` is ok for `JSON.parse`
readFileSync('./package.json')
readFileSync(join(__dirname, '../package.json'))
);

// const zeroBasedLineIndexAdjust = -1;
Expand Down

0 comments on commit 87a1270

Please sign in to comment.