Skip to content

Commit 82101f9

Browse files
authored
chore(dev): Replace ts-node with tsx (#6481)
`tsx` has a couple of advantages over `ts-node`: - Running a script with `tsx` is about 20% faster than with `ts-node`. - `tsx` is also easier to use. I've run into problems in the past where `ts-node` doesn't seem to honor the TypeScript config like `tsc` does, but `tsx` "just works".
1 parent 932bbce commit 82101f9

File tree

5 files changed

+305
-139
lines changed

5 files changed

+305
-139
lines changed

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
"build:types": "tsc --build tsconfig.build.json --verbose",
2121
"changelog:update": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:update",
2222
"changelog:validate": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:validate",
23-
"create-package": "ts-node scripts/create-package",
24-
"generate-method-action-types": "ts-node scripts/generate-method-action-types.ts",
23+
"create-package": "tsx scripts/create-package",
24+
"generate-method-action-types": "tsx scripts/generate-method-action-types.ts",
2525
"lint": "yarn lint:eslint && echo && yarn lint:misc --check && yarn constraints && yarn lint:dependencies && yarn lint:teams && yarn generate-method-action-types --check",
2626
"lint:dependencies": "depcheck && yarn dedupe --check",
2727
"lint:dependencies:fix": "depcheck && yarn dedupe",
28-
"lint:eslint": "yarn build:only-clean && yarn ts-node ./scripts/run-eslint.ts --cache",
28+
"lint:eslint": "yarn build:only-clean && yarn tsx ./scripts/run-eslint.ts --cache",
2929
"lint:fix": "yarn lint:eslint --fix && echo && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix && yarn generate-method-action-types --fix",
3030
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path .gitignore",
31-
"lint:teams": "ts-node scripts/lint-teams-json.ts",
31+
"lint:teams": "tsx scripts/lint-teams-json.ts",
3232
"prepack": "./scripts/prepack.sh",
3333
"prepare-preview-builds": "./scripts/prepare-preview-builds.sh",
3434
"publish-previews": "yarn workspaces foreach --all --no-private --parallel --verbose run publish:preview",
@@ -38,7 +38,7 @@
3838
"test:packages": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter",
3939
"test:scripts": "NODE_OPTIONS=--experimental-vm-modules yarn jest --config ./jest.config.scripts.js --silent",
4040
"test:verbose": "yarn workspaces foreach --all --parallel --verbose run test:verbose",
41-
"update-readme-content": "ts-node scripts/update-readme-content.ts",
41+
"update-readme-content": "tsx scripts/update-readme-content.ts",
4242
"workspaces:list-versions": "./scripts/list-workspace-versions.sh"
4343
},
4444
"simple-git-hooks": {
@@ -99,7 +99,7 @@
9999
"rimraf": "^5.0.5",
100100
"semver": "^7.6.3",
101101
"simple-git-hooks": "^2.8.0",
102-
"ts-node": "^10.9.1",
102+
"tsx": "^4.20.5",
103103
"typescript": "~5.2.2",
104104
"typescript-eslint": "^8.7.0",
105105
"yargs": "^17.7.2"
@@ -113,7 +113,8 @@
113113
"@lavamoat/preinstall-always-fail": false,
114114
"@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true,
115115
"babel-runtime>core-js": false,
116-
"simple-git-hooks": false
116+
"simple-git-hooks": false,
117+
"tsx>esbuild": false
117118
}
118119
}
119120
}

scripts/generate-method-action-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!yarn ts-node
1+
#!yarn tsx
22

33
import { ESLint } from 'eslint';
44
import * as fs from 'fs';

scripts/generate-preview-build-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!yarn ts-node
1+
#!yarn tsx
22

33
import execa from 'execa';
44
import fs from 'fs';

scripts/update-readme-content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!yarn ts-node
1+
#!yarn tsx
22

33
import execa from 'execa';
44
import fs from 'fs';

0 commit comments

Comments
 (0)