Skip to content

Error while locating templates files in a monorepo structure #1232

Open
@synicko

Description

Describe the bug

Structure of my projet

/monorepo
  node_modules
  packages
    server
      migrations
      node_modules

The server package contains the script to create migrations.
When I run node-pg-migrate create -j ts, the binary tries to load the templates files from the server node_modules folder and throws an error because the monorepo node_modules folder contains the package
I found a workaround by adding the option --templateFileName ../../node_modules/node-pg-migrate/templates/migration-template.ts to the command line but didn't have the problem in previous versions of node-pg-migrate

Steps to reproduce

cd [path_to_monorepo]/packages/server
node-pg-migrate create -j ts [migration_name]

Logs

[Error: ENOENT: no such file or directory, open '[...]/monorepo/packages/server/node_modules/node-pg-migrate/templates/migration-template.ts'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '[...]/monorepo/packages/server/node_modules/node-pg-migrate/templates/migration-template.ts'
}

System Info

MacOS Somona 14.5
Node 20.15.1
node-pg-migrate 7.5.2

Used Module System

esm

Metadata

Assignees

No one assigned

    Labels

    c: bugSomething isn't workinghas workaroundWorkaround provided or linkedhelp wantedExtra attention is neededp: 1-normalNothing urgent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions