mirror of
https://github.com/hanzomsg/nats.js.git
synced 2026-10-30 20:31:36 +00:00
* refactor: replace `parse` with `parseArgs` and update dependencies in examples and configurations - Migrated from `@std/flags` to `@std/cli` across various scripts. - Updated related imports, arguments parsing logic, and versioned dependencies. Signed-off-by: Alberto Ricart <[email protected]> * chore(deps): bump `@types/node` to ^25.0.0 across all packages Signed-off-by: Alberto Ricart <[email protected]> * chore(release): bump all packages to version 3.3.0 Signed-off-by: Alberto Ricart <[email protected]> * chore(workflows): update Deno to 2.6.x, Node to 25.x in CI configurations Signed-off-by: Alberto Ricart <[email protected]> * fix(node_transport): specify `Uint8Array` type for `frame` argument in `socket.on("data")` listener v25, the inferred type changed to string | NonSharedBuffer Signed-off-by: Alberto Ricart <[email protected]> * chore(workflows): update GitHub Actions to use latest versions of `checkout`, `setup-node`, and `setup-deno` Signed-off-by: Alberto Ricart <[email protected]> --------- Signed-off-by: Alberto Ricart <[email protected]>
34 lines
668 B
TypeScript
Executable File
34 lines
668 B
TypeScript
Executable File
#!/usr/bin/env deno run --allow-all --unstable
|
|
|
|
import { parseArgs } from "@std/cli";
|
|
import { connect, type ConnectionOptions } from "@nats-io/transport-deno";
|
|
|
|
const argv = parseArgs(
|
|
Deno.args,
|
|
{
|
|
alias: {
|
|
"s": ["server"],
|
|
},
|
|
default: {
|
|
s: "127.0.0.1:4222",
|
|
},
|
|
},
|
|
);
|
|
|
|
const opts = { servers: argv.s } as ConnectionOptions;
|
|
|
|
const nc = await connect(opts);
|
|
(async () => {
|
|
console.info(`connected ${nc.getServer()}`);
|
|
for await (const s of nc.status()) {
|
|
console.info(s);
|
|
}
|
|
})().then();
|
|
|
|
await nc.closed()
|
|
.then((err) => {
|
|
if (err) {
|
|
console.error(`closed with an error: ${(err as Error).message}`);
|
|
}
|
|
});
|