Skip to content

Commit

Permalink
fix(config): Update path handling logic to work on Windows (#262)
Browse files Browse the repository at this point in the history
* fix(config): Update path handling logic to work on Windows

* chore(doc): Expand the comment on the new path handling
  • Loading branch information
Pupix authored Jan 16, 2025
1 parent e86d9c4 commit 7e0b9e2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/postgrator-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ function getMigrateToNumber(toArgument) {
}

function getAbsolutePath(fileOrDirectory) {
return (path.isAbsolute(fileOrDirectory))
const absPath = (path.isAbsolute(fileOrDirectory))
? fileOrDirectory
: path.join(process.cwd(), fileOrDirectory);

// Paths must use posix forward slashes to work properly ever since
// postgrator updated to the newer version of glob
//
// https://github.com/rickbergfalk/postgrator/blob/master/CHANGELOG.md#800
// https://github.com/isaacs/node-glob/blob/main/changelog.md#81
return absPath.replaceAll(path.sep, path.posix.sep);
}

const loadYaml = (_, content) => yaml.parse(content);
Expand Down

0 comments on commit 7e0b9e2

Please sign in to comment.