Skip to content

Commit 64668d4

Browse files
committed
refactor(port-hooks): move to deno 2 and refactor usages
1 parent 85ff0a3 commit 64668d4

File tree

11 files changed

+110
-42
lines changed

11 files changed

+110
-42
lines changed

.github/workflows/port-hooks.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
deno-version: [1.x]
22+
deno-version: [2.x]
2323

2424
steps:
2525
- name: ⬇️ Checkout repo
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727

2828
- name: 🦕 Setup Deno
29-
uses: denoland/setup-deno@v1
29+
uses: denoland/setup-deno@v2
3030
with:
3131
deno-version: ${{ matrix.deno-version }}
3232

3333
- name: ⚡ Run Tests
34+
working-directory: packages/port-hooks
3435
run: |
35-
cd packages/port-hooks
3636
deno task test
3737
env:
3838
CI: true
@@ -41,14 +41,22 @@ jobs:
4141
if: startsWith(github.ref, 'refs/tags/hyper-port-hooks@')
4242
needs: [test]
4343
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
46+
id-token: write
4447
steps:
4548
- name: ⬇️ Checkout repo
46-
uses: actions/checkout@v3
49+
uses: actions/checkout@v4
4750

4851
- name: 🦕 Setup Deno
49-
uses: denoland/setup-deno@v1
52+
uses: denoland/setup-deno@v2
5053
with:
51-
deno-version: v1.x
54+
deno-version: v2.x
55+
56+
- name: ✨ Publish to JSR
57+
working-directory: packages/port-hooks
58+
run: |
59+
deno publish --allow-slow-types
5260
5361
# - name: 🥚 Setup Eggs CLI
5462
# run: |

packages/port-hooks/README.md

+28-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1-
# hyper63 hooks port
1+
<h1 align="center">hyper-port-hooks</h1>
2+
<p align="center">Port for the Hooks Service in the <a href="https://hyper.io/">hyper</a> Service Framework</p>
3+
</p>
4+
<p align="center">
5+
<a href="https://nest.land/package/hyper-port-hooks"><img src="https://nest.land/badge.svg" alt="Nest Badge" /></a>
6+
<a href="https://jsr.io/@hyper63/port-hooks"><img src="https://jsr.io/badges/@hyper63/port-hooks" alt="" /></a>
7+
<a href="https://github.com/hyper63/hyper63/actions/workflows/port-hooks.yml"><img src="https://github.com/hyper63/hyper63/actions/workflows/port-hooks.yml/badge.svg" alt="Test" /></a>
8+
</p>
29

3-
A hyper63 port is a schema validator for implementation details. These implementation details exist
4-
in the adapter. Using a port you can make sure that the adapter properly implements the port
5-
correctly.
10+
---
11+
12+
hyper63 port is a module that validates the schema of an adapter. In this case the hooks port
13+
validates the schema of a hooks adapter.
14+
15+
<!-- toc -->
16+
17+
- [Usage](#usage)
18+
- [Test](#test)
19+
- [License](#license)
20+
21+
<!-- tocstop -->
622

723
## Usage
824

9-
## Testing
25+
## Test
26+
27+
```sh
28+
deno task test
29+
```
30+
31+
## License
1032

11-
## Documentation
33+
Apache-2.0

packages/port-hooks/deno.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "@hyper63/port-hooks",
3+
"version": "2.0.0",
4+
"exports": "./mod.ts",
5+
"tasks": {
6+
"test": "deno lint && deno fmt --check && deno test --no-check",
7+
"cache": "deno install --entrypoint mod.ts"
8+
},
9+
"imports": {
10+
"zod": "npm:[email protected]",
11+
"@std/assert": "jsr:@std/assert@1"
12+
},
13+
"fmt": {
14+
"include": [
15+
"./"
16+
],
17+
"lineWidth": 100,
18+
"singleQuote": true,
19+
"semiColons": false
20+
},
21+
"lint": {
22+
"rules": {
23+
"exclude": [
24+
"no-slow-types"
25+
]
26+
}
27+
},
28+
"publish": {
29+
"include": [
30+
"*"
31+
],
32+
"exclude": [
33+
"**/*.test.ts"
34+
]
35+
}
36+
}

packages/port-hooks/deno.jsonc

-16
This file was deleted.

packages/port-hooks/deno.lock

+27-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/port-hooks/deps.ts

-1
This file was deleted.

packages/port-hooks/dev_deps.ts

-1
This file was deleted.

packages/port-hooks/egg.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://x.nest.land/[email protected]/src/schema.json",
33
"name": "hyper-port-hooks",
44
"entry": "./mod.ts",
5-
"description": "Hyper service framework port for Hooks adapters",
5+
"description": "Port for the Hooks Service in the hyper Service Framework",
66
"homepage": "https://github.com/hyper63/hyper",
77
"repo": "https://github.com/hyper63/hyper",
88
"version": "2.0.0",

packages/port-hooks/mod.js

-1
This file was deleted.

packages/port-hooks/mod.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assert } from './dev_deps.ts'
1+
import { assert } from '@std/assert'
22

33
Deno.test('hooks', async () => {
44
await assert(true)

packages/port-hooks/port.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { z } from './deps.ts'
1+
import { z } from 'zod'
22

33
export const port = z.object({
44
// TODO: add port methods
5-
})
5+
}).passthrough()
66

77
export type HooksPort = z.infer<typeof port>

0 commit comments

Comments
 (0)