Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typeorm CLI variations that include ts-node #8776

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ make sure to use the `outDir` compiler option to prevent
Also, if you want to use the ts-node CLI, you can execute TypeORM the following way:

```
ts-node ./node_modules/.bin/typeorm schema:sync
npx typeorm-ts-node-commonjs schema:sync
```

For ESM projects use this instead:

```
node --loader ts-node/esm ./node_modules/.bin/typeorm schema:sync
npx typeorm-ts-node-esm schema:sync
```

## How to use Webpack for the backend?
Expand Down
10 changes: 2 additions & 8 deletions docs/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,13 @@ typeorm migration:run
Example with `ts-node`:

```
ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run
npx typeorm-ts-node-commonjs migration:run
```

Example with `ts-node` in ESM projects:

```
node --loader ts-node/esm ./node_modules/typeorm/cli.js migration:run
```

Example `ts-node` not using `node_modules` directly:

```
ts-node $(yarn bin typeorm) migration:run
npx typeorm-ts-node-esm migration:run
```

This command will execute all pending migrations and run them in a sequence ordered by their timestamps.
Expand Down
4 changes: 2 additions & 2 deletions docs/using-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Add typeorm command under scripts section in package.json
```
"scripts": {
...
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"
"typeorm": "typeorm-ts-node-commonjs"
}
```

Expand All @@ -51,7 +51,7 @@ For ESM projects add this instead:
```
"scripts": {
...
"typeorm": "node --loader ts-node/esm ./node_modules/typeorm/cli.js"
"typeorm": "typeorm-ts-node-esm"
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ createConnection({
此外,如果要使用 ts-node CLI,可以通过以下方式执行 TypeORM:

```
ts-node ./node_modules/bin/typeorm schema:sync
npx typeorm-ts-node-commonjs schema:sync
```

## 后端如何使用Webpack?
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ typeorm migration:run
`ts-node`的示例:

```
ts-node ./node_modules/typeorm/cli.js migration:run
npx typeorm-ts-node-commonjs migration:run
```

此命令将执行所有挂起的迁移,并按其时间戳排序的顺序运行它们。
Expand Down
4 changes: 2 additions & 2 deletions docs/zh_CN/using-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
你可以在项目中设置 ts-node 以简化操作,如下所示:

```
npm install -g ts-node
npm install ts-node --save-dev
```

在 package.json 中的 scripts 下添加 typeorm 命令

```
"script" {
...
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js"
"typeorm": "typeorm-ts-node-commonjs"
}
```

Expand Down