Skip to content

Commit

Permalink
chore: publish 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalbdivad committed Jan 17, 2025
1 parent 4fe9623 commit 56f8d0b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 74 deletions.
2 changes: 1 addition & 1 deletion ark/attest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/attest",
"version": "0.38.0",
"version": "0.39.0",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/fast-check/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/fast-check",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/fs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/fs",
"version": "0.34.0",
"version": "0.35.0",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/repo/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand Down
89 changes: 21 additions & 68 deletions ark/repo/scratch.ts
Original file line number Diff line number Diff line change
@@ -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<string, number> = {}
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)
2 changes: 1 addition & 1 deletion ark/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/schema",
"version": "0.34.0",
"version": "0.35.0",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/util",
"version": "0.34.0",
"version": "0.35.0",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down

0 comments on commit 56f8d0b

Please sign in to comment.