Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breakage in Typst 0.11 #2

Merged
merged 11 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Probe runner package cache
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: imagemagick cargo
version: 1.0

- name: Install oxipng from crates.io
uses: baptiste0928/[email protected]
with:
crate: oxipng

- name: Install just from crates.io
uses: baptiste0928/[email protected]
with:
crate: just

- name: Install typst-test from github
uses: baptiste0928/[email protected]
with:
crate: typst-test
git: https://github.com/tingerrr/typst-test.git
tag: ci-semi-stable

- name: Setup typst
uses: yusancky/setup-typst@v2
with:
version: 'v0.11.0'

- name: Run test suite
run: just ci
3 changes: 3 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**.png
**.jpg
**.pdf
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# [unreleased](https://github.com/jamesxX/valakyrie/releases/tags/)
## Added

## Removed

## Changed

---

# [v0.1.1](https://github.com/jamesxX/valakyrie/releases/tags/v0.1.1)
## Changed
- fixed syntax error in Typst 0.11+ because of internal context type

---

# [v0.1.0](https://github.com/jamesxX/valakyrie/releases/tags/v0.1.0)
Initial Release
22 changes: 22 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root := justfile_directory()

export TYPST_ROOT := root

[private]
default:
@just --list --unsorted

# generate manual
doc:
typst compile docs/manual.typ docs/manual.pdf

# run test suite
test *args:
typst-test run {{ args }}

# update test cases
update *args:
typst-test run {{ args }}

# run ci suite
ci: test doc
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# The `Valkyrie` Package
<div align="center">Version 0.1.0</div>
<div align="center">Version 0.1.1</div>

This package implements type validation, and is targetted mainly at package and template developers. The desired outcome is that it becomes easier for the programmer to quickly put a package together without spending a long time on type safety, but also to make the usage of those packages by end-users less painful by generating useful error messages.

## Example Usage
```typ
#import "@preview/valkyrie:0.1.0" as z
#import "@preview/valkyrie:0.1.1" as z

#let my-schema = z.dictionary(
should-be-string: z.string(),
complicated-tuple: z.tuple(
z.email(),
z.ip(),
z.either(
z.string(),
z.number()
)
)
should-be-string: z.string(),
complicated-tuple: z.tuple(
z.email(),
z.ip(),
z.either(
z.string(),
z.number(),
),
),
)

#z.parse(
(
should-be-string: "This doesn't error",
complicated-tuple: (
"[email protected]",
"NOT AN IP", // Error: Schema validation failed on argument.complicated-tuple.1:
// String must be a valid IP address
1
)
(
should-be-string: "This doesn't error",
complicated-tuple: (
"[email protected]",
// Error: Schema validation failed on argument.complicated-tuple.1:
// String must be a valid IP address
"NOT AN IP",
1,
),
my-schema
),
my-schema,
)
```
```
Binary file modified docs/manual.pdf
Binary file not shown.
Loading
Loading