From 56f8d0bae8707873acdea42fa5405474abd740c5 Mon Sep 17 00:00:00 2001 From: ssalbdivad Date: Fri, 17 Jan 2025 09:58:26 -0500 Subject: [PATCH] chore: publish 2.0 --- ark/attest/package.json | 2 +- ark/fast-check/package.json | 2 +- ark/fs/package.json | 2 +- ark/repo/publish.ts | 2 +- ark/repo/scratch.ts | 89 +++++++++---------------------------- ark/schema/package.json | 2 +- ark/util/package.json | 2 +- 7 files changed, 27 insertions(+), 74 deletions(-) diff --git a/ark/attest/package.json b/ark/attest/package.json index a9e31098d2..63037eba09 100644 --- a/ark/attest/package.json +++ b/ark/attest/package.json @@ -1,6 +1,6 @@ { "name": "@ark/attest", - "version": "0.38.0", + "version": "0.39.0", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/fast-check/package.json b/ark/fast-check/package.json index 8afff29486..ee1998d9ef 100644 --- a/ark/fast-check/package.json +++ b/ark/fast-check/package.json @@ -1,6 +1,6 @@ { "name": "@ark/fast-check", - "version": "0.0.7", + "version": "0.0.8", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/fs/package.json b/ark/fs/package.json index f99b238d34..0956eae2bb 100644 --- a/ark/fs/package.json +++ b/ark/fs/package.json @@ -1,6 +1,6 @@ { "name": "@ark/fs", - "version": "0.34.0", + "version": "0.35.0", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/repo/publish.ts b/ark/repo/publish.ts index e915cc3155..e4b981a0bf 100644 --- a/ark/repo/publish.ts +++ b/ark/repo/publish.ts @@ -3,7 +3,7 @@ import { packages, type ArkPackage } from "./shared.ts" const tagsToPublish: string[] = [] -const existingTags = getShellOutput("git tag") +const existingTags = getShellOutput("git tag").split("\n") const publishPackage = (pkg: ArkPackage, alias?: string) => { const tagName = `${alias ?? pkg.name}@${pkg.version}` diff --git a/ark/repo/scratch.ts b/ark/repo/scratch.ts index 05204d9200..850f779497 100644 --- a/ark/repo/scratch.ts +++ b/ark/repo/scratch.ts @@ -1,75 +1,28 @@ -import { scope, type } from "arktype" -import { Disjoint } from "../schema/shared/disjoint.ts" -import { buildApi, jsDocGen } from "./jsDocGen.ts" +import { type } from "arktype" -// type stats on attribute removal merge 12/18/2024 -// { -// "checkTime": 10.98, -// "types": 409252, -// "instantiations": 5066185 -// } - -const uniqueStrings = type("string[]").narrow((arr, ctx) => { - const seen: Record = {} - for (let i = 0; i < arr.length; i++) { - if (arr[i] in seen) { - return ctx.reject({ - expected: "a unique string", - actual: `a duplicate of '${arr[i]}' at index ${seen[arr[i]]}`, - relativePath: [i] - }) - } else seen[arr[i]] = i +const user = type({ + name: "string", + projects: "string[]", + nested: { + nested2: { + key: "string.numeric.parse | number" + } } - return true }) -// const notFoo = type.string.narrow((s, ctx) => { -// if (s !== "foo") return true -// // ["names", 1] -// console.warn(ctx.path) -// return ctx.mustBe("not foo") -// }) - -// const obj = type({ -// names: notFoo.array() -// }) - -// // ArkErrors: names[1] must be not foo (was "foo") -// obj({ names: ["bar", "foo"] }) - -const closedObjectScope = scope( - { - user: { - name: "string" - } - }, - { - onUndeclaredKey: "reject" - } -) -const types = closedObjectScope.export() -types.user({ name: "Alice", age: 99 }).toString() //? +user.extends({ name: "string" }) //? -const user = type({ - password: "string >= 8" -}).configure({ - message: ctx => - `${ctx.propString || "(root)"}: ${ctx.actual} isn't ${ctx.expected}` +const out = user({ + name: "Josh Goldberg", + projects: ["typescript-eslint", "mocha", 999] }) -// ArkErrors: (root): a string isn't an object -const out1 = user("ez123") -// but `.configure` only applies shallowly, so the nested error isn't changed! -// ArkErrors: password must be at least length 8 (was 5) -const out2 = user({ password: "ez123" }) -const mod = type.module( - { isEven: "number%2" }, - { - divisor: { - expected: ctx => `% ${ctx.rule} !== 0`, - problem: ctx => `${ctx.actual} ${ctx.expected}` - } - } -) -// ArkErrors: 3 % 2 !== 0 -mod.isEven(3) +if (out instanceof type.errors) { + console.log(`Encountered ${out.length} errors:`) + console.log(out.summary) +} else { + console.log(`Valid result:`) + console.log(out) +} + +console.log(user.expression) diff --git a/ark/schema/package.json b/ark/schema/package.json index 71a4a62463..92d0f03f1f 100644 --- a/ark/schema/package.json +++ b/ark/schema/package.json @@ -1,6 +1,6 @@ { "name": "@ark/schema", - "version": "0.34.0", + "version": "0.35.0", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/util/package.json b/ark/util/package.json index 7260c680fb..491de25141 100644 --- a/ark/util/package.json +++ b/ark/util/package.json @@ -1,6 +1,6 @@ { "name": "@ark/util", - "version": "0.34.0", + "version": "0.35.0", "license": "MIT", "author": { "name": "David Blass",