@legalplace/typeorm-entities v1.115.0
Getting Started
The package works on several projects such as BO-form, user space, API and saas-dashboard.
Clone this project.
Then from the project directory, run:
tsc
or yarn build
Release Process
Once your component or feature is tested locally (as explained above), then you are ready to release a new version of the Typeorm-entities package !
After doing git commit
locally,to do this, simply run yarn release
. This will prepare the Typeorm-entities for publication by automatically bumping the package version, bundling the code and create the release tag.
-Please note: To do the merges request, there is only the master branch, there is no staging branch.
Then run git push --follow-tags origin master
or simply git push --follow-tags
.
No need to run yarn/npm publish
as the CI will publish the new version.
Please note, in order to avoid too many version bumps, you should not release a new version for test purposes unless necessary.
Instead, you should test your components locally by following the steps listed in the "Local Testing" section beforehand.
Folder and file structure
Folders
All elements should go in the src
folder and have their own folder containing all of their code.
src
└── MyFirstElement
└── MyNextElement
└── ...
Constants
To add a new status, go to Constants folder, added the const, then add it to the index.ts file.
Decorator
To add a new decorator, go to Decorator folder,create a new interface file for example:
example.decorator.ts,
then add it to the index.ts file.For Example:
export { example } from './example.decorator'
Entities
It contains the entities such as users, orders, modules, etc.
To add a new entity, go to entities folder,create a new entity file for example:
example.ts,
Here is an example of a new entity declaration :
@Entity("example", { schema: "schema DB" }) export default abstract class CommonUuidEntity extends BaseEntity { // Declaring a primary key with uuid @PrimaryGeneratedColumn('uuid') id: string }
For more details with the use of Typeorm entity annotations
After the creation of the entity, it must be added to the index.ts file
For example:
export { default as Example } from "./example"
Interfaces
To add a new interface go to interfaces folder, create a new interface file for example:
example.interface.ts,
then add it to the index.ts file.For example:
export { IExample } from './example.interface'
Views
To add a new view go to views folder, create a new view file.
Here is an example of a new view declaration :
@ViewEntity({ name: "example", schema: "example Schema" })
For more details with the use of Typeorm view annotations
then add it to the index.ts file. For example:
export { default as Example } from './example'
Files
Each item's folder will contain its main file (index.ts) and item-specific files.
src
└── MyFirstElement
└── index.ts
└── Element1.interface.ts
└── Element2.interface.ts
└── Element3.interface.ts
└── MyNextElement
└── index.ts
└── Entity1.ts
└── Entity2.ts
└── Entity3.ts
└── ...
Once your components are ready in the Typeorm-entities, you must check how they behave within the app you intend to use them in and if the data received is correct.
This implies the target app (ex: Bo-form) to be connected to the local version of the Typeorm-entities instead of using the actual package.
As of now, we will be using the yarn link
feature to create a symlink between the Typeorm-entities project and the target app project.
This part is slightly tricky and you should the following steps:
- From the Typeorm-entities run
yarn build
- Then run
yarn link
- From the target app (ex: Bo-form) run
yarn link @legalplace/typeorm-entities
to replace the package with the symlink to the local Typeorm-entities - All set!
- Run
yarn build
in the Typeorm-entities to see any new changes in the target app.
Once you are done testing your local components:
- From the Typeorm-entities, run
yarn unlink
to remove the symlink to the target app's. - From the target app run
yarn unlink @legalplace/typeorm-entities
.
In both cases, you may need to run yarn install --force
to restore all your packages to normal.
If you run into any issues, delete your node_modules
directory, run yarn
to reinstall all packges and repeat the process above.
Solved Problems
When you encounter this kind of problem :
You cannot publish over the previously published versions
If you encounter syntax errors you can use the command:
yarn lint --fix
you should do locally:
npm version <package_version>
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago