refactor: replace ts-node with esbuild-register

This commit is contained in:
impart我的impart 2024-03-08 23:45:57 +08:00
parent 1cae1a0720
commit 15cddefa00
No known key found for this signature in database
GPG Key ID: 68ED75B1D060D166
9 changed files with 23 additions and 15 deletions

View File

@ -13,12 +13,9 @@
"packages/*"
],
"scripts": {
"clean": "ts-node -T scripts/clean.cts",
"clean": "node -r esbuild-register scripts/clean.cts",
"build": "concurrently -n red \"yarn workspace @chronocat/red build\" && concurrently -n shell \"yarn workspace @chronocat/shell build\" && concurrently -n shell \"yarn workspace @chronocat/plugin-iife build\" && concurrently -n llqqnt,iife,api,event \"yarn workspace @chronocat/plugin-llqqnt build\" \"yarn workspace @chronocat/engine-chronocat-api build\" \"yarn workspace @chronocat/engine-chronocat-event build\" && concurrently -n packengine yarn:packengine",
"packengine": "ts-node -T scripts/packengine.cts"
},
"resolutions": {
"ts-node": "11.0.0-beta.1"
"packengine": "node -r esbuild-register scripts/packengine.cts"
},
"devDependencies": {
"@tsconfig/strictest": "^2.0.1",
@ -28,6 +25,7 @@
"@typescript-eslint/parser": "^6.4.1",
"concurrently": "^8.2.1",
"esbuild": "^0.19.2",
"esbuild-register": "^3.5.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.0",
@ -36,7 +34,6 @@
"jest": "^29.6.3",
"prettier": "^3.0.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "~5.1.0"
}
}

View File

@ -27,7 +27,7 @@ Chronocat 可信安装的公钥可以从这里获取:
scripts 文件夹内,因此你可以直接使用下面的命令进行验证:
```sh
yarn ts-node -T scripts/dti.cts <chronocat.js.ti.bin 的位置>
yarn node -r esbuild-register scripts/dti.cts <chronocat.js.ti.bin 的位置>
```
如果程序没有任何输出,那么验证成功。如果程序抛出异常,那么验证失败。

View File

@ -9,7 +9,7 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"genclg": "ts-node -T scripts/genclg.cts",
"genclg": "node -r esbuild-register scripts/genclg.cts",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},

View File

@ -15,7 +15,7 @@
],
"scripts": {
"build": "concurrently -n cjs,dts yarn:build:cjs yarn:build:dts",
"build:cjs": "ts-node -T ../../scripts/build.cts",
"build:cjs": "node -r esbuild-register ../../scripts/build.cts",
"build:dts": "tsc -p tsconfig.json"
},
"devDependencies": {

View File

@ -15,7 +15,7 @@
],
"scripts": {
"build": "concurrently -n cjs,dts yarn:build:cjs yarn:build:dts",
"build:cjs": "ts-node -T ../../scripts/build.cts",
"build:cjs": "node -r esbuild-register ../../scripts/build.cts",
"build:dts": "tsc -p tsconfig.json"
},
"devDependencies": {

View File

@ -14,7 +14,7 @@
"lib"
],
"scripts": {
"build": "ts-node -T ../../scripts/build.cts build && ts-node -T pack.cts"
"build": "node -r esbuild-register ../../scripts/build.cts build && node -r esbuild-register pack.cts"
},
"devDependencies": {
"@chronocat/shell": "workspace:packages/shell",

View File

@ -14,7 +14,7 @@
"lib"
],
"scripts": {
"build": "ts-node -T ../../scripts/build.cts build && ts-node -T pack.cts"
"build": "node -r esbuild-register ../../scripts/build.cts build && node -r esbuild-register pack.cts"
},
"devDependencies": {
"@chronocat/shell": "workspace:packages/shell",

View File

@ -14,9 +14,9 @@
"lib"
],
"scripts": {
"codegen": "ts-node -T scripts/codegen.cts",
"codegen": "node -r esbuild-register scripts/codegen.cts",
"build": "concurrently -n codegen yarn:codegen && concurrently -n cjs,dts yarn:build:cjs yarn:build:dts",
"build:cjs": "ts-node -T ../../scripts/build.cts",
"build:cjs": "node -r esbuild-register ../../scripts/build.cts",
"build:dts": "tsc -p tsconfig.json"
},
"devDependencies": {

View File

@ -6395,6 +6395,7 @@ __metadata:
"@typescript-eslint/parser": "npm:^6.4.1"
concurrently: "npm:^8.2.1"
esbuild: "npm:^0.19.2"
esbuild-register: "npm:^3.5.0"
eslint: "npm:^8.47.0"
eslint-config-prettier: "npm:^9.0.0"
eslint-import-resolver-typescript: "npm:^3.6.0"
@ -6403,7 +6404,6 @@ __metadata:
jest: "npm:^29.6.3"
prettier: "npm:^3.0.2"
ts-jest: "npm:^29.1.1"
ts-node: "npm:^10.9.1"
typescript: "npm:~5.1.0"
languageName: unknown
linkType: soft
@ -8017,6 +8017,17 @@ __metadata:
languageName: node
linkType: hard
"esbuild-register@npm:^3.5.0":
version: 3.5.0
resolution: "esbuild-register@npm:3.5.0"
dependencies:
debug: "npm:^4.3.4"
peerDependencies:
esbuild: ">=0.12 <1"
checksum: 10c0/9ccd0573cb66018e4cce3c1416eed0f5f3794c7026ce469a94e2f8761335abed8e363fc8e8bb036ab9ad7e579bb4296b8568a04ae5626596c123576b0d9c9bde
languageName: node
linkType: hard
"esbuild@npm:^0.19.2":
version: 0.19.12
resolution: "esbuild@npm:0.19.12"