Skip to content
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
21 changes: 12 additions & 9 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"useTabs": true,
"json": {},
"json": { "jsonTrailingCommaFiles": [".zed/settings.json"], "trailingCommas": "jsonc" },
"markdown": { "textWrap": "maintain", "emphasisKind": "asterisks" },
"malva": {},
"markup": {
Expand All @@ -10,13 +11,14 @@
"printWidth": 160,
},
"shfmt": {
"associations": ["**/bin/{install-branch,run,runner}", "**/*.{bash,zsh,sh}"],
"associations": ["**/bin/{install-branch,.runner-dev}", "**/*.{bash,zsh,sh}"],
"useTabs": true,
"binaryNextLine": true,
"switchCaseIndent": true,
"experimentalZsh": true,
},
"yaml": { "printWidth": 160 },
"jsonSchemaSort": { "associations": ["**/schema.json", "**/*.schema.json"] },
"exec": {
"commands": [
{ "command": "tombi format - --stdin-filename {{file_path}}", "exts": ["toml"] },
Expand All @@ -31,19 +33,20 @@
"**/target",
"**/dist",
"**/downloads",
"**/schemas/*.json",
"schemas/*.example.json",
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.96.1.wasm",
"https://plugins.dprint.dev/json-0.21.3.wasm",
"https://plugins.dprint.dev/markdown-0.22.1.wasm",
"https://plugins.dprint.dev/dockerfile-0.4.0.wasm",
"https://plugins.dprint.dev/exec-0.6.2.json@df98f54ffd3092b8a841aedd6d098a2651f16d0a796a40535774f1a8b4b9d463",
"https://plugins.dprint.dev/g-plane/malva-v0.16.0.wasm",
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.27.3.wasm",
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm",
"https://plugins.dprint.dev/exec-0.6.2.json@df98f54ffd3092b8a841aedd6d098a2651f16d0a796a40535774f1a8b4b9d463",
"https://plugins.dprint.dev/json-0.21.3.wasm",
"https://plugins.dprint.dev/kjanat/json-schema-sort-0.1.0.wasm",
"https://plugins.dprint.dev/kjanat/shfmt-1.0.0.wasm",
"https://plugins.dprint.dev/kjanat/sortpackagejson-0.2.1.wasm",
"https://plugins.dprint.dev/kjanat/svg-v0.4.1.wasm",
"https://plugins.dprint.dev/kjanat/shfmt-1.0.0.wasm",
"https://plugins.dprint.dev/dockerfile-0.4.0.wasm",
"https://plugins.dprint.dev/markdown-0.22.1.wasm",
"https://plugins.dprint.dev/typescript-0.96.1.wasm",
],
}
14 changes: 14 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Upload schemas to GitHub Pages
on: { push: { branches: [master], paths: [schemas/**] } }
permissions: { contents: read, id-token: write, pages: write }
jobs:
upload:
runs-on: ubuntu-slim
environment: { name: github-pages, url: "${{ steps.deployment.outputs.page_url }}" }
steps: [
{ uses: actions/checkout@v6, with: { sparse-checkout: schemas/*.schema.json } },
{ uses: actions/configure-pages@v5, with: { enablement: true }, id: conf },
{ uses: actions/upload-pages-artifact@v4, with: { path: . } },
{ uses: actions/deploy-pages@v4, id: deployment },
]
22 changes: 16 additions & 6 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"formatter": [
{ "language_server": { "name": "dprint" } },
Expand All @@ -10,7 +6,21 @@
"prettier": { "allowed": false },
"lsp": {
"json-language-server": {
"settings": { "json": { "schemas": [{ "fileMatch": ["targets.json"], "url": "./npm/targets.schema.json" }] } }
"settings": {
"json": {
"schemas": [
{ "fileMatch": ["targets.json"], "url": "./npm/targets.schema.json" },
{ "fileMatch": ["schemas/*.schema.json", "*.schema.json"], "url": "https://json-schema.org/draft/2020-12/schema" },
{ "fileMatch": ["schemas/doctor.v1.example.json", "doctor.v1.example.json"], "url": "./schemas/doctor.v1.schema.json" },
{ "fileMatch": ["schemas/doctor.v2.example.json", "doctor.v2.example.json"], "url": "./schemas/doctor.v2.schema.json" },
{ "fileMatch": ["schemas/list.v1.example.json", "list.v1.example.json"], "url": "./schemas/list.v1.schema.json" },
{ "fileMatch": ["schemas/list.v2.example.json", "list.v2.example.json"], "url": "./schemas/list.v2.schema.json" },
{ "fileMatch": ["schemas/why.v1.example.json", "why.v1.example.json"], "url": "./schemas/why.v1.schema.json" },
{ "fileMatch": ["schemas/why.v2.example.json", "why.v2.example.json"], "url": "./schemas/why.v2.schema.json" },
{ "fileMatch": ["schemas/doctor.v3-draft.example.json", "doctor.v3-draft.example.json"], "url": "./schemas/doctor.v3-draft.schema.json" }
]
}
}
},
"rust-analyzer": {
"initialization_options": {
Expand All @@ -20,6 +30,6 @@
}
}
},
"file_types": { "SVG": ["*.ico"] },
"file_types": { "SVG": ["*.ico"], "Shell Script": [".runner-dev", "justfile"] },
"languages": { "TOML": { "language_servers": ["tombi", "..."] } }
}
35 changes: 34 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ features = ["unstable-dynamic"]
version = "0.3"
optional = true

[dependencies.json-schema-sort]
version = "0.1"
default-features = false
optional = true

[dependencies.schemars]
version = "1.2"
optional = true
Expand All @@ -95,7 +100,7 @@ features = ["parse", "serde"]
default = ["run"]
man = ["dep:clap_mangen"]
run = []
schema = ["dep:schemars"]
schema = ["dep:json-schema-sort", "dep:schemars"]

[lints.clippy]
all = { level = "deny", priority = -1 }
Expand Down
50 changes: 50 additions & 0 deletions bin/.runner-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -euo pipefail

invoked_name="$(basename -- "$0")"

case "${invoked_name}" in
run | runner) ;;
*)
printf 'error: unsupported launcher name: %s\n' "${invoked_name}" >&2
exit 1
;;
esac

source_path="${BASH_SOURCE[0]}"

while [[ -L "${source_path}" ]]; do
source_dir="$(
unset CDPATH
cd -- "$(dirname -- "${source_path}")"
pwd -P
)"

link_target="$(readlink -- "${source_path}")"

case "${link_target}" in
/*) source_path="${link_target}" ;;
*) source_path="${source_dir}/${link_target}" ;;
esac
done

script_dir="$(
unset CDPATH
cd -- "$(dirname -- "${source_path}")"
pwd -P
)"

manifest="${script_dir}/../Cargo.toml"
target_dir="${script_dir}/../target/runner-dev"

[[ -f "${manifest}" ]] || {
printf 'error: %s not found\n' "${manifest}" >&2
exit 1
}

exec cargo run --locked --quiet \
--bin "${invoked_name}" \
--features=run,man,schema \
--manifest-path="${manifest}" \
--target-dir="${target_dir}" \
-- "$@"
23 changes: 0 additions & 23 deletions bin/run

This file was deleted.

1 change: 1 addition & 0 deletions bin/run
23 changes: 0 additions & 23 deletions bin/runner

This file was deleted.

1 change: 1 addition & 0 deletions bin/runner
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ npm-pkg-scope := `cargo metadata --format-version 1 --no-deps | jq -r --arg id "
build-pkgscript := "npm" / "scripts" / "build-packages.ts"
downloads-dir := "npm" / "downloads"

schema := "schemas" / "runner.toml.schema.json"
schema-dir := "schemas"

[arg('bin', pattern='run|runner')]
[arg('profile', pattern='dev|release|')]
Expand All @@ -27,12 +27,12 @@ runner *args:
ls:
@just --list

# Regenerate the committed JSON Schema for `runner.toml`.
# Regenerate the committed JSON Schemas.
# Drift guard: just gen-schema && git diff --exit-code schemas/
[group('schema')]
gen-schema:
@echo "→ regenerating {{ BLUE }}{{ schema }}{{ NORMAL }}"
@cargo schema --output {{ schema }}
@echo "→ regenerating {{ BLUE }}{{ schema-dir }}{{ NORMAL }}"
@cargo schema --all --output {{ schema-dir }}

[group('npm')]
build-packages only="" skip="false" version=cargo-version:
Expand Down
Loading