From 64668d4f1cf950f611eed6435060b12525b55d9e Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Thu, 10 Oct 2024 10:42:06 -0400 Subject: [PATCH] refactor(port-hooks): move to deno 2 and refactor usages --- .github/workflows/port-hooks.yml | 22 ++++++++++++------- packages/port-hooks/README.md | 34 ++++++++++++++++++++++++------ packages/port-hooks/deno.json | 36 ++++++++++++++++++++++++++++++++ packages/port-hooks/deno.jsonc | 16 -------------- packages/port-hooks/deno.lock | 33 +++++++++++++++++++++++------ packages/port-hooks/deps.ts | 1 - packages/port-hooks/dev_deps.ts | 1 - packages/port-hooks/egg.json | 2 +- packages/port-hooks/mod.js | 1 - packages/port-hooks/mod.test.ts | 2 +- packages/port-hooks/port.ts | 4 ++-- 11 files changed, 110 insertions(+), 42 deletions(-) create mode 100644 packages/port-hooks/deno.json delete mode 100644 packages/port-hooks/deno.jsonc delete mode 100644 packages/port-hooks/deps.ts delete mode 100644 packages/port-hooks/dev_deps.ts delete mode 100644 packages/port-hooks/mod.js diff --git a/.github/workflows/port-hooks.yml b/.github/workflows/port-hooks.yml index 481debdc..66f4309e 100644 --- a/.github/workflows/port-hooks.yml +++ b/.github/workflows/port-hooks.yml @@ -19,20 +19,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - deno-version: [1.x] + deno-version: [2.x] steps: - name: ⬇️ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 🦕 Setup Deno - uses: denoland/setup-deno@v1 + uses: denoland/setup-deno@v2 with: deno-version: ${{ matrix.deno-version }} - name: ⚡ Run Tests + working-directory: packages/port-hooks run: | - cd packages/port-hooks deno task test env: CI: true @@ -41,14 +41,22 @@ jobs: if: startsWith(github.ref, 'refs/tags/hyper-port-hooks@') needs: [test] runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - name: ⬇️ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 🦕 Setup Deno - uses: denoland/setup-deno@v1 + uses: denoland/setup-deno@v2 with: - deno-version: v1.x + deno-version: v2.x + + - name: ✨ Publish to JSR + working-directory: packages/port-hooks + run: | + deno publish --allow-slow-types # - name: 🥚 Setup Eggs CLI # run: | diff --git a/packages/port-hooks/README.md b/packages/port-hooks/README.md index 02cd37e6..3ddf306a 100644 --- a/packages/port-hooks/README.md +++ b/packages/port-hooks/README.md @@ -1,11 +1,33 @@ -# hyper63 hooks port +

hyper-port-hooks

+

Port for the Hooks Service in the hyper Service Framework

+

+

+ Nest Badge + + Test +

