db-migrate / db-migrate/node-db-migrate

bug: Plugins fail to load in monorepo

Open
#826 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
361
PR merge metrics
No merged PRs in 30d

Description

## I'm submitting a...

- [X] Bug report
- [ ] Feature request
- [ ] Question

## Current behavior

I have a npm monorepo like:

```
- packages/
- backend/
- package.json
- package.json
```

The `backend` project contains all the **pg-migrate** stuff.
Npm defaultly installs all node_modules into the root project and only duplicates into the single project folders.

This makes the load of plugin fail if pg-migrate is started from within the `backend` project, because of this line:

https://github.com/db-migrate/node-db-migrate/blob/6acaf40e116463275f77419e69f2dbcdc80a3c61/index.js#L48

## Expected behavior

It should work in a monorepo context as well. Maybe by recursively looking into the `node_modules` folder until reached the root of the project.

## Environment



db-migrate version: 0.11.14
plugins with versions: db-migrate-plugin-typescript (2.0.0)
db-migrate driver with versions: pg (1.5.2)

Additional information:
- Node version: 20.9.0
- Platform: Mac

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.