<commit_before># Using CLI

* [Installing CLI](#installing-cli)
* [Initialize a new TypeORM project](#initialize-a-new-typeorm-project)
* [Create a new entity](#create-a-new-entity)
* [Create a new subscriber](#create-a-new-subscriber)
* [Create a new migration](#create-a-new-migration)
* [Generate a migration from existing table schema](#generate-a-migration-from-exist-table-schema)
* [Run migrations](#run-migrations)
* [Revert migrations](#revert-migrations)
* [Show migrations](#show-migrations)
* [Sync database schema](#sync-database-schema)
* [Log sync database schema queries without actual running them](#log-sync-database-schema-queries-without-actual-running-them)
* [Drop database schema](#drop-database-schema)
* [Run any sql query](#run-any-sql-query)
* [Clear cache](#clear-cache)
* [Check version](#check-version)

## Installing CLI
### If entities files are in javascript
If you have a local typeorm version, make sure it matches the global version we are going to install.

Install typeorm globally with `npm i -g typeorm`.
You can also chose to use `npx typeorm <params>` for each command if you prefer not having to install it.

### If entities files are in typescript
This CLI tool is written in javascript and to be run on node. If your entity files are in typescript, you will need to transpile them to javascript before using CLI. You may skip this section if you only use javascript.

You may setup ts-node in your project to ease the operation as follows:

Install ts-node globally:
```
npm install -g ts-node
```

Add typeorm command under scripts section in package.json
```
"scripts" {
    ...
    "typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js"    
}
```

Then you may run the command like this:
```
npm run typeorm migration:run
```<commit_msg>docs: fix typeorm alias for TS (#6045)<commit_after># Using CLI

* [Installing CLI](#installing-cli)
* [Initialize a new TypeORM project](#initialize-a-new-typeorm-project)
* [Create a new entity](#create-a-new-entity)
* [Create a new subscriber](#create-a-new-subscriber)
* [Create a new migration](#create-a-new-migration)
* [Generate a migration from existing table schema](#generate-a-migration-from-exist-table-schema)
* [Run migrations](#run-migrations)
* [Revert migrations](#revert-migrations)
* [Show migrations](#show-migrations)
* [Sync database schema](#sync-database-schema)
* [Log sync database schema queries without actual running them](#log-sync-database-schema-queries-without-actual-running-them)
* [Drop database schema](#drop-database-schema)
* [Run any sql query](#run-any-sql-query)
* [Clear cache](#clear-cache)
* [Check version](#check-version)

## Installing CLI
### If entities files are in javascript
If you have a local typeorm version, make sure it matches the global version we are going to install.

Install typeorm globally with `npm i -g typeorm`.
You can also chose to use `npx typeorm <params>` for each command if you prefer not having to install it.

### If entities files are in typescript
This CLI tool is written in javascript and to be run on node. If your entity files are in typescript, you will need to transpile them to javascript before using CLI. You may skip this section if you only use javascript.

You may setup ts-node in your project to ease the operation as follows:

Install ts-node globally:
```
npm install -g ts-node
```

Add typeorm command under scripts section in package.json
```
"scripts" {
    ...
    "typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"    
}
```

If you want to load more modules like [module-alias](https://github.com/ilearnio/module-alias) you can add more `--require my-module-supporting-register`

Then you may run the command like this:
```
npm run typeorm migration:run
```
{'fraction_non_alphanumeric': 0.11415765884524123, 'fraction_numerical': 0.0010545742156604272, 'mean_word_length': 4.68815592203898, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2833776', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1080, 'n_words': 433}