leptodon 1.0.0

Your Leptos UI toolkit
Documentation
[tasks.license-check]
command = "licensure"
args = ["--check", "--project"]

# Builds
[tasks.build-demo]
cwd = "demo"
command = "cargo"
args = ["leptos", "build", "--release", "--precompress", "-vv"]

# Lints
[tasks.lint-library]
cwd = "."
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]

[tasks.lint-test-overview]
cwd = "./overview"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]

[tasks.lint-test-overview-codegen]
cwd = "./overview/codegen"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]

[tasks.lint-demo]
cwd = "./demo"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]

[tasks.lint-demo-codegen]
cwd = "./demo/codegen"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]

[tasks.lint-demo-macros]
cwd = "./proc-macros"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]

[tasks.lint]
run_task = { name = [
    "lint-library",
    "lint-test-overview",
    "lint-test-overview-codegen",
    "lint-demo",
    "lint-demo-codegen",
    "lint-demo-macros",
] }

# Tests
[tasks.unit-tests]
cwd = "."
command = "cargo"
args = ["nextest", "run"]

[tasks.integration-tests]
cwd = "overview"
script = '''
#!/bin/sh
set +e
cargo leptos build --precompress --release;
target/release/overview &

echo "Up and running";
cd end2end;
npm install;

# This script supports nixos with devenv or ubuntu:24 due to playwright.
if command -v devenv >/dev/null 2>&1
then
    CI=1 devenv shell playwright test;
else
    npx playwright install-deps;
    npx playwright install;
    CI=1 npx playwright test;
fi

# Kills whatever this script spawned
kill $! && echo "killed server";

'''

[tasks.tests]
run_task = { name = [
    "unit-tests",
    "integration-tests"
] }

# Tries to run the same checks as the CI, locally.
[tasks.mimic-ci]
run_task = { name = [
    "license-check",
    "lint",
    "tests"
] }

# Publish tasks
[tasks.publish-if-missing]
script = '''
#!/bin/sh
set +e
crate=${1:-${PUBLISH_CRATE?Expecting <crate> argument or PUBLISH_CRATE env variable. E.g. leptodon, leptodon-proc-macros}}
path=${2:-${PUBLISH_PATH?Expecting <path> argument or PUBLISH_PATH env variable, wherin the Cargo.toml can be found. E.g. leptodon-proc-macros}}

cd $path;

local_version=$(
    cargo info $crate -q --color never |\
        grep -oP '^version:\s*\K[^\s]+'
);
remote_version=$(
    cargo search --quiet --limit 1 --color never $crate |\
        grep -oP "$crate\s*=\s*\"\K[^\"]+"
);

if [ "$local_version" != "$remote_version" ]; then
    echo "Local '$local_version' != '$remote_version'.";
    echo "Starting to publish.";
    cargo publish;
else
    echo "Version already match!"
    echo "Skipping publishing of $crate.";
fi
'''

[tasks.publish-leptodon-if-missing]
env = { "PUBLISH_CRATE" = "leptodon", "PUBLISH_PATH" = "./" }
run_task = "publish-if-missing"

[tasks.publish-leptodon-proc-macros-if-missing]
env = { "PUBLISH_CRATE" = "leptodon-proc-macros", "PUBLISH_PATH" = "./proc-macros" }
run_task = "publish-if-missing"