-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize Deno implementation and prepare for JSR
Updates everything to be compatible with Deno v2 and prepares for publishing the packages to the [JSR](https://jsr.io) instead of the HTTPS based imports common before the JSR. The JSR doesn't allow for complex inferred types.[^1] Therefore, prior `z.infer<Schema>` types have been replaced with explicit interfaces. Instead of the pattern of having all dependencies defined in a `deps.ts`, it is now common practice (and requirement for the JSR) to have a `deno.json`, which acts in a similar way to the `package.json` in NodeJS. It also serves as an import map for dependencies, pinning their versions. Note that while it's possible to omit the `jsr:@scope/package` and just write `@scope/package` with this, to keep samples copy-pasteable without having to copy the import map, imports in the samples still use the "fully qualified" import, even though the respective versions are then pinned down using the `deno.json` file. In the `Dockerfile`s for the samples as well as the `docker-compose.yml` for development in the root `backend-deno` folder, the Deno base image was upgraded to Deno v2. The new NATS version doesn't use (or provide) the codec functions anymore.[^2] Therefore, the version upgrade also means that we no longer provide these as re-exported functions. Now, any publishing method also allows to pass a `string`, meaning one can just use something like: ```ts nc.publish(JSON.stringify({})); ``` Also, the `Msg` interface (any message received by NATS) now offers convenience methods for retrieving the payload as either `json()` or a `string()`. - JetStream is no longer included and has to be installed as `jsr:@nats-io/jetstream`; - KV (a key-value-storage) is no longer included, but available as `jsr:@nats-io/kv`. See <https://github.com/nats-io/nats.js/blob/e8520523a9b5316f436c44ef05ba2e50c4f6e60a/migration.md> for a full list of changes / migration guide. In `ensureMinimalConfig()` (which gets called by `startService()`), the function now throws an error instead of just printing it to the console and running `Deno.exit(1)`. This fixes various tests that failed with the upgraded Deno version. Note that I was unable to find the change that introduced the inabilities of tests to handle `Deno.exit(1)`. I just know that it worked previously, didn't anymore, and will now, with this change, work once again. [^1]: Cf. <https://jsr.io/docs/about-slow-types> [^2]: Cf. <https://github.com/nats-io/nats.js/blob/e8520523a9b5316f436c44ef05ba2e50c4f6e60a/migration.md#changes-in-nats-base-client>
- Loading branch information
Showing
20 changed files
with
270 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { resolve } from "./deps.ts"; | ||
import { resolve } from "@std/path"; | ||
|
||
/** | ||
* A step definition | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@wuespace/telestion", | ||
"license": "MIT", | ||
"version": "1.0.0-alpha.4", | ||
"exports": "./mod.ts", | ||
"publish": { | ||
"include": [ | ||
"mod.ts", | ||
"README.md", | ||
"LICENSE" | ||
] | ||
}, | ||
"imports": { | ||
"@nats-io/nats-core": "jsr:@nats-io/[email protected]", | ||
"@nats-io/transport-deno": "jsr:@nats-io/[email protected]", | ||
"@std/assert": "jsr:@std/assert@^1.0.8", | ||
"@std/cli": "jsr:@std/cli@^1.0.7", | ||
"@std/jsonc": "jsr:@std/jsonc@^1.0.1", | ||
"@std/path": "jsr:@std/path@^1.0.8", | ||
"jsr:@wuespace/telestion": "./mod.ts", | ||
"zod": "npm:zod@^3.23.8" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.