From 2aca277e6314d1c002e3a521aee93d17feb36308 Mon Sep 17 00:00:00 2001
From: Tyler Hall
Date: Thu, 10 Oct 2024 10:20:08 -0400
Subject: [PATCH] refactor(port-queue): move to deno 2 and refactor usages
---
.github/workflows/port-queue.yml | 19 ++++++++-----
packages/port-queue/README.md | 29 ++++++++++----------
packages/port-queue/deno.json | 34 +++++++++++++++++++++++
packages/port-queue/deno.jsonc | 16 -----------
packages/port-queue/deno.lock | 46 +++++++++++++++++++-------------
packages/port-queue/deps.ts | 1 -
packages/port-queue/dev_deps.ts | 5 ----
packages/port-queue/egg.json | 2 +-
packages/port-queue/mod.js | 1 -
packages/port-queue/mod.test.ts | 2 +-
packages/port-queue/port.ts | 2 +-
11 files changed, 91 insertions(+), 66 deletions(-)
create mode 100644 packages/port-queue/deno.json
delete mode 100644 packages/port-queue/deno.jsonc
delete mode 100644 packages/port-queue/deps.ts
delete mode 100644 packages/port-queue/dev_deps.ts
delete mode 100644 packages/port-queue/mod.js
diff --git a/.github/workflows/port-queue.yml b/.github/workflows/port-queue.yml
index 4cd77e70..a2009c0d 100644
--- a/.github/workflows/port-queue.yml
+++ b/.github/workflows/port-queue.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-queue
run: |
- cd packages/port-queue
deno task test
env:
CI: true
@@ -43,12 +43,17 @@ jobs:
runs-on: ubuntu-latest
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-queue
+ run: |
+ deno publish --allow-slow-types
# - name: 🥚 Setup Eggs CLI
# run: |
diff --git a/packages/port-queue/README.md b/packages/port-queue/README.md
index f895b5d5..7f039b0f 100644
--- a/packages/port-queue/README.md
+++ b/packages/port-queue/README.md
@@ -1,28 +1,29 @@
-# README
+hyper-port-queue
+Port for the Queue Service in the hyper Service Framework
+
+
+
+
+
+
Queue Port
- Create a Queue
- Delete a Queue
-- Post a JOB to a Queue
-- Get Jobs from a queue
+- Post a Job to a Queue
+- Get Jobs from a Queue
- Cancel a Job
- Retry a Job
-## Documentation
+
-https://docs.hyper63.com
+- [Test](#test)
-## Dev Environment
+
-### Build
+## Test
```
-yarn build
-```
-
-### Test
-
-```
-yarn test
+deno task test
```
diff --git a/packages/port-queue/deno.json b/packages/port-queue/deno.json
new file mode 100644
index 00000000..01045190
--- /dev/null
+++ b/packages/port-queue/deno.json
@@ -0,0 +1,34 @@
+{
+ "name": "@hyper63/port-queue",
+ "version": "0.3.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-queue/deno.jsonc b/packages/port-queue/deno.jsonc
deleted file mode 100644
index d98e5be0..00000000
--- a/packages/port-queue/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-queue/deno.lock b/packages/port-queue/deno.lock
index fbef7756..b4015bf0 100644
--- a/packages/port-queue/deno.lock
+++ b/packages/port-queue/deno.lock
@@ -1,22 +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",
- "https://deno.land/x/zod@v3.20.5/ZodError.ts": "10bb0d014b0ece532c3bc395c50ae25996315a5897c0216517d9174c2fb570b5",
- "https://deno.land/x/zod@v3.20.5/errors.ts": "5285922d2be9700cc0c70c95e4858952b07ae193aa0224be3cbd5cd5567eabef",
- "https://deno.land/x/zod@v3.20.5/external.ts": "a6cfbd61e9e097d5f42f8a7ed6f92f93f51ff927d29c9fbaec04f03cbce130fe",
- "https://deno.land/x/zod@v3.20.5/helpers/enumUtil.ts": "54efc393cc9860e687d8b81ff52e980def00fa67377ad0bf8b3104f8a5bf698c",
- "https://deno.land/x/zod@v3.20.5/helpers/errorUtil.ts": "7a77328240be7b847af6de9189963bd9f79cab32bbc61502a9db4fe6683e2ea7",
- "https://deno.land/x/zod@v3.20.5/helpers/parseUtil.ts": "51a76c126ee212be86013d53a9d07f87e9ae04bb1496f2558e61b62cb74a6aa8",
- "https://deno.land/x/zod@v3.20.5/helpers/partialUtil.ts": "8dc921a02b47384cf52217c7e539268daf619f89319b75bdf13ea178815725df",
- "https://deno.land/x/zod@v3.20.5/helpers/typeAliases.ts": "0fda31a063c6736fc3cf9090dd94865c811dfff4f3cb8707b932bf937c6f2c3e",
- "https://deno.land/x/zod@v3.20.5/helpers/util.ts": "0e7366354b1a5070408c1c48d01c7e33d374ca70806f5003b12ff527795c578c",
- "https://deno.land/x/zod@v3.20.5/index.ts": "035a7422d9f2be54daa0fe464254b69225b443000673e4794095d672471e8792",
- "https://deno.land/x/zod@v3.20.5/locales/en.ts": "ac7210faad6e67ec4f6dbe7062886f04db79ce91ae5ee6c9f64cbdf6221bc80e",
- "https://deno.land/x/zod@v3.20.5/mod.ts": "64e55237cb4410e17d968cd08975566059f27638ebb0b86048031b987ba251c4",
- "https://deno.land/x/zod@v3.20.5/types.ts": "6ddc4608e70d75f2e06f9cc14aa406df4d80f420c0eef64f2f02d429853c0c38"
+ "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-queue/deps.ts b/packages/port-queue/deps.ts
deleted file mode 100644
index 0a1b36d8..00000000
--- a/packages/port-queue/deps.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from 'https://deno.land/x/zod@v3.20.5/mod.ts'
diff --git a/packages/port-queue/dev_deps.ts b/packages/port-queue/dev_deps.ts
deleted file mode 100644
index 14d9255a..00000000
--- a/packages/port-queue/dev_deps.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export {
- assert,
- assertEquals,
- assertRejects,
-} from 'https://deno.land/std@0.178.0/testing/asserts.ts'
diff --git a/packages/port-queue/egg.json b/packages/port-queue/egg.json
index 8b81e28f..df7dc86a 100644
--- a/packages/port-queue/egg.json
+++ b/packages/port-queue/egg.json
@@ -2,7 +2,7 @@
"$schema": "https://x.nest.land/eggs@0.3.8/src/schema.json",
"name": "hyper-port-queue",
"entry": "./mod.ts",
- "description": "Hyper service framework port for Queue adapters",
+ "description": "Port for the Queue Service in the hyper Service Framework",
"homepage": "https://github.com/hyper63/hyper",
"repo": "https://github.com/hyper63/hyper",
"version": "0.3.0",
diff --git a/packages/port-queue/mod.js b/packages/port-queue/mod.js
deleted file mode 100644
index 8833f3be..00000000
--- a/packages/port-queue/mod.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from './mod.ts'
diff --git a/packages/port-queue/mod.test.ts b/packages/port-queue/mod.test.ts
index 2c9bca5c..7ccd1b80 100644
--- a/packages/port-queue/mod.test.ts
+++ b/packages/port-queue/mod.test.ts
@@ -1,5 +1,5 @@
// deno-lint-ignore-file no-unused-vars ban-ts-comment
-import { assert, assertRejects } from './dev_deps.ts'
+import { assert, assertRejects } from '@std/assert'
import { queue, type QueuePort } from './mod.ts'
diff --git a/packages/port-queue/port.ts b/packages/port-queue/port.ts
index 3008de95..5ea23bd1 100644
--- a/packages/port-queue/port.ts
+++ b/packages/port-queue/port.ts
@@ -1,4 +1,4 @@
-import { z, ZodRawShape } from './deps.ts'
+import { z, type ZodRawShape } from 'zod'
/**
* The hyper response schema. MOST adapter methods return this shape.