Skip to content

Commit 30a84e4

Browse files
committed
refactor!: remove default exports
1 parent 7d0a4d9 commit 30a84e4

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed

src/db.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface DBConnection extends DB {
6060

6161
type ConnectionStatus = 'DISCONNECTED' | 'CONNECTED' | 'ERROR' | 'EXTERNAL';
6262

63-
function db(
63+
export function db(
6464
connection: ClientBase | string | ClientConfig,
6565
logger: Logger = console
6666
): DBConnection {
@@ -186,5 +186,3 @@ ${error}
186186
},
187187
};
188188
}
189-
190-
export default db;

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { Migration } from './migration';
2-
export type { default as MigrationBuilder } from './migrationBuilder';
2+
export type { MigrationBuilder } from './migrationBuilder';
33
export type {
44
CreateCast,
55
CreateCastFn,
@@ -263,7 +263,7 @@ export type {
263263
ViewOptions,
264264
} from './operations/views';
265265
export { PgType } from './pgType';
266-
export { runner as default, runner } from './runner';
266+
export { runner } from './runner';
267267
export type { RunnerOption } from './runner';
268268
export { PgLiteral, isPgLiteral } from './utils';
269269
export type { PgLiteralValue } from './utils';

src/migration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { cwd } from 'node:process';
66
import type { QueryResult } from 'pg';
77
import type { DBConnection } from './db';
88
import type { Logger } from './logger';
9-
import MigrationBuilder from './migrationBuilder';
9+
import { MigrationBuilder } from './migrationBuilder';
1010
import type { ColumnDefinitions } from './operations/tables';
1111
import type { MigrationDirection, RunnerOption } from './runner';
1212
import type { MigrationBuilderActions } from './sqlMigration';

src/migrationBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { createSchemalize, PgLiteral } from './utils';
3333
* and it makes inference of down migrations possible.
3434
*/
3535

36-
export default class MigrationBuilder {
36+
export class MigrationBuilder {
3737
/**
3838
* Install an extension.
3939
*

src/runner.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { extname } from 'node:path';
22
import type { ClientBase, ClientConfig } from 'pg';
33
import type { DBConnection } from './db';
4-
import Db from './db';
4+
import { db as Db } from './db';
55
import type { LogFn, Logger } from './logger';
66
import type { RunMigration } from './migration';
77
import { getMigrationFilePaths, Migration } from './migration';
88
import type { ColumnDefinitions } from './operations/tables';
99
import type { MigrationBuilderActions } from './sqlMigration';
10-
import migrateSqlFile from './sqlMigration';
10+
import { sqlMigration as migrateSqlFile } from './sqlMigration';
1111
import { createSchemalize, getMigrationTableSchema, getSchemas } from './utils';
1212

1313
export interface RunnerOptionConfig {
@@ -487,5 +487,3 @@ export async function runner(options: RunnerOption): Promise<RunMigration[]> {
487487
}
488488
}
489489
}
490-
491-
export default runner;

src/sqlMigration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export function getActions(content: string): MigrationBuilderActions {
5151
};
5252
}
5353

54-
async function sqlMigration(sqlPath: string): Promise<MigrationBuilderActions> {
54+
export async function sqlMigration(
55+
sqlPath: string
56+
): Promise<MigrationBuilderActions> {
5557
const content = await readFile(sqlPath, 'utf8');
5658

5759
return getActions(content);
5860
}
59-
60-
export default sqlMigration;

test/db.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Client } from 'pg';
22
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
33
import type { DBConnection } from '../src/db';
4-
import Db from '../src/db';
4+
import { db as Db } from '../src/db';
55
import type { Logger } from '../src/logger';
66

77
const hoisted = vi.hoisted(() => ({

0 commit comments

Comments
 (0)