Skip to content

Commit

Permalink
try _
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Jun 21, 2024
1 parent f7debb4 commit 00a5859
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/node-pg-migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ process.on('uncaughtException', (err) => {
process.exit(1);
});

const crossRequire = createRequire(resolve(cwd()));
const crossRequire = createRequire(resolve(join(cwd(), '_')));

function tryRequire<TModule = unknown>(moduleName: string): TModule | null {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/runner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRequire } from 'node:module';
import { extname, resolve } from 'node:path';
import { extname, join, resolve } from 'node:path';
import { cwd } from 'node:process';
import type { DBConnection } from './db';
import Db from './db';
Expand Down Expand Up @@ -41,7 +41,7 @@ async function loadMigrations(
const actions: MigrationBuilderActions =
extname(filePath) === '.sql'
? await migrateSqlFile(filePath)
: createRequire(resolve(cwd()))(filePath);
: createRequire(resolve(join(cwd(), '_')))(filePath);
shorthands = { ...shorthands, ...actions.shorthands };

return new Migration(
Expand Down

0 comments on commit 00a5859

Please sign in to comment.