Skip to content

Commit c22e30f

Browse files
authored
build: set TS compile target to ES2021 (typeorm#10595)
* build: set TS compile target to ES2021 * docs: update minimum supported node version * build: use @tsconfig/node16
1 parent fa86f6f commit c22e30f

File tree

15 files changed

+138
-112
lines changed

15 files changed

+138
-112
lines changed

README-zh_CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<br>
2121
</div>
2222

23-
TypeORM 是一个 [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) 框架,它可以运行在 NodeJS、Browser、Cordova、PhoneGap、Ionic、React Native、Expo 和 Electron 平台上,可以与 TypeScript 和 JavaScript (ES5,ES6,ES7,ES8)一起使用。 它的目标是始终支持最新的 JavaScript 特性并提供额外的特性以帮助你开发任何使用数据库的(不管是只有几张表的小型应用还是拥有多数据库的大型企业应用)应用程序。
23+
TypeORM 是一个 [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) 框架,它可以运行在 NodeJS、Browser、Cordova、PhoneGap、Ionic、React Native、Expo 和 Electron 平台上,可以与 TypeScript 和 JavaScript (ES2021)一起使用。 它的目标是始终支持最新的 JavaScript 特性并提供额外的特性以帮助你开发任何使用数据库的(不管是只有几张表的小型应用还是拥有多数据库的大型企业应用)应用程序。
2424

2525
不同于现有的所有其他 JavaScript ORM 框架,TypeORM 支持 [Data Mapper](./docs/zh_CN/active-record-data-mapper.md#什么是data-mapper模式)[Active Record](./docs/zh_CN/active-record-data-mapper.md#什么是active-record模式) 模式,这意味着你可以以最高效的方式编写高质量的、松耦合的、可扩展的、可维护的应用程序。
2626

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
TypeORM is an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping)
2424
that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms
25-
and can be used with TypeScript and JavaScript (ES5, ES6, ES7, ES8).
25+
and can be used with TypeScript and JavaScript (ES2021).
2626
Its goal is to always support the latest JavaScript features and provide additional features
2727
that help you to develop any kind of application that uses databases - from
2828
small applications with a few tables to large-scale enterprise applications

README_ko.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center"> <a href="http://typeorm.io/"> <img src="https://github.com/typeorm/typeorm/raw/master/resources/logo_big.png" width="492" height="228"> </a> <br> <br> <a href="https://app.circleci.com/pipelines/github/typeorm/typeorm"> <img src="https://circleci.com/gh/typeorm/typeorm/tree/master.svg?style=shield"> </a> <a href="https://badge.fury.io/js/typeorm"> <img src="https://badge.fury.io/js/typeorm.svg"> </a> <a href="https://codecov.io/gh/typeorm/typeorm"> <img src="https://img.shields.io/codecov/c/github/typeorm/typeorm.svg" alt="Codecov"> </a> <a href="https://join.slack.com/t/typeorm/shared_invite/zt-uu12ljeb-OH_0086I379fUDApYJHNuw"> <img src="https://img.shields.io/badge/chat-on%20slack-blue.svg"> </a> <br> <br>
22
</div>
33

4-
TypeORM은 NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo 및 Electron 플랫폼에서 실행할 수 있는 [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping)이며 TypeScript 및 JavaScript(ES5, ES6, ES7, ES8)와 함께 사용할 수 있다. TypeORM의 목표는 항상 최신 JavaScript 기능을 지원하고 몇 개의 테이블이 있는 작은 응용 프로그램에서 여러 데이터베이스가 있는 대규모 엔터프라이즈 응용 프로그램에 이르기까지 데이터베이스를 사용하는 모든 종류의 응용 프로그램을 개발하는 데 도움이 되는 추가 기능을 제공하는 것이다.
4+
TypeORM은 NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo 및 Electron 플랫폼에서 실행할 수 있는 [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping)이며 TypeScript 및 JavaScript(ES2021)와 함께 사용할 수 있다. TypeORM의 목표는 항상 최신 JavaScript 기능을 지원하고 몇 개의 테이블이 있는 작은 응용 프로그램에서 여러 데이터베이스가 있는 대규모 엔터프라이즈 응용 프로그램에 이르기까지 데이터베이스를 사용하는 모든 종류의 응용 프로그램을 개발하는 데 도움이 되는 추가 기능을 제공하는 것이다.
55

66
TypeORM은 현재 존재하는 다른 모든 JavaScript ORM과 달리 [Active Record](./docs/active-record-data-mapper.md#what-is-the-active-record-pattern)[Data Mapper](./docs/active-record-data-mapper.md#what-is-the-data-mapper-pattern) 패턴을 모두 지원한다. 즉, 고품질의 느슨하게 결합된 확장 가능하고 유지 관리 가능한 애플리케이션을 가장 생산적인 방식으로 작성할 수 있다.
77

gulpfile.ts

+18-30
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
///<reference path="node_modules/@types/node/index.d.ts"/>
2-
///<reference path="node_modules/@types/chai/index.d.ts"/>
3-
///<reference path="node_modules/@types/mocha/index.d.ts"/>
1+
import { Gulpclass, Task, SequenceTask, MergedTask } from "gulpclass";
42

5-
import {Gulpclass, Task, SequenceTask, MergedTask} from "gulpclass";
6-
7-
const fs = require("fs");
8-
const gulp = require("gulp");
9-
const del = require("del");
10-
const shell = require("gulp-shell");
11-
const replace = require("gulp-replace");
12-
const rename = require("gulp-rename");
13-
const sourcemaps = require("gulp-sourcemaps");
14-
const ts = require("gulp-typescript");
3+
import fs from "fs";
4+
import gulp from "gulp";
5+
import del from "del";
6+
import shell from "gulp-shell";
7+
import replace from "gulp-replace";
8+
import rename from "gulp-rename";
9+
import sourcemaps from "gulp-sourcemaps";
10+
import ts from "gulp-typescript";
1511

1612
@Gulpclass()
1713
export class Gulpfile {
@@ -20,20 +16,12 @@ export class Gulpfile {
2016
// General tasks
2117
// -------------------------------------------------------------------------
2218

23-
/**
24-
* Creates a delay and resolves after 15 seconds.
25-
*/
26-
@Task()
27-
wait(cb: Function) {
28-
setTimeout(() => cb(), 15000);
29-
}
30-
3119
/**
3220
* Cleans build folder.
3321
*/
3422
@Task()
35-
clean(cb: Function) {
36-
return del(["./build/**"], cb);
23+
async clean() {
24+
return del(["./build/**"]);
3725
}
3826

3927
/**
@@ -70,15 +58,15 @@ export class Gulpfile {
7058
@Task()
7159
browserCopyTemplates() {
7260
return gulp.src("./src/platform/*.template")
73-
.pipe(rename((p: any) => { p.extname = '.ts'; }))
61+
.pipe(rename((p) => { p.extname = '.ts'; }))
7462
.pipe(gulp.dest("./build/browser/src/platform"));
7563
}
7664

7765
@MergedTask()
7866
browserCompile() {
7967
const tsProject = ts.createProject("tsconfig.json", {
80-
module: "es2015",
81-
"lib": ["es5", "es6", "dom"],
68+
module: "es2020",
69+
lib: ["es2021", "dom"],
8270
typescript: require("typescript")
8371
});
8472
const tsResult = gulp.src([
@@ -97,7 +85,7 @@ export class Gulpfile {
9785
}
9886

9987
@Task()
100-
browserClearPackageDirectory(cb: Function) {
88+
async browserClearPackageDirectory() {
10189
return del([
10290
"./build/browser/**"
10391
]);
@@ -117,7 +105,7 @@ export class Gulpfile {
117105
"cd ./build/package && npm publish"
118106
]));
119107
}
120-
108+
121109
/**
122110
* Packs a .tgz from ./build/package directory.
123111
*/
@@ -204,10 +192,10 @@ export class Gulpfile {
204192
* Moves all compiled files to the final package directory.
205193
*/
206194
@Task()
207-
packageClearPackageDirectory(cb: Function) {
195+
async packageClearPackageDirectory() {
208196
return del([
209197
"build/package/src/**"
210-
], cb);
198+
]);
211199
}
212200

213201
/**

package-lock.json

+46-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"email": "[email protected]"
1111
},
1212
"engines": {
13-
"node": ">= 12.9.0"
13+
"node": ">=16.13.0"
1414
},
1515
"exports": {
1616
".": {
@@ -93,10 +93,13 @@
9393
"cloud-spanner-orm"
9494
],
9595
"devDependencies": {
96+
"@tsconfig/node16": "^16.1.1",
9697
"@types/app-root-path": "^1.2.4",
9798
"@types/chai": "^4.3.4",
9899
"@types/chai-as-promised": "^7.1.5",
99100
"@types/debug": "^4.1.7",
101+
"@types/gulp-rename": "^2.0.6",
102+
"@types/gulp-sourcemaps": "^0.0.38",
100103
"@types/mkdirp": "^1.0.2",
101104
"@types/mocha": "^10.0.1",
102105
"@types/node": "^18.13.0",
@@ -105,7 +108,7 @@
105108
"@types/source-map-support": "^0.5.6",
106109
"@types/uuid": "^9.0.0",
107110
"@types/yargs": "^17.0.22",
108-
"@typescript-eslint/eslint-plugin": "^6.0.0",
111+
"@typescript-eslint/eslint-plugin": "^6.17.0",
109112
"better-sqlite3": "^8.1.0",
110113
"chai": "^4.3.7",
111114
"chai-as-promised": "^7.1.1",
@@ -140,9 +143,9 @@
140143
"source-map-support": "^0.5.21",
141144
"sql.js": "^1.8.0",
142145
"sqlite3": "^5.1.4",
143-
"ts-node": "^10.9.1",
146+
"ts-node": "^10.9.2",
144147
"typeorm-aurora-data-api-driver": "^2.4.4",
145-
"typescript": "^4.9.5"
148+
"typescript": "^5.3.3"
146149
},
147150
"peerDependencies": {
148151
"@google-cloud/spanner": "^5.18.0",
@@ -227,7 +230,7 @@
227230
"dotenv": "^16.0.3",
228231
"glob": "^10.3.10",
229232
"mkdirp": "^2.1.3",
230-
"reflect-metadata": "^0.1.13",
233+
"reflect-metadata": "^0.2.1",
231234
"sha.js": "^2.4.11",
232235
"tslib": "^2.5.0",
233236
"uuid": "^9.0.0",

sample/sample33-custom-repository/repository/PostRepository.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export const PostRepository = Sample33CustomRepositoryConnection.getRepository(
55
Post,
66
).extend({
77
findMyPost() {
8-
return this.findOne()
8+
return this.findOne({})
99
},
1010
})

src/driver/sqlite/SqliteQueryRunner.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export class SqliteQueryRunner extends AbstractSqliteQueryRunner {
8888
}
8989
}
9090

91-
const handler = function (err: any, rows: any) {
91+
const self = this;
92+
const handler = function (this: any, err: any, rows: any) {
9293
if (err && err.toString().indexOf("SQLITE_BUSY:") !== -1) {
9394
if (
9495
typeof options.busyErrorRetry === "number" &&
@@ -110,15 +111,15 @@ export class SqliteQueryRunner extends AbstractSqliteQueryRunner {
110111
queryExecutionTime,
111112
query,
112113
parameters,
113-
this,
114+
self,
114115
)
115116

116117
if (err) {
117118
connection.logger.logQueryError(
118119
err,
119120
query,
120121
parameters,
121-
this,
122+
self,
122123
)
123124
broadcaster.broadcastAfterQueryEvent(
124125
broadcasterResult,

0 commit comments

Comments
 (0)