diff --git a/packages/connect-examples/node/README.md b/packages/connect-examples/node/README.md index 68c262a3f50..1949ea6a2ff 100644 --- a/packages/connect-examples/node/README.md +++ b/packages/connect-examples/node/README.md @@ -13,4 +13,4 @@ Please note, that this example needs: ## Run -`node index.js` +`yarn start` diff --git a/packages/connect-examples/node/package.json b/packages/connect-examples/node/package.json index b49015b4668..56109a3ba14 100644 --- a/packages/connect-examples/node/package.json +++ b/packages/connect-examples/node/package.json @@ -5,9 +5,10 @@ "author": "Satoshilabs s.r.o ", "license": "MIT", "scripts": { - "start": "node index.js" + "start": "tsx ./src/index.ts" }, "dependencies": { - "@trezor/connect": "workspace:*" + "@trezor/connect": "workspace:*", + "tsx": "^4.19.2" } } diff --git a/packages/connect-examples/node/index.js b/packages/connect-examples/node/src/index.ts similarity index 81% rename from packages/connect-examples/node/index.js rename to packages/connect-examples/node/src/index.ts index 0a6fe797f34..5c46f6c14e7 100644 --- a/packages/connect-examples/node/index.js +++ b/packages/connect-examples/node/src/index.ts @@ -1,5 +1,4 @@ -const TrezorConnect = require('@trezor/connect').default; -const { TRANSPORT_EVENT, DEVICE_EVENT } = require('@trezor/connect'); +import TrezorConnect, { TRANSPORT_EVENT, DEVICE_EVENT } from '@trezor/connect'; /** * Please note, that this example needs: @@ -16,16 +15,19 @@ const runExample = async () => { // this event will be fired when bridge starts or stops or there is no bridge running TrezorConnect.on(TRANSPORT_EVENT, event => { + // eslint-disable-next-line console.log(event); }); // this event will be fired when device connects, disconnects or changes TrezorConnect.on(DEVICE_EVENT, event => { + // eslint-disable-next-line console.log(event); }); const result = await TrezorConnect.getFeatures(); + // eslint-disable-next-line console.log(result); if (!result.success) { diff --git a/packages/connect-examples/node/tsconfig.json b/packages/connect-examples/node/tsconfig.json index 2f2029a0f6d..7f0d26dc2ef 100644 --- a/packages/connect-examples/node/tsconfig.json +++ b/packages/connect-examples/node/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "../../../tsconfig.base.json", - "compilerOptions": { "outDir": "./libDev" }, + "compilerOptions": { "outDir": "libDev" }, "include": ["."], "references": [{ "path": "../../connect" }] } diff --git a/yarn.lock b/yarn.lock index edaca37370a..0e00b8a35a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2684,13 +2684,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/aix-ppc64@npm:0.21.5" - conditions: os=aix & cpu=ppc64 - languageName: node - linkType: hard - "@esbuild/aix-ppc64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/aix-ppc64@npm:0.23.1" @@ -2712,13 +2705,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-arm64@npm:0.21.5" - conditions: os=android & cpu=arm64 - languageName: node - linkType: hard - "@esbuild/android-arm64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/android-arm64@npm:0.23.1" @@ -2740,13 +2726,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-arm@npm:0.21.5" - conditions: os=android & cpu=arm - languageName: node - linkType: hard - "@esbuild/android-arm@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/android-arm@npm:0.23.1" @@ -2768,13 +2747,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-x64@npm:0.21.5" - conditions: os=android & cpu=x64 - languageName: node - linkType: hard - "@esbuild/android-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/android-x64@npm:0.23.1" @@ -2796,13 +2768,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/darwin-arm64@npm:0.21.5" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - "@esbuild/darwin-arm64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/darwin-arm64@npm:0.23.1" @@ -2824,13 +2789,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/darwin-x64@npm:0.21.5" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - "@esbuild/darwin-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/darwin-x64@npm:0.23.1" @@ -2852,13 +2810,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/freebsd-arm64@npm:0.21.5" - conditions: os=freebsd & cpu=arm64 - languageName: node - linkType: hard - "@esbuild/freebsd-arm64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/freebsd-arm64@npm:0.23.1" @@ -2880,13 +2831,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/freebsd-x64@npm:0.21.5" - conditions: os=freebsd & cpu=x64 - languageName: node - linkType: hard - "@esbuild/freebsd-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/freebsd-x64@npm:0.23.1" @@ -2908,13 +2852,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-arm64@npm:0.21.5" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - "@esbuild/linux-arm64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-arm64@npm:0.23.1" @@ -2936,13 +2873,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-arm@npm:0.21.5" - conditions: os=linux & cpu=arm - languageName: node - linkType: hard - "@esbuild/linux-arm@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-arm@npm:0.23.1" @@ -2964,13 +2894,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-ia32@npm:0.21.5" - conditions: os=linux & cpu=ia32 - languageName: node - linkType: hard - "@esbuild/linux-ia32@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-ia32@npm:0.23.1" @@ -2992,13 +2915,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-loong64@npm:0.21.5" - conditions: os=linux & cpu=loong64 - languageName: node - linkType: hard - "@esbuild/linux-loong64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-loong64@npm:0.23.1" @@ -3020,13 +2936,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-mips64el@npm:0.21.5" - conditions: os=linux & cpu=mips64el - languageName: node - linkType: hard - "@esbuild/linux-mips64el@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-mips64el@npm:0.23.1" @@ -3048,13 +2957,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-ppc64@npm:0.21.5" - conditions: os=linux & cpu=ppc64 - languageName: node - linkType: hard - "@esbuild/linux-ppc64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-ppc64@npm:0.23.1" @@ -3076,13 +2978,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-riscv64@npm:0.21.5" - conditions: os=linux & cpu=riscv64 - languageName: node - linkType: hard - "@esbuild/linux-riscv64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-riscv64@npm:0.23.1" @@ -3104,13 +2999,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-s390x@npm:0.21.5" - conditions: os=linux & cpu=s390x - languageName: node - linkType: hard - "@esbuild/linux-s390x@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-s390x@npm:0.23.1" @@ -3132,13 +3020,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-x64@npm:0.21.5" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - "@esbuild/linux-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/linux-x64@npm:0.23.1" @@ -3160,13 +3041,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/netbsd-x64@npm:0.21.5" - conditions: os=netbsd & cpu=x64 - languageName: node - linkType: hard - "@esbuild/netbsd-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/netbsd-x64@npm:0.23.1" @@ -3195,13 +3069,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/openbsd-x64@npm:0.21.5" - conditions: os=openbsd & cpu=x64 - languageName: node - linkType: hard - "@esbuild/openbsd-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/openbsd-x64@npm:0.23.1" @@ -3223,13 +3090,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/sunos-x64@npm:0.21.5" - conditions: os=sunos & cpu=x64 - languageName: node - linkType: hard - "@esbuild/sunos-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/sunos-x64@npm:0.23.1" @@ -3251,13 +3111,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-arm64@npm:0.21.5" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - "@esbuild/win32-arm64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/win32-arm64@npm:0.23.1" @@ -3279,13 +3132,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-ia32@npm:0.21.5" - conditions: os=win32 & cpu=ia32 - languageName: node - linkType: hard - "@esbuild/win32-ia32@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/win32-ia32@npm:0.23.1" @@ -3307,13 +3153,6 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-x64@npm:0.21.5" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - "@esbuild/win32-x64@npm:0.23.1": version: 0.23.1 resolution: "@esbuild/win32-x64@npm:0.23.1" @@ -17963,6 +17802,7 @@ __metadata: resolution: "connect-example-node@workspace:packages/connect-examples/node" dependencies: "@trezor/connect": "workspace:*" + tsx: "npm:^4.19.2" languageName: unknown linkType: soft @@ -21121,7 +20961,7 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.23.1": +"esbuild@npm:^0.23.1, esbuild@npm:~0.23.0": version: 0.23.1 resolution: "esbuild@npm:0.23.1" dependencies: @@ -21204,86 +21044,6 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:~0.21.5": - version: 0.21.5 - resolution: "esbuild@npm:0.21.5" - dependencies: - "@esbuild/aix-ppc64": "npm:0.21.5" - "@esbuild/android-arm": "npm:0.21.5" - "@esbuild/android-arm64": "npm:0.21.5" - "@esbuild/android-x64": "npm:0.21.5" - "@esbuild/darwin-arm64": "npm:0.21.5" - "@esbuild/darwin-x64": "npm:0.21.5" - "@esbuild/freebsd-arm64": "npm:0.21.5" - "@esbuild/freebsd-x64": "npm:0.21.5" - "@esbuild/linux-arm": "npm:0.21.5" - "@esbuild/linux-arm64": "npm:0.21.5" - "@esbuild/linux-ia32": "npm:0.21.5" - "@esbuild/linux-loong64": "npm:0.21.5" - "@esbuild/linux-mips64el": "npm:0.21.5" - "@esbuild/linux-ppc64": "npm:0.21.5" - "@esbuild/linux-riscv64": "npm:0.21.5" - "@esbuild/linux-s390x": "npm:0.21.5" - "@esbuild/linux-x64": "npm:0.21.5" - "@esbuild/netbsd-x64": "npm:0.21.5" - "@esbuild/openbsd-x64": "npm:0.21.5" - "@esbuild/sunos-x64": "npm:0.21.5" - "@esbuild/win32-arm64": "npm:0.21.5" - "@esbuild/win32-ia32": "npm:0.21.5" - "@esbuild/win32-x64": "npm:0.21.5" - dependenciesMeta: - "@esbuild/aix-ppc64": - optional: true - "@esbuild/android-arm": - optional: true - "@esbuild/android-arm64": - optional: true - "@esbuild/android-x64": - optional: true - "@esbuild/darwin-arm64": - optional: true - "@esbuild/darwin-x64": - optional: true - "@esbuild/freebsd-arm64": - optional: true - "@esbuild/freebsd-x64": - optional: true - "@esbuild/linux-arm": - optional: true - "@esbuild/linux-arm64": - optional: true - "@esbuild/linux-ia32": - optional: true - "@esbuild/linux-loong64": - optional: true - "@esbuild/linux-mips64el": - optional: true - "@esbuild/linux-ppc64": - optional: true - "@esbuild/linux-riscv64": - optional: true - "@esbuild/linux-s390x": - optional: true - "@esbuild/linux-x64": - optional: true - "@esbuild/netbsd-x64": - optional: true - "@esbuild/openbsd-x64": - optional: true - "@esbuild/sunos-x64": - optional: true - "@esbuild/win32-arm64": - optional: true - "@esbuild/win32-ia32": - optional: true - "@esbuild/win32-x64": - optional: true - bin: - esbuild: bin/esbuild - checksum: 10/d2ff2ca84d30cce8e871517374d6c2290835380dc7cd413b2d49189ed170d45e407be14de2cb4794cf76f75cf89955c4714726ebd3de7444b3046f5cab23ab6b - languageName: node - linkType: hard - "escalade@npm:^3.1.0, escalade@npm:^3.1.1, escalade@npm:^3.2.0": version: 3.2.0 resolution: "escalade@npm:3.2.0" @@ -40113,11 +39873,11 @@ __metadata: languageName: node linkType: hard -"tsx@npm:^4.16.3": - version: 4.16.3 - resolution: "tsx@npm:4.16.3" +"tsx@npm:^4.16.3, tsx@npm:^4.19.2": + version: 4.19.2 + resolution: "tsx@npm:4.19.2" dependencies: - esbuild: "npm:~0.21.5" + esbuild: "npm:~0.23.0" fsevents: "npm:~2.3.3" get-tsconfig: "npm:^4.7.5" dependenciesMeta: @@ -40125,7 +39885,7 @@ __metadata: optional: true bin: tsx: dist/cli.mjs - checksum: 10/44790934d426579c11f9d38cd98868158821fb79aac8404f85746c623f689965dc1e285dfc2c9cf86980e447e0ff4a58ff35b3d0ef39bca01cbd30c8e3c8570c + checksum: 10/4c5610ed1fb2f80d766681f8ac7827e1e8118dfe354c18f74800691f3ef1e9ed676a29842ab818806bcf8613cdc97c6af84b5645e768ddb7f4b0527b9100deda languageName: node linkType: hard