chore(mqttverifier): typescript support#677
chore(mqttverifier): typescript support#677carlocorradini wants to merge 1 commit intobytebeamio:mainfrom
Conversation
h3nill
left a comment
There was a problem hiding this comment.
i would prefer to keep these scripts in javascript because they are very occasionally used and having them to be typescript adds dependency on npx to run it while not providing much value to us.
also i have had very bad experience with trying to run typescript without build step (i.e. using ts-node)
currently as well running trying to run this fails:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/henil/Workspace/bytebeam/rumqtt/utils/mqttverifier/printer.ts
at new NodeError (node:internal/errors:405:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
at defaultLoad (node:internal/modules/esm/load:91:20)
at nextLoad (node:internal/modules/esm/hooks:733:28)
at load (/home/henil/.npm/_npx/1bf7c3c15bf47d04/node_modules/ts-node/dist/child/child-loader.js:19:122)
at nextLoad (node:internal/modules/esm/hooks:733:28)
at Hooks.load (node:internal/modules/esm/hooks:377:26)
at MessagePort.handleMessage (node:internal/modules/esm/worker:168:24)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:778:20) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
|
@henil I disagree. Are you using Node.js 20x? Note that it's not an LTS and currently it has some problems with Typescript. I've added in package.json the engines parameter to check this type of issues. Note that the CI is using 18.x |
this are the versions i am using. Also i don't want to populate root of the project with npm related files. |
|
You are using node 20.x which is not LTS (it will be in ~October) |
|
Try on node 18.x (latest LTS) and It works flawlessly |
|
its weird that it works on older versions but not the lastest... |
|
They will fix it. Note also that until Node 20x is not LTS, it can be considered as an Alpa/Beta/Unstable release. |
|
Understood and I agree that TS is great, but this util scripts are only used to verify that bytes sequence for a particular packet generated by our protocol implementation matches with some other implementation (we were even considering to remove them because we think our implementation mature now). I don't really want to think about TS related things while doing it.
thats a bug that should be fixed but not something that is enough to make to switch to ts, want to make a PR for this? Thanks for taking your time the PR but typescript here is not really needed so closing this. Hope you understand. |
|
@henil Remove utils completely? |
|
yeah we where just thinking, but we let it be incase its needed to quickly debug protocol level things. |
|
@henil Since we will add some configuration files for |
Related to PR #671
What has been changed:
rumqttverifiersources are now based on Typescript for better maintainability and more.Simply run
npx ts-node path/to/script.tsinstead of oldnode path/to/script.js