# Runfile | https://crates.io/crates/runnables-cli

[dev-core]
alias = "dc"
description = "runs core --release pointing to .dev/core.config.toml"
cmd = "KOMODO_CONFIG_PATH=.dev/core.config.toml cargo run -p komodo_core --release"

[dev-periphery]
alias = "dp"
description = "runs periphery --release pointing to .dev/periphery.config.toml"
cmd = "cargo run -p komodo_periphery --release -- -c .dev/periphery.config.toml"

[dev-periphery-outbound]
alias = "dpo"
description = "runs periphery --release pointing to .dev/periphery.config.toml and .dev/outbound.periphery.config.toml"
cmd = "cargo run -p komodo_periphery --release -- -c .dev/periphery.config.toml -c .dev/outbound.periphery.config.toml"

[yarn-install]
alias = "yi"
description = "downloads latest javacript dependencies for client and ui"
cmd = """
cd ui && yarn && \
cd ../docsite && yarn && \
cd ../client/core/ts && yarn
"""

[gen-client]
alias = "gc"
description = "generates typescript types and build the ts client"
after = "yarn-install"
cmd = """
node ./client/core/ts/generate_types.mjs && \
cd ./client/core/ts && yarn build && \
cp -r dist/. ../../../ui/public/client/. &&
cd ../../../ui && node fix_public_client.mjs"""

[link-client]
description = "yarn links the ts client to the ui"
after = "gen-client"
cmd = """
cd ./client/core/ts && yarn link && \
cd ../../../ui && yarn link komodo_client && yarn"""

[dev-compose]
description = "deploys dev.compose.yaml"
cmd = """
docker compose -p komodo-dev -f dev.compose.yaml down --remove-orphans && \
docker compose -p komodo-dev -f dev.compose.yaml up -d"""

[dev-compose-exposed]
description = "deploys dev.compose.yaml with exposed port and non-ssl periphery"
cmd = """
docker compose -p komodo-dev down --remove-orphans && \
docker compose -p komodo-dev -f dev.compose.yaml -f expose.compose.yaml up -d"""

[dev-compose-build]
description = "builds and deploys dev.compose.yaml"
cmd = "docker compose -p komodo-dev -f dev.compose.yaml build"

[dev-rustdoc]
description = "starts the rustdoc site (https://docs.rs/komodo_client/latest/komodo_client/) in dev mode"
cmd = "cargo doc --no-deps -p komodo_client && http-server -p 8050 target/doc"

[deploy-komodo]
alias = "dk"
cmd = "deno run --allow-all action/deploy.ts"

[deploy-komodo-fe-only]
alias = "dkf"
cmd = "deno run --allow-all action/deploy-fe.ts"

[build-komodo]
alias = "bk"
cmd = "deno run --allow-all action/build.ts"