@procoders/generator-model-from-loopback-to-typeorm
v1.0.1
Published
Generates models for TypeORM from LoopBack 3.
Downloads
3
Keywords
Readme
@procoders/generator-model-from-loopback-to-typeorm
Generate models for TypeORM from LoopBack 3 models. Supported db engines:
- PostgreSQL
Installation
Global module
To install module globally simply type npm i -g @procoders/generator-model-from-loopback-to-typeorm
in your console.
Usage
Use npx @procoders/generator-model-from-loopback-to-typeorm --help
to see all available parameters with their descriptions. Some basic parameters below:
Usage: @procoders/generator-model-from-loopback-to-typeorm --bep=<backend-path> --save=<savePath>
Options:
-h, --help Show help
-v, --version Output the current version
--bep, --backend-path Path where the model-config.json file and models is located [required]
--save, --save-path Path where we will save entity
Make sure that the file from which this model will be read looks like this (this is our model-configs file)
{
"upload": {
"dataSource": "db",
"public": false
},
"accessToken": {
"dataSource": "db",
"public": true
},
"attendee": {
"dataSource": "amazonS3",
"public": true
},
"calendar": {
"dataSource": "db",
"public": true
},
...
}
Remember, we will only use models with "dataSource": "db"
Examples
- Creating models from loopback config
- Npx Way
npx @procoders/typeorm-model-generator --bep='../api/server' --save='test-folder'
- Npx Way
Problems you may encounter
When the entity is formed, there may be problems with the links, because they were either specified incorrectly in the loopback models or not at all. You will have to correct them manually