Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File loader always uses process.cwd(), fails to find seeds and factories in monorepos with globs #123

Open
coaxial opened this issue Mar 21, 2021 · 0 comments

Comments

@coaxial
Copy link

coaxial commented Mar 21, 2021

Given an ormconfig.js file with:

module.exports = {
  // ...
  seeds: ['src/**/*.seed.ts'],
  factories: ['src/**/*.factory.ts],
}

The ormconfig file is located at apps/api/src/config/ormconfig.js within a monorepo, and package.json is located at ./process.cwd().

Then the file loader fails to find the factory or seed files.

However, if I change this line:

.map((pattern) => glob.sync(path.resolve(process.cwd(), pattern)))
to .map((pattern) => glob.sync(path.resolve(process.cwd(), 'apps/api', pattern))), then it finds the seed and factory files.

Specifying a root with the -r argument at the CLI should, in my opinion, alter the way that fonction resolves paths to find the globs from the ormconfig.

@coaxial coaxial changed the title File loader always uses process.cwd(), fails to find files with monorepos File loader always uses process.cwd(), fails to find seeds and factories in monorepos with globs Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant