Skip to content

Commit 9f1250a

Browse files
committed
feat!: switch from zod to arktype
BREAKING CHANGE: `task.strict` now accepts Arktype types instead of Zod types.
1 parent d3dc2b4 commit 9f1250a

File tree

7 files changed

+163
-166
lines changed

7 files changed

+163
-166
lines changed

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"function",
1010
"typescript",
1111
"execa",
12-
"zod"
12+
"arktype"
1313
],
1414
"homepage": "https://github.com/haltcase/run#readme",
1515
"bugs": "https://github.com/haltcase/run/issues",
@@ -49,11 +49,10 @@
4949
"dependencies": {
5050
"@favware/colorette-spinner": "^1.0.1",
5151
"@isaacs/cliui": "^8.0.2",
52+
"arktype": "^2.1.17",
5253
"c12": "^2.0.1",
5354
"colorette": "^2.0.20",
54-
"execa": "^9.5.1",
55-
"zod": "^3.23.8",
56-
"zod-validation-error": "^3.4.0"
55+
"execa": "^9.5.1"
5756
},
5857
"devDependencies": {
5958
"@haltcase/style": "^6.2.1",

pnpm-lock.yaml

Lines changed: 53 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/handler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { extname } from "node:path";
33

44
import { Spinner } from "@favware/colorette-spinner";
55
import cliui from "@isaacs/cliui";
6-
import { bold, yellow } from "colorette";
6+
import { bold, gray, yellow } from "colorette";
77

88
import type { AppConfig } from "../config.js";
99
import { isBrandedTask } from "../tasks/guards.js";
@@ -103,16 +103,16 @@ export const taskListHandler = (context: HelpContextScript): string => {
103103

104104
if (isBrandedTask(value)) {
105105
if (value.kind === "strictTask") {
106-
const properties = getSchemaProperties(value.schema);
107-
const { description = "" } = value.schema;
106+
const properties =
107+
getSchemaProperties(value.schema) || gray("not available");
108108

109109
ui.div(
110110
{
111111
text: formattedName,
112112
width: nameColumnWidth,
113113
padding: [0, taskListPaddingX, 0, taskListPaddingX]
114114
},
115-
...[properties, description].filter(Boolean)
115+
properties
116116
);
117117

118118
continue;

src/tasks/guards.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import type { BrandedTask, BrandedTaskStrict, Task } from "./types.js";
33
export const isBrandedTask = (task: Task): task is BrandedTask =>
44
"kind" in task;
55

6-
export const isBrandedTaskStrict = (task: Task): task is BrandedTaskStrict =>
7-
"kind" in task && task.kind === "strictTask";
6+
export const isBrandedTaskStrict = <T>(
7+
task: Task<T>
8+
): task is BrandedTaskStrict<T> => "kind" in task && task.kind === "strictTask";

0 commit comments

Comments
 (0)