Skip to content

bug: Plugins fail to load in monorepo #826

Open
@EinfachHans

Description

@EinfachHans

I'm submitting a...

  • 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:

var plugin = require(path.join(options.cwd, 'node_modules', plugins[i]));

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions