unfinished docs
This commit is contained in:
parent
9d1ba211bc
commit
ed500c612e
44
.env.dist
Normal file
44
.env.dist
Normal file
@ -0,0 +1,44 @@
|
||||
MSSQL_Skip=0
|
||||
MSSQL_Host=localhost
|
||||
MSSQL_Port=1433
|
||||
MSSQL_Username=sa
|
||||
MSSQL_Password=Admin12345
|
||||
MSSQL_Database=typeorm_mg
|
||||
MSSQL_SSL=0
|
||||
|
||||
POSTGRES_Skip=0
|
||||
POSTGRES_Host=localhost
|
||||
POSTGRES_Port=5432
|
||||
POSTGRES_Username=test
|
||||
POSTGRES_Password=test
|
||||
POSTGRES_Database=test
|
||||
POSTGRES_SSL=0
|
||||
|
||||
MYSQL_Skip=0
|
||||
MYSQL_Host=localhost
|
||||
MYSQL_Port=3306
|
||||
MYSQL_Username=root
|
||||
MYSQL_Password=admin
|
||||
MYSQL_Database=test
|
||||
MYSQL_SSL=0
|
||||
|
||||
MARIADB_Skip=0
|
||||
MARIADB_Host=localhost
|
||||
MARIADB_Port=3307
|
||||
MARIADB_Username=root
|
||||
MARIADB_Password=admin
|
||||
MARIADB_Database=test
|
||||
MARIADB_SSL=0
|
||||
|
||||
ORACLE_Skip=0
|
||||
ORACLE_Host=localhost
|
||||
ORACLE_Port=1521
|
||||
ORACLE_SSL=0
|
||||
ORACLE_UsernameSys=sys
|
||||
ORACLE_PasswordSys=Oradoc_db1
|
||||
ORACLE_Database=orclpdb1.localdomain
|
||||
ORACLE_Username=typeorm_mg
|
||||
ORACLE_Password=Passw0rd
|
||||
|
||||
SQLITE_Skip=0
|
||||
SQLITE_Database=./sqlitedb.db
|
52
CONTRIBUTING.MD
Normal file
52
CONTRIBUTING.MD
Normal file
@ -0,0 +1,52 @@
|
||||
# Contributing to typeorm-model-generator
|
||||
|
||||
|
||||
- [Question or Problem?](#question)
|
||||
- [Submission Guidelines](#submit)
|
||||
- [Commit Message Format](#commit)
|
||||
|
||||
|
||||
|
||||
## <a name="question"></a> Got a Question or Problem?
|
||||
* You can create issue on [github](https://github.com/Kononnable/typeorm-model-generator/issues)
|
||||
* While this tool doesn't have separate separate chat you can use [typeorm slack workspace](https://join.slack.com/t/typeorm/shared_invite/enQtNDQ1MzA3MDA5MTExLTFiNDEyOGUxZGQyYWIwOTA0NDQxODdkOGQ0OTUxNzFjYjUwY2E0ZmFlODc5OTYyYzAzNGM3MGZjYzhjYTBiZTY) since everyone using this tool will also use typeorm.
|
||||
|
||||
|
||||
|
||||
## <a name="submit"></a> Submission Guidelines
|
||||
|
||||
### <a name="submit-issue"></a> Submitting an Issue
|
||||
|
||||
Before you submitting new issue, please check the issue tracker, maybe your problem is already described and the discussion might inform you of available workarounds.
|
||||
|
||||
Before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs, we will ask you to provide a minimal reproduction. Having a minimal reproducible scenario gives us a wealth of important information without going back & forth to you with additional questions. A minimal reproduction allows us to quickly confirm a bug (or point out a coding problem) as well as confirm that we are fixing the right problem.
|
||||
|
||||
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
|
||||
Before you submit your Pull Request (PR) consider the following guidelines:
|
||||
|
||||
1. Search [GitHub](https://github.com/Kononnable/typeorm-model-generator/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate effort.
|
||||
1. Make your changes in a new git branch:
|
||||
|
||||
```shell
|
||||
git checkout -b my-fix-branch master
|
||||
```
|
||||
|
||||
1. Create your patch.
|
||||
1. Run test suite and ensure that all tests pass.
|
||||
1. Commit your changes using a descriptive commit message.
|
||||
|
||||
1. Push your branch to GitHub:
|
||||
|
||||
```shell
|
||||
git push origin my-fix-branch
|
||||
```
|
||||
|
||||
1. In GitHub, send a pull request to `typeorm-model-generator:master`.
|
||||
* If we suggest changes then:
|
||||
* Make the required updates.
|
||||
* Re-run test suites to ensure tests are still passing.
|
||||
* Push to your GitHub repository (this will update your Pull Request)
|
||||
|
||||
Note: if you don't want to run tests on your own for some reason you can rely on tests run on CI.
|
||||
|
||||
That's it! Thank you for your contribution!
|
30
DEVELOPER.MD
Normal file
30
DEVELOPER.MD
Normal file
@ -0,0 +1,30 @@
|
||||
# Setting up environment
|
||||
## Building
|
||||
After cloning the repository you can check your changes made to source code without compiling whole library. Just run `npm start` to run this tool through ts-node. It helps with development speed and avoids problem with setting correct sourcemaps when debugging.
|
||||
|
||||
However if you want to build typeorm-model-generator you can do this by running
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
this might come handy if you want to build full pipeline workflow with typeorm-model-generator and install it through `npm link`.
|
||||
## Running Tests Locally
|
||||
To run tests you need to have docker and docker-compose installed. You may also use non-dockerized database servers but it's not recommended - they might use non-default settings.
|
||||
### Oracle Database
|
||||
If you want to run oracle tests locally you must have *oracle client* configured for your machine and accepted oracle license on *DockerHub*. Because of oracle client limitations i.e. it's not distributed for 32bit environments you have to install oracledb manually
|
||||
```
|
||||
npm install oracledb --no-save
|
||||
```
|
||||
### Configuration
|
||||
Tests use environment values to connect to multiple database engines. For developer convenience there is already prepared env file with default connection settings for connecting to dockerized db engines. This is also the place you can disable testing on specific db engine. You just need to rename the env file
|
||||
```
|
||||
cp .env.dit .env
|
||||
```
|
||||
### Database engines
|
||||
Next you have to start db engines. If you want to test all of the drivers and have configured oracle correctly you can just
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
You can also start just specific database engines e.g.
|
||||
```
|
||||
docker-compose up -d mysql postgres mariadb
|
||||
```
|
53
USECASES.MD
Normal file
53
USECASES.MD
Normal file
@ -0,0 +1,53 @@
|
||||
# Common use cases
|
||||
Typeorm-model-generator can be used in multiple ways. Here are some workflows you can use.
|
||||
## Use directly from npm
|
||||
You can use typeorm-model-generator directly from npm
|
||||
```
|
||||
npx typeorm-model-generator
|
||||
```
|
||||
Please remember using `npx typeorm-model-generator` will download latest available version. To avoid it you can specify version each time `npx typeorm-model-generator@0.3.0` or install a package locally - npx will use locally installed version then.
|
||||
### command line parameters
|
||||
You can customize generated output by specifying multiple parameters. Full list of parameters are available through `npx typeorm-model-generator --help`
|
||||
### config file
|
||||
If you execute `npx typeorm-model-generator` without specifying any parameters you will enter a wizard mode which will guide you through specifying connection settings and allow to customize generated model. At the end of this process you can save your choices, so the process will run automatically next time.
|
||||
## clone repo and make manual changes
|
||||
If you need more power over how models are generated you can fork the repo and make changes to the code specific to your use case there.
|
||||
- fork the repo
|
||||
- clone forked repo locally
|
||||
- create branch for your changes
|
||||
```
|
||||
git checkout -b my-branch master
|
||||
```
|
||||
- add remote repository
|
||||
```
|
||||
git remote add upstream https://github.com/Kononnable/typeorm-model-generator.git
|
||||
```
|
||||
You can run model generation tool by running `npm run start` after installing dependencies.
|
||||
|
||||
When you want to download changes made on main typeorm-model-generator repo just
|
||||
- checkout `master` branch
|
||||
- download changes from main repository
|
||||
```
|
||||
git pull --ff upstream master
|
||||
```
|
||||
- checkout branch with your changes
|
||||
```
|
||||
git checkout my-branch
|
||||
```
|
||||
- merge changes onto your branch
|
||||
```
|
||||
git merge master
|
||||
```
|
||||
|
||||
## git repo with dependency and entire pipeline
|
||||
Similar to last workflow, but this time we don't have to worry about manually merging changes from main repository.
|
||||
- Init new package
|
||||
```
|
||||
npm init -y
|
||||
```
|
||||
- Install typeorm-model-generator as a dependency
|
||||
```
|
||||
npm install typeorm-model-generator
|
||||
```
|
||||
- Write code which loads generated entities files and change its content
|
||||
- Run typeorm-model-generator, then your code which customizes it(you may add this to `package.json` scripts section)
|
@ -5,7 +5,7 @@
|
||||
"bin": "bin/typeorm-model-generator",
|
||||
"scripts": {
|
||||
"start": "ts-node ./src/index.ts",
|
||||
"build": "tsc && ncp src/entity.mst dist/src/entity.mst",
|
||||
"build": "npm run clean && tsc && ncp src/entity.mst dist/src/entity.mst",
|
||||
"prepare": "npm run build",
|
||||
"pretest": "tsc --noEmit",
|
||||
"test": "nyc --reporter=lcov ts-node ./node_modules/mocha/bin/_mocha test/**/*.test.ts -- -R spec --bail",
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
Watc{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
|
Loading…
Reference in New Issue
Block a user