typeorm-extension
typeorm-extension copied to clipboard
Bug: OptionsError: The database options could not be located/loaded.
Versions
- Node: 20
- OS: Ubuntu 20
Reproduction
Can't load data-source when in tsconfig.json there are other options than
"outDir": "dist",
"rootDir": "./src",
or when there are no dist folder in project
I have dive into your source code and noticed that in the path variable here https://github.com/tada5hi/typeorm-extension/blob/048408c7942a90982eef491860fc390500294192/src/data-source/find/module.ts#L88 there are :
[
'/home/timur/dev/project',
'/home/timur/dev/project/dist/database/type-orm'
]
I expect there /home/timur/dev/project/src/database/type-orm or at least /home/timur/dev/project/my-outDir-name/database/type-orm
Steps to reproduce
- Change "outDir" to "bin" / remove current "dist" folder / specify "rootDir" to "."
- tsx --env-file=.env ./node_modules/typeorm-extension/bin/cli.mjs seed:run -d src/database/type-orm/index.ts --preserveFilePaths
- OptionsError: The database options could not be located/loaded.
What is Expected?
What is actually happening?
tsx
is not supported yet.
Please try passing --preserveFilePaths
as additional cli option.
at the moment typeorm-extension
assumes that you execute the cli on build files.
https://github.com/tada5hi/typeorm-extension/blob/02b07c3744182d7327eae9f2e4c3fee9b50c6b3f/src/utils/code-transformation/module.ts#L4
Maybe you can create a pr on how to detect tsx environment :relaxed: :v: