Skip to content

Commit 15372c0

Browse files
authored
feat: deno 2.4 support (#1)
BREAKING CHANGE: Support for Deno <2.4 is dropped. BREAKING CHANGE: The Sentry module is now published to JSR. The exports now closely mimic the official module. BREAKING CHANGE: While not really a breaking change, but Hado now uses the built-in Deno FsWatcher. It isn't robust like `chokidar` and `@parcel/watcher` and can emit unnecessary or wrong events. So, ignore any extra _Reloading router_ logs.
1 parent a85f04b commit 15372c0

File tree

11 files changed

+305
-365
lines changed

11 files changed

+305
-365
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,26 @@ This will serve the `api` directory as an API on `http://localhost:3000/api`.
3030
To run the server in development mode, you can use the following command:
3131

3232
```sh
33-
DENO_ENV=development deno run --watch --allow-env --allow-ffi --allow-read --allow-net server.ts
33+
DENO_ENV=development deno run --watch --allow-env --allow-ffi --allow-net --allow-read server.ts
3434
```
3535

3636
This will restart the server on file changes and will watch for changes in the `api` directory.
3737

3838
You can also use the `--watch-hmr` flag instead of `--watch` to enable hot module reloading.
3939

40+
If you want to use [`deno serve`](https://docs.deno.com/runtime/reference/cli/serve/), you'll need to update the code to export the handler function directly:
41+
42+
```diff
43+
- Deno.serve({ port: 3000, handler })
44+
+ export default { fetch: handler } satisfies Deno.ServeDefaultExport
45+
```
46+
47+
Then you can run the server with:
48+
49+
```sh
50+
DENO_ENV=development deno serve --watch --port 3000 --allow-env --allow-ffi --allow-net --allow-read server.ts
51+
```
52+
4053
## Routing
4154

4255
Hado has a file-based router, so the directory structure will determine the routes. We follow the same conventions as Next.js:

deno.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.15.3",
44
"exports": {
55
"./router": "./src/router.ts",
6+
"./sentry": "./src/sentry.ts",
67
"./utils": "./src/utils.ts"
78
},
89
"publish": {
@@ -29,22 +30,13 @@
2930
"type": "deno check **/*.ts",
3031
"check": "deno task format:fail && deno task lint:fail && deno task type && deno task test",
3132
"release": "deno run -A ./scripts/release.ts",
32-
"vendor": "deno run -A ./scripts/vendor.ts",
33-
"update": "deno run -A ./scripts/update.ts && deno task vendor && deno task check"
33+
"update": "deno run -A ./scripts/update.ts -x esbuild && deno task check"
3434
},
3535
"fmt": {
3636
"lineWidth": 120,
3737
"proseWrap": "preserve",
3838
"semiColons": false,
39-
"singleQuote": true,
40-
"exclude": [
41-
"vendor"
42-
]
43-
},
44-
"lint": {
45-
"exclude": [
46-
"vendor"
47-
]
39+
"singleQuote": true
4840
},
4941
"imports": {}
5042
}

0 commit comments

Comments
 (0)