Skip to content

Commit c1716f0

Browse files
alexbeviwmadden
authored andcommitted
refactor: extract DRIVER_INFO to shared core module
1 parent 6e84151 commit c1716f0

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { version } from '../../package.json' with { type: 'json' };
2+
3+
export const DRIVER_INFO = { name: 'Prisma', version } as const;

packages/3-mongo-target/3-mongo-driver/src/exports/control.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import type {
55
} from '@prisma-next/framework-components/control';
66
import { redactDatabaseUrl } from '@prisma-next/utils/redact-db-url';
77
import { type Db, MongoClient } from 'mongodb';
8-
import { version } from '../../package.json' with { type: 'json' };
9-
10-
const DRIVER_INFO = { name: 'Prisma', version };
8+
import { DRIVER_INFO } from '../core/driver-info';
119

1210
export class MongoControlDriver implements ControlDriverInstance<'mongo', 'mongo'> {
1311
readonly familyId = 'mongo' as const;
@@ -35,7 +33,7 @@ const mongoControlDriverDescriptor: ControlDriverDescriptor<'mongo', 'mongo', Mo
3533
familyId: 'mongo',
3634
targetId: 'mongo',
3735
id: 'mongo',
38-
version: '0.0.1',
36+
version: DRIVER_INFO.version,
3937
capabilities: {},
4038
async create(url: string): Promise<MongoControlDriver> {
4139
const client = new MongoClient(url, {

packages/3-mongo-target/3-mongo-driver/src/mongo-driver.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import type {
1818
UpdateOneWireCommand,
1919
} from '@prisma-next/mongo-wire';
2020
import { type Db, MongoClient } from 'mongodb';
21-
import { version } from '../package.json' with { type: 'json' };
22-
23-
const DRIVER_INFO = { name: 'Prisma', version };
21+
import { DRIVER_INFO } from './core/driver-info';
2422

2523
class MongoDriverImpl implements MongoDriver {
2624
readonly #db: Db;

0 commit comments

Comments
 (0)