Skip to content

Commit

Permalink
feat: CI publish + deno serve support
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Sep 18, 2024
1 parent cfae87b commit 8686ac0
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish
on:
workflow_dispatch:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: canary

- name: Publish package
run: deno publish
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ await Deno.serve(
).finished;
```

## Usage with `deno serve`

```ts
import { router } from "jsr:@denosaurs/rutt";

export default {
fetch: router({
"/hello/:name": (_req, _, { name }) =>
new Response(`Hello ${name}`, { status: 200 }),
}),
};
```

## Projects using `rutt`

- [denoland/fresh](https://github.com/denoland/fresh)
Expand Down
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@denosaurs/rutt",
"version": "0.1.0",
"imports": {
"https://deno.land/x/rutt/mod.ts": "./mod.ts"
"https://deno.land/x/rutt/mod.ts": "./mod.ts",
"jsr:@denosaurs/rutt": "./mod.ts"
},
"exports": "./mod.ts"

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { router } from "https://deno.land/x/rutt/mod.ts";
import { router } from "jsr:@denosaurs/rutt";

await Deno.serve(
router({
Expand Down
2 changes: 1 addition & 1 deletion examples/nested_routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { router } from "https://deno.land/x/rutt/mod.ts";
import { router } from "jsr:@denosaurs/rutt";

await Deno.serve(
router({
Expand Down
2 changes: 1 addition & 1 deletion examples/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { router } from "https://deno.land/x/rutt/mod.ts";
import { router } from "jsr:@denosaurs/rutt";

await Deno.serve(
router({
Expand Down
8 changes: 8 additions & 0 deletions examples/serve.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { router } from "jsr:@denosaurs/rutt";

export default {
fetch: router({
"/hello/:name": (_req, _, { name }) =>
new Response(`Hello ${name}`, { status: 200 }),
}),
};
4 changes: 2 additions & 2 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert, assertEquals, assertIsError } from "jsr:@std/[email protected].0";
import { router } from "https://deno.land/x/rutt/mod.ts";
import { assert, assertEquals, assertIsError } from "jsr:@std/[email protected].5";
import { router } from "jsr:@denosaurs/rutt";

/// @ts-ignore - Deno doesn't have this type
const TEST_CONN_INFO: Deno.ServeHandlerInfo = {
Expand Down

0 comments on commit 8686ac0

Please sign in to comment.