Skip to content

Commit 3981bca

Browse files
Switch from ts-node to tsx (#3188)
* Switch all ts-node usage to tsx and associated fixes * remove `cts` suffix * Fix namespace imports * Update devp2p lrucache to v10 * update some non-tsx files to tsx * Remove console log * log all messages * update cli tests to use tsx * Address feedback * Stick with cts * vm: fix retesteth * update package-lock * update package lock again * Add browser deps install script * fix browser script * Pin browser testing deps * Remove browser deps from package-lock --------- Co-authored-by: Jochem Brouwer <[email protected]>
1 parent 4ec344b commit 3981bca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3745
-4858
lines changed

.github/workflows/browser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
cache: 'npm'
3333

3434
- run: npm ci
35+
- run: npm run install-browser-deps
3536

3637
# Install playwright dependencies
3738
- run: npx playwright install-deps

package-lock.json

Lines changed: 2910 additions & 4699 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"postinstall": "npm run build --workspaces",
1616
"prepare": "git config --local core.hooksPath .githooks",
1717
"prettier": "prettier --write \"./**/*.{js,json,md,ts,yml}\"",
18-
"sort-package-json": "sort-package-json \"package.json\" \"packages/*/package.json\""
18+
"sort-package-json": "sort-package-json \"package.json\" \"packages/*/package.json\"",
19+
"install-browser-deps": "npm install [email protected] [email protected] @vitest/[email protected]"
1920
},
2021
"devDependencies": {
2122
"@types/estree": "^1.0.1",
@@ -42,7 +43,7 @@
4243
"prettier": "2.7.1",
4344
"sort-package-json": "1.57.0",
4445
"tape": "5.6.0",
45-
"ts-node": "10.9.1",
46+
"tsx": "^4.6.2",
4647
"typedoc": "0.23.10",
4748
"typedoc-plugin-markdown": "3.13.4",
4849
"typescript": "4.7.4",
@@ -51,9 +52,9 @@
5152
"vitest": "0.32.2"
5253
},
5354
"peerDependencies": {
54-
"playwright": "^1.35.1",
55-
"webdriverio": "^8.10.7",
56-
"@vitest/browser": "0.32.2"
55+
"@vitest/browser": "^0.32.2",
56+
"playwright": "^1.36.1",
57+
"webdriverio": "^8.13.12"
5758
},
5859
"peerDependenciesMeta": {
5960
"playwright": {

packages/block/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"clean": "../../config/cli/clean-package.sh",
3535
"coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov",
3636
"docs:build": "typedoc --options typedoc.cjs",
37-
"examples": "ts-node ../../scripts/examples-runner.ts -- block",
37+
"examples": "tsx ../../scripts/examples-runner.ts -- block",
3838
"lint": "../../config/cli/lint.sh",
3939
"lint:diff": "../../config/cli/lint-diff.sh",
4040
"lint:fix": "../../config/cli/lint-fix.sh",

packages/blockchain/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ The following is an example for a logger run:
189189
Run with the clique logger:
190190

191191
```shell
192-
DEBUG=ethjs,blockchain:clique ts-node test.ts
192+
DEBUG=ethjs,blockchain:clique tsx test.ts
193193
```
194194

195195
## EthereumJS

packages/blockchain/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"clean": "../../config/cli/clean-package.sh",
3535
"coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov",
3636
"docs:build": "typedoc --options typedoc.cjs",
37-
"examples": "ts-node ../../scripts/examples-runner.ts -- blockchain",
37+
"examples": "tsx ../../scripts/examples-runner.ts -- blockchain",
3838
"lint": "../../config/cli/lint.sh",
3939
"lint:diff": "../../config/cli/lint-diff.sh",
4040
"lint:fix": "../../config/cli/lint-fix.sh",

packages/client/DEVELOPER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ This command runs a specific test, namely `Invalid Missing Ancestor Syncing ReOr
2020

2121
When changing code in the cloned monorepo, it is noted that re-running hive is rather slow. In order to make this faster, see [this PR](https://github.com/jochem-brouwer/hive/pull/1). The state of the PR should be leading, but in order for it to work, ensure that `.dockerignore`, `Dockerfile` and `ethereumjs.sh` are copied into the `clients/ethereumjs` folder of the hive repo.
2222

23-
This runner will use `ts-node` (better debug output!) and is taking advantage of Docker's caching mechanism in order to ensure that any changes of code will get imported on a fresh start of a hive run fast.
23+
This runner will use `tsx` (better debug output!) and is taking advantage of Docker's caching mechanism in order to ensure that any changes of code will get imported on a fresh start of a hive run fast.

packages/client/bin/cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const networks = Object.entries(Common.getInitializedChains().names)
4747

4848
let logger: Logger
4949

50-
const args: ClientOpts = yargs(hideBin(process.argv))
50+
const args: ClientOpts = yargs
51+
.default(hideBin(process.argv))
5152
.parserConfiguration({
5253
'dot-notation': false,
5354
})

packages/client/devnets/4844-interop/INTEROP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ You should see something like below Prysm reaches the 4844 epoch.
9191
[2023-01-11 16:00:57] INFO state: Upgraded to EIP4844 hard fork!
9292
```
9393

94-
1. Run `npx ts-node ./tools/txGenerator.ts 8545 'hello' [path/to/genesis.json] [private key of tx sender as unprefixed hex string]` to submit a blob transaction.
94+
1. Run `npx tsx ./tools/txGenerator.ts 8545 'hello' [path/to/genesis.json] [private key of tx sender as unprefixed hex string]` to submit a blob transaction.
9595
2. Monitor the EthJS logs to see when the transaction is included in a block via an RPC call to `engine_newPayloadV3` and note the block hash.
9696
3. Monitor the Prysm Beacon Node logs and note when the EL block payload is included in a beacon block. You should see logs like below indicating a block with one blob in it. The first few characters of the `blockhash` field in the logs should match the blockhash reported by EthJS
9797

packages/client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
"build:common": "../../config/cli/ts-build.sh",
3737
"bundle": "webpack",
3838
"clean": "../../config/cli/clean-package.sh",
39-
"client:start:ts": "ts-node bin/cli.ts",
39+
"client:start:ts": "tsx bin/cli.ts",
4040
"client:start:js": "npm run build && node dist/bin/cli.js",
4141
"client:start": "npm run client:start:js --",
4242
"client:start:dev1": "npm run client:start -- --discDns=false --discV4=false --bootnodes",
4343
"client:start:dev2": "npm run client:start -- --discDns=false --discV4=false --port=30304 --dataDir=datadir-dev2",
4444
"coverage": "c8 --all --reporter=lcov --reporter=text npm run test:unit",
4545
"docs:build": "typedoc --options typedoc.cjs --tsconfig tsconfig.prod.cjs.json",
46-
"examples": "ts-node ../../scripts/examples-runner.ts -- client",
46+
"examples": "tsx ../../scripts/examples-runner.ts -- client",
4747
"lint": "../../config/cli/lint.sh",
4848
"lint:diff": "../../config/cli/lint-diff.sh",
4949
"lint:fix": "../../config/cli/lint-fix.sh",

0 commit comments

Comments
 (0)