UNPKG

@decaf-ts/db-decorators

Version:

Agnostic database decorators and repository

161 lines (129 loc) 8.72 kB
![Banner](./workdocs/assets/Banner.png) ## DB Decorators Extension to Decorator Validation with common db functionalities ![Licence](https://img.shields.io/github/license/decaf-ts/db-decorators.svg?style=plastic) ![GitHub language count](https://img.shields.io/github/languages/count/decaf-ts/db-decorators?style=plastic) ![GitHub top language](https://img.shields.io/github/languages/top/decaf-ts/db-decorators?style=plastic) [![Tests](https://github.com/decaf-ts/db-decorators/actions/workflows/jest-test.yaml/badge.svg)](http://www.pdmfc.com) [![CodeQL](https://github.com/starnowski/posmulten/workflows/CodeQL/badge.svg)](https://github.com/decaf-ts/db-decorators/actions?query=workflow%3ACodeQL) ![Open Issues](https://img.shields.io/github/issues/decaf-ts/db-decorators.svg) ![Closed Issues](https://img.shields.io/github/issues-closed/decaf-ts/db-decorators.svg) ![Pull Requests](https://img.shields.io/github/issues-pr-closed/decaf-ts/db-decorators.svg) ![Maintained](https://img.shields.io/badge/Maintained%3F-yes-green.svg) ![Line Coverage](workdocs/coverage/badge-lines.svg) ![Function Coverage](workdocs/coverage/badge-functions.svg) ![Statement Coverage](workdocs/coverage/badge-statements.svg) ![Branch Coverage](workdocs/coverage/badge-branches.svg) ![Forks](https://img.shields.io/github/forks/decaf-ts/db-decorators.svg) ![Stars](https://img.shields.io/github/stars/decaf-ts/db-decorators.svg) ![Watchers](https://img.shields.io/github/watchers/decaf-ts/db-decorators.svg) ![Node Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=Node&query=$.engines.node&colorB=blue) ![NPM Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=NPM&query=$.engines.npm&colorB=purple) ### Decorator based ## Considerations #### Typescript Compilation options Even though all code is exported in both CommonJS and ESM format, and the default is ES2022 in order to take advantage to all the latest Typescript and JS features, when importing these libraries the following flag in `tsconfig.compilerOptions` is mandatory: ```json { "experimentalDecorators": true, "emitDecoratorMetadata": true, "useDefineForClassFields": false } ``` ### Related [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=decorator-validation)](https://github.com/decaf-ts/decorator-validation) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=injectable-decorators)](https://github.com/decaf-ts/injectable-decorators) ### Social [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/decaf-ts/) ### Scripts The following npm scripts are available for development: - `preinstall` - will run only on the first install to trigger the dep update. will self delete; - `do-install` - sets a `TOKEN` environment variable to the contents of `.token` and runs npm install (useful when you have private dependencies); - `flash-forward` - updates all dependencies. Take care, This may not be desirable is some cases; - `reset` - updates all dependencies. Take care, This may not be desirable is some cases; - `build` - builds the code (via gulp `gulpfile.js`) in development mode (generates `lib` and `dist` folder); - `build:prod` - builds the code (via gulp `gulpfile.js`) in production mode (generates `lib` and `dist` folder); - `test` - runs unit tests; - `test:integration` - runs it tests; - `test:all` - runs all tests; - `lint` - runs es lint on the code folder; - `lint-fix` - tries to auto-fix the code folder; - `prepare-release` - defines the commands to run prior to a new tag (defaults to linting, building production code, running tests and documentation generation); - `release` - triggers a new tag being pushed to master (via `./bin/tag_release.sh`); - `clean-publish` - cleans the package.json for publishing; - `coverage` - runs all test, calculates coverage and generates badges for readme; - `drawings` - compiles all DrawIO `*.drawio` files in the `workdocs/drawings` folder to png and moves them to the `workdocs/resources` folder; - `uml` - compiles all PlantUML `*.puml` files in the `workdocs/uml` folder to png and moves them to the `workdocs/resources` folder; - `docs` - compiles all the coverage, drawings, uml, jsdocs and md docs into a readable web page under `./docs`; ### Repository Structure ``` db-decorators │ │ .gitignore <-- Defines files ignored to git │ .npmignore <-- Defines files ignored by npm │ .nmprc <-- Defines the Npm registry for this package │ .eslintrc.cjs <-- linting for the project │ .prettier.config.cjs <-- Code style for the project │ .gitlab-ci.yml <-- Gillab CI/CD file │ gulpfile.js <-- Gulp build scripts. used for building na other features (eg docs) │ jest.config.ts <-- Tests Configuration file │ mdCompile.json <-- md Documentation generation configuration file │ jsdocs.json <-- jsdoc Documentation generation configuration file │ Dockerfile <-- minimal example of a node service Dockerfile │ LICENCE.md <-- Licence disclamer │ package.json │ package-lock.json │ README.md <-- Readme File dynamically compiled from 'workdocs' via the 'docs' npm script │ tsconfig.json <-- Typescript config file. Is overriden in 'gulpfile.js' │ └───bin │ │ tag_release.sh <-- Script to help with releases │ └───docs │ │ ... <-- Dinamically generated folder, containing the compiled documentation for this repository. generated via the 'docs' npm script │ └───src │ │ ... <-- Source code for this repository │ └───tests │ │───unit <-- Unit tests │ └───integration <-- Integration tests │ └───workdocs <-- Folder with all pre-compiled documentation │ │───assets <-- Documentation asset folder │ │───badges <-- Auto generated coverage badges folder │ │───coverage <-- Auto generated coverage results │ │───drawings <-- DrawIO folder. Drawings (*.drawio) here will be processed to generate documentation (requires docker) │ │───uml <-- PlantUML folder. Diagrams (*.puml) here will be processed to generate documentation (requires docker) │ │───tutorials <-- Tutorial folder │ │ ... <-- Categorized *.md files that are merged to generate the final readme (via md compile) │ │ Readme.md <-- Entry point to the README.md │ └───dist │ │ ... <-- Dinamically generated folder containing the bundles for distribution │ └───lib | ... <-- Dinamically generated folder containing the compiled code ``` ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white) ![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black) ![NodeJS](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white) ![ShellScript](https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge&logo=gnu-bash&logoColor=white) ## Getting help If you have bug reports, questions or suggestions please [create a new issue](https://github.com/decaf-ts/db-decorators/issues/new/choose). ## Contributing I am grateful for any contributions made to this project. Please read [this](./workdocs/tutorials/Contributing.md) to get started. ## Supporting The first and easiest way you can support it is by [Contributing](./workdocs/98-Contributing.md). Even just finding a typo in the documentation is important. Financial support is always welcome and helps keep the both me and the project alive and healthy. So if you can, if this project in any way. either by learning something or simply by helping you save precious time, please consider donating. ## License This project is released under the [MIT License](LICENSE.md). #### Disclaimer: badges found [here](https://dev.to/envoy_/150-badges-for-github-pnk), [here](https://github.com/alexandresanlim/Badges4-README.md-Profile#-social-) and [here](https://github.com/Ileriayo/markdown-badges)