-A hyper63 port is a schema validator for implementation details. These implementation details exist -in the adapter. Using a port you can make sure that the adapter properly implements the port -correctly. +--- + +hyper63 port is a module that validates the schema of an adapter. In this case the hooks port +validates the schema of a hooks adapter. + + + +- [Usage](#usage) +- [Test](#test) +- [License](#license) + + ## Usage -## Testing +## Test + +```sh +deno task test +``` + +## License -## Documentation +Apache-2.0 diff --git a/packages/port-hooks/deno.json b/packages/port-hooks/deno.json new file mode 100644 index 00000000..11d6b9b5 --- /dev/null +++ b/packages/port-hooks/deno.json @@ -0,0 +1,36 @@ +{ + "name": "@hyper63/port-hooks", + "version": "2.0.0", + "exports": "./mod.ts", + "tasks": { + "test": "deno lint && deno fmt --check && deno test --no-check", + "cache": "deno install --entrypoint mod.ts" + }, + "imports": { + "zod": "npm:zod@3.20.5", + "@std/assert": "jsr:@std/assert@1" + }, + "fmt": { + "include": [ + "./" + ], + "lineWidth": 100, + "singleQuote": true, + "semiColons": false + }, + "lint": { + "rules": { + "exclude": [ + "no-slow-types" + ] + } + }, + "publish": { + "include": [ + "*" + ], + "exclude": [ + "**/*.test.ts" + ] + } +} diff --git a/packages/port-hooks/deno.jsonc b/packages/port-hooks/deno.jsonc deleted file mode 100644 index d98e5be0..00000000 --- a/packages/port-hooks/deno.jsonc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "tasks": { - "test": "deno lint && deno fmt --check && deno test --no-check", - "cache": "deno cache --lock=deno.lock --lock-write mod.test.ts" - }, - "fmt": { - "files": { - "include": ["./"] - }, - "options": { - "lineWidth": 100, - "singleQuote": true, - "semiColons": false - } - } -} diff --git a/packages/port-hooks/deno.lock b/packages/port-hooks/deno.lock index d68bc82f..b4015bf0 100644 --- a/packages/port-hooks/deno.lock +++ b/packages/port-hooks/deno.lock @@ -1,9 +1,30 @@ { - "version": "2", - "remote": { - "https://deno.land/std@0.178.0/fmt/colors.ts": "938c5d44d889fb82eff6c358bea8baa7e85950a16c9f6dae3ec3a7a729164471", - "https://deno.land/std@0.178.0/testing/_diff.ts": "1a3c044aedf77647d6cac86b798c6417603361b66b54c53331b312caeb447aea", - "https://deno.land/std@0.178.0/testing/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", - "https://deno.land/std@0.178.0/testing/asserts.ts": "984ab0bfb3faeed92ffaa3a6b06536c66811185328c5dd146257c702c41b01ab" + "version": "4", + "specifiers": { + "jsr:@std/assert@1": "1.0.6", + "jsr:@std/internal@^1.0.4": "1.0.4", + "npm:zod@3.20.5": "3.20.5" + }, + "jsr": { + "@std/assert@1.0.6": { + "integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207", + "dependencies": [ + "jsr:@std/internal" + ] + }, + "@std/internal@1.0.4": { + "integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422" + } + }, + "npm": { + "zod@3.20.5": { + "integrity": "sha512-BTAAliwfoB9dWf2hC+TXlyWKk/YTqRGZjHQR0WLC2A2pzierWo7KuQ1ebjS4SNaFaxg/lDItzl9/QTgLjcHbgw==" + } + }, + "workspace": { + "dependencies": [ + "jsr:@std/assert@1", + "npm:zod@3.20.5" + ] } } diff --git a/packages/port-hooks/deps.ts b/packages/port-hooks/deps.ts deleted file mode 100644 index 0a1b36d8..00000000 --- a/packages/port-hooks/deps.ts +++ /dev/null @@ -1 +0,0 @@ -export * from 'https://deno.land/x/zod@v3.20.5/mod.ts' diff --git a/packages/port-hooks/dev_deps.ts b/packages/port-hooks/dev_deps.ts deleted file mode 100644 index ac1c4374..00000000 --- a/packages/port-hooks/dev_deps.ts +++ /dev/null @@ -1 +0,0 @@ -export { assert } from 'https://deno.land/std@0.178.0/testing/asserts.ts' diff --git a/packages/port-hooks/egg.json b/packages/port-hooks/egg.json index 131562f7..490d8d77 100644 --- a/packages/port-hooks/egg.json +++ b/packages/port-hooks/egg.json @@ -2,7 +2,7 @@ "$schema": "https://x.nest.land/eggs@0.3.8/src/schema.json", "name": "hyper-port-hooks", "entry": "./mod.ts", - "description": "Hyper service framework port for Hooks adapters", + "description": "Port for the Hooks Service in the hyper Service Framework", "homepage": "https://github.com/hyper63/hyper", "repo": "https://github.com/hyper63/hyper", "version": "2.0.0", diff --git a/packages/port-hooks/mod.js b/packages/port-hooks/mod.js deleted file mode 100644 index 8833f3be..00000000 --- a/packages/port-hooks/mod.js +++ /dev/null @@ -1 +0,0 @@ -export * from './mod.ts' diff --git a/packages/port-hooks/mod.test.ts b/packages/port-hooks/mod.test.ts index 9f7c5345..117628d7 100644 --- a/packages/port-hooks/mod.test.ts +++ b/packages/port-hooks/mod.test.ts @@ -1,4 +1,4 @@ -import { assert } from './dev_deps.ts' +import { assert } from '@std/assert' Deno.test('hooks', async () => { await assert(true) diff --git a/packages/port-hooks/port.ts b/packages/port-hooks/port.ts index f1916ced..785085f2 100644 --- a/packages/port-hooks/port.ts +++ b/packages/port-hooks/port.ts @@ -1,7 +1,7 @@ -import { z } from './deps.ts' +import { z } from 'zod' export const port = z.object({ // TODO: add port methods -}) +}).passthrough() export type HooksPort = z.infer