Skip to content

Commit

Permalink
fix: use require instead of readFileSync for driver.version (#2652)
Browse files Browse the repository at this point in the history
  • Loading branch information
aherlihy authored Dec 4, 2020
1 parent 55534c9 commit e7a42bb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import type { OperationOptions, OperationBase, Hint } from './operations/operati
import type { ClientSession } from './sessions';
import { ReadConcern } from './read_concern';
import type { Connection } from './cmap/connection';
import { readFileSync } from 'fs';
import { resolve } from 'path';
import { Document, resolveBSONOptions } from './bson';
import type { IndexSpecification, IndexDirection } from './operations/indexes';
import type { Explain } from './explain';
Expand Down Expand Up @@ -885,9 +883,8 @@ export interface ClientMetadataOptions {
appname?: string;
}

const NODE_DRIVER_VERSION = JSON.parse(
readFileSync(resolve(__dirname, '..', 'package.json'), { encoding: 'utf-8' })
).version;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const NODE_DRIVER_VERSION = require('../package.json').version;

export function makeClientMetadata(options: ClientMetadataOptions): ClientMetadata {
options = options || {};
Expand Down

0 comments on commit e7a42bb

Please sign in to comment